diff --git a/.vn/scripts/build-scripts.sh b/.vn/scripts/build-scripts.sh index b28294b9..0648919b 100755 --- a/.vn/scripts/build-scripts.sh +++ b/.vn/scripts/build-scripts.sh @@ -4,13 +4,17 @@ # See https://github.com/vercel/ncc # NOTE: you are expected to run "yarn run build:scripts" from the project root for path to be correct vn_scripts_dir=./.vn/scripts -for f in "$vn_scripts_dir/ts-sources"/* +ts_sources_dir="$vn_scripts_dir/ts-sources" +# The printf strips the root, so result is "db/reset.ts foobar.ts" etc. +for f in `find "$ts_sources_dir" -type f -name "*.ts" -printf '%P\n'` do echo "Build $f" + dname=`dirname "$f"` fname=`basename "$f"` fname_no_ext=`echo "$fname" | cut -d. -f1` echo "Filename $fname, without ext $fname_no_ext" - yarn run ncc build "$f" --no-cache --out "$vn_scripts_dir/dist" - mv "$vn_scripts_dir/dist/index.js" "$vn_scripts_dir/$fname_no_ext".js + yarn run ncc build "$ts_sources_dir/$f" --no-cache --out "$vn_scripts_dir/dist" + mkdir -p "$vn_scripts_dir/$dname" + mv "$vn_scripts_dir/dist/index.js" "$vn_scripts_dir/$dname/$fname_no_ext".js done rm -R "$vn_scripts_dir/dist" \ No newline at end of file diff --git a/.vn/scripts/test-script.js b/.vn/scripts/db/reset.js similarity index 99% rename from .vn/scripts/test-script.js rename to .vn/scripts/db/reset.js index d9695500..2280c337 100644 --- a/.vn/scripts/test-script.js +++ b/.vn/scripts/db/reset.js @@ -111964,20 +111964,20 @@ module.exports = __nccwpck_require__(1669).deprecate; /***/ }), -/***/ 5743: +/***/ 1977: /***/ ((module, __webpack_exports__, __nccwpck_require__) => { "use strict"; __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__) => { __nccwpck_require__.r(__webpack_exports__); -/* harmony import */ var _api_mongoose_connection__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(841); -/** - * This is a dummy script, demoing our script building capabilities - * - * It may be extended to handle database seeding - */ +/* harmony import */ var mongoose__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(4740); +/* harmony import */ var mongoose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(mongoose__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _api_mongoose_connection__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(841); + -await (0,_api_mongoose_connection__WEBPACK_IMPORTED_MODULE_0__/* .connectToAppDb */ .K6)().then(console.log).catch(console.log); +await (0,_api_mongoose_connection__WEBPACK_IMPORTED_MODULE_1__/* .connectToAppDb */ .K6)(); +await mongoose__WEBPACK_IMPORTED_MODULE_0___default().connection.db.dropDatabase(); +await (0,_api_mongoose_connection__WEBPACK_IMPORTED_MODULE_1__/* .closeDbConnection */ .$n)(); __webpack_handle_async_dependencies__(); }, 1); @@ -111991,10 +111991,11 @@ __webpack_handle_async_dependencies__(); // EXPORTS __nccwpck_require__.d(__webpack_exports__, { + "$n": () => (/* binding */ closeDbConnection), "K6": () => (/* binding */ connectToAppDb) }); -// UNUSED EXPORTS: closeDbConnection, connectToDb +// UNUSED EXPORTS: connectToDb // EXTERNAL MODULE: ./node_modules/debug/src/index.js var src = __nccwpck_require__(8237); @@ -112004,8 +112005,8 @@ var src_default = /*#__PURE__*/__nccwpck_require__.n(src); const debugMongo = src_default()("vn:mongo"); // EXTERNAL MODULE: ./node_modules/mongoose/index.js -var node_modules_mongoose = __nccwpck_require__(4740); -var mongoose_default = /*#__PURE__*/__nccwpck_require__.n(node_modules_mongoose); +var mongoose = __nccwpck_require__(4740); +var mongoose_default = /*#__PURE__*/__nccwpck_require__.n(mongoose); ;// CONCATENATED MODULE: ./src/api/mongoose/connection.ts @@ -112069,7 +112070,7 @@ const connectToAppDb = async () => { }; async function closeDbConnection() { try { - await mongoose.connection.close(); + await mongoose_default().connection.close(); } catch (err) { // Catch locally error @@ -112109,7 +112110,7 @@ module.exports = webpackEmptyContext; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"vulcan-next","version":"0.4.1","private":true,"scripts":{"analyze-bundle:storybook":"cross-env ANALYZE=true yarn run build:storybook","analyze-bundle":"cross-env ANALYZE=true npm run build","auto-changelog":"auto-changelog -u","build-storybook":"build-storybook","build:docker":"docker build -f ./.vn/docker/vn.production.dockerfile -t vulcan-next .","build:scripts":"./.vn/scripts/build-scripts.sh","build:static":"next build && next export","build:storybook":"rm -Rf storybook-static && build-storybook -s ./public # TODO: we shouldn\'t need to remove, but Storybook 6.1 has a small bug and can\'t remove existing build automatically","build:test:docker":"docker build -f ./.vn/docker/cypress.dockerfile -t vulcan-next-test .","build":"next build","chromatic":"dotenv -e .env.development.local chromatic --build-script-name build-storybook","clean":"rm -Rf ./dist ./storybook-static .yalc # clean various build folders","combine:reports":"nyc merge reports && mv coverage.json .nyc_output/out.json # intermediate script","copy:reports":"cp coverage-e2e/coverage-final.json reports/from-cypress.json && cp coverage-unit/coverage-final.json reports/from-jest.json # intermediate scripts","coverage:e2e":"cross-env COVERAGE=1 npm run build && start-server-and-test start:test http://localhost:3000 \'COVERAGE=1 cypress run\'","coverage:unit":"jest --coverage","coverage":"npm run coverage:unit && npm run coverage:e2e","cypress:open":"cross-env CYPRESS_coverage=false NODE_ENV=test cypress open","cypress:run":"cross-env CYPRESS_DEBUG=false CYPRESS_coverage=false NODE_ENV=test cypress run --headless","debug":"NODE_OPTIONS=\'--inspect\' next","dev":"next","dev:test":"cross-env NODE_ENV=test next # Start app in test + dev mode","link-vulcan":"./.vn/scripts/link-vulcan.sh # for linking a local copy of Vulcan NPM monorepo (don\'t forget to publish in Vulcan NPM first)","lint":"yarn run next lint","mkdir:reports":"rm -Rf reports && mkdir reports || true # intermediate script","mongo":"yarn run start:mongo  # shortcut for start:mongo","postbuild":"next-sitemap --config vulcan-next-sitemap.js","postcoverage":"npm run report:combined # combine jest and cypress coverage reports","postinstall":"","precombine:reports":"npm run copy:reports && rm -Rf .nyc_output && mkdir .nyc_output || true # intermediate script","precopy:reports":"npm run mkdir:reports # intermediate script","precoverage":"rm -rf .nyc_output || true # delete previous nyx instrumentation","prereport:combined":"npm run combine:reports # intermediate script","report:combined":"nyc report --reporter lcov --report-dir coverage | exit 0 # intermediate script","start:docker":"docker run -p 3000:3000 --env-file .env.development -it vns:latest","start:mongo":"docker run --rm -p 27017:27017 -v \\"$(pwd)/.mongo:/data/db\\" --label vulcan-mongodb mongo:4.0.4 # will start or create & start the image + store data locally in .mongo folder + remove the container when stopped","start:static":"serve ./out","start:storybook-static":"serve storybook-static","start:test":"cross-env NODE_ENV=test npm run start # Start app in test mode","start":"next start","storybook":"start-storybook -p 6006 -s ./public","test:docker":"docker run --env-file .env.development -it vns-test:latest","test:e2e":"cross-env NODE_ENV=test npm run build && start-server-and-test start:test http://localhost:3000 \'cypress:run\'","test:unit":"jest --testPathIgnorePatterns=tests/vn","test:vn":"jest --testPathPattern=tests/vn # run tests for Vulcan Next itself, eg scripts (long) ","test":"npm run test:unit && npm run test:e2e","typecheck-watch":"tsc --noEmit --p src/tsconfig.json -w","typecheck":"tsc --noEmit --p src/tsconfig.json # in case of error with @vulcanjs/* package, check that src/types (eg simpl-schema) are up-to-date with vulcan-npm","update-link-vulcan":"yalc update"},"dependencies":{"@apollo/client":"^3.2.0","@emotion/react":"^11.4.0","@emotion/styled":"^11.3.0","@hapi/iron":"6.0.0","@material-ui/core":"^5.0.0-alpha.37","@material-ui/styles":"^4.11.4","@mdx-js/loader":"^1.6.6","@mdx-js/react":"^1.6.13","@next/mdx":"^10.0.2","@vulcanjs/demo":"^0.0.7","@vulcanjs/graphql":"^0.2.4","@vulcanjs/mdx":"^0.2.3-alpha.0","@vulcanjs/meteor-legacy":"^0.1.8","@vulcanjs/mongo":"^0.2.4","@vulcanjs/react-hooks":"^0.2.3","@vulcanjs/react-ui":"^0.2.3","apollo-server-express":"2.14.2","babel-jest":"26.0.1","babel-plugin-istanbul":"6.0.0","clsx":"^1.1.1","cors":"^2.8.5","cross-env":"7.0.2","debug":"4.1.1","express":"4.17.1","graphql":"15.4.0","graphql-tag":"2.10.3","gray-matter":"^4.0.2","i18next":"^19.4.5","i18next-browser-languagedetector":"^4.2.0","i18next-http-backend":"^1.0.15","lodash":"^4.17.19","mongoose":"^5.9.19","nanoid":"^3.1.25","next":"^11.1.0","next-connect":"^0.9.1","next-i18next":"^5.1.0","next-mdx-remote":"^2.1.3","next-sitemap":"^1.4.17","passport":"^0.4.1","passport-local":"1.0.0","polished":"^3.6.5","postcss-nested":"^4.2.1","react":"^17.0.1","react-dom":"^17.0.1","react-hook-form":"4.9.8","react-i18next":"^11.5.0","react-spring":"^8.0.27","styled-jsx-plugin-postcss":"^3.0.2","swr":"^0.4.0"},"devDependencies":{"@babel/core":"^7.10.2","@storybook/testing-react":"^0.0.22","@types/mongoose":"^5.7.27","@types/node":"^13.7.6","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","@types/shelljs":"^0.8.8","@vercel/ncc":"^0.30.0","babel-loader":"^8.1.0","eslint":"^7.32.0","graphql-voyager":"^1.0.0-rc.31","mongodb-memory-server":"^7.3.6","react-is":"^16.13.1","source-map-support":"^0.5.19","storybook-css-modules-preset":"^1.1.1","ts-loader":"^7.0.5","ts-node":"^8.10.2","typescript":"=4.3.5","yalc":"^1.0.0-pre.53"},"optionalDependencies":{"@cypress/code-coverage":"^3.8.1","@cypress/webpack-preprocessor":"^5.4.1","@istanbuljs/nyc-config-typescript":"^1.0.1","@next/bundle-analyzer":"^9.4.4","@next/plugin-storybook":"^11.1.0","@storybook/addon-a11y":"^6.3.7","@storybook/addon-actions":"^6.3.7","@storybook/addon-backgrounds":"^6.3.7","@storybook/addon-controls":"^6.3.7","@storybook/addon-docs":"^6.3.7","@storybook/addon-essentials":"^6.3.7","@storybook/addon-links":"^6.3.7","@storybook/addons":"^6.3.7","@storybook/react":"^6.3.7","@testing-library/cypress":"^6.0.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^10.2.0","@testing-library/react-hooks":"^3.3.0","@types/jest":"^25.2.3","auto-changelog":"^2.2.1","chromatic":"^5.9.2","cypress":"4.8.0","dotenv-cli":"^4.0.0","eslint-config-next":"^11.1.0","eslint-plugin-cypress":"2.11.1","jest":"^26.0.1","jest-transformer-mdx":"^2.2.0","nyc":"^15.1.0","serve":"^11.3.2","shelljs":"^0.8.4","start-server-and-test":"^1.11.0","storybook-addon-next-router":"^3.0.7"}}'); +module.exports = JSON.parse('{"name":"vulcan-next","version":"0.4.1","private":true,"scripts":{"analyze-bundle:storybook":"cross-env ANALYZE=true yarn run build:storybook","analyze-bundle":"cross-env ANALYZE=true npm run build","auto-changelog":"auto-changelog -u","build-storybook":"build-storybook","build:docker":"docker build -f ./.vn/docker/vn.production.dockerfile -t vulcan-next .","build:scripts":"./.vn/scripts/build-scripts.sh","build:static":"next build && next export","build:storybook":"rm -Rf storybook-static && build-storybook -s ./public # TODO: we shouldn\'t need to remove, but Storybook 6.1 has a small bug and can\'t remove existing build automatically","build:test:docker":"docker build -f ./.vn/docker/cypress.dockerfile -t vulcan-next-test .","build":"next build","chromatic":"dotenv -e .env.development.local chromatic --build-script-name build-storybook","clean":"rm -Rf ./dist ./storybook-static .yalc # clean various build folders","combine:reports":"nyc merge reports && mv coverage.json .nyc_output/out.json # intermediate script","copy:reports":"cp coverage-e2e/coverage-final.json reports/from-cypress.json && cp coverage-unit/coverage-final.json reports/from-jest.json # intermediate scripts","coverage:e2e":"cross-env COVERAGE=1 npm run build && start-server-and-test start:test http://localhost:3000 \'COVERAGE=1 cypress run\'","coverage:unit":"jest --coverage","coverage":"npm run coverage:unit && npm run coverage:e2e","cypress:open":"cross-env CYPRESS_coverage=false NODE_ENV=test cypress open","cypress:run":"cross-env CYPRESS_DEBUG=false CYPRESS_coverage=false NODE_ENV=test cypress run --headless","db:test:seed":"dotenv -e .env.test node .vn/scripts/db/seed.js","db:test:reset":"dotenv -e .env.test node .vn/scripts/db/reset.js # reset can only happen against the test database!","debug":"NODE_OPTIONS=\'--inspect\' next","dev":"next","dev:test":"cross-env NODE_ENV=test next # Start app in test + dev mode","link-vulcan":"./.vn/scripts/link-vulcan.sh # for linking a local copy of Vulcan NPM monorepo (don\'t forget to publish in Vulcan NPM first)","lint":"yarn run next lint","mkdir:reports":"rm -Rf reports && mkdir reports || true # intermediate script","mongo":"yarn run start:mongo  # shortcut for start:mongo","postbuild":"next-sitemap --config vulcan-next-sitemap.js","postcoverage":"npm run report:combined # combine jest and cypress coverage reports","postinstall":"","precombine:reports":"npm run copy:reports && rm -Rf .nyc_output && mkdir .nyc_output || true # intermediate script","precopy:reports":"npm run mkdir:reports # intermediate script","precoverage":"rm -rf .nyc_output || true # delete previous nyx instrumentation","prereport:combined":"npm run combine:reports # intermediate script","report:combined":"nyc report --reporter lcov --report-dir coverage | exit 0 # intermediate script","start:docker":"docker run -p 3000:3000 --env-file .env.development -it vns:latest","start:mongo":"docker run --rm -p 27017:27017 -v \\"$(pwd)/.mongo:/data/db\\" --label vulcan-mongodb mongo:4.0.4 # will start or create & start the image + store data locally in .mongo folder + remove the container when stopped","start:static":"serve ./out","start:storybook-static":"serve storybook-static","start:test":"cross-env NODE_ENV=test npm run start # Start app in test mode","start":"next start","storybook":"start-storybook -p 6006 -s ./public","test:docker":"docker run --env-file .env.development -it vns-test:latest","test:e2e":"cross-env NODE_ENV=test npm run build && start-server-and-test start:test http://localhost:3000 \'cypress:run\'","test:unit":"jest --testPathIgnorePatterns=tests/vn","test:vn":"jest --testPathPattern=tests/vn # run tests for Vulcan Next itself, eg scripts (long) ","test":"npm run test:unit && npm run test:e2e","typecheck-watch":"tsc --noEmit --p src/tsconfig.json -w","typecheck":"tsc --noEmit --p src/tsconfig.json # in case of error with @vulcanjs/* package, check that src/types (eg simpl-schema) are up-to-date with vulcan-npm","update-link-vulcan":"yalc update"},"dependencies":{"@apollo/client":"^3.2.0","@emotion/react":"^11.4.0","@emotion/styled":"^11.3.0","@hapi/iron":"6.0.0","@material-ui/core":"^5.0.0-alpha.37","@material-ui/styles":"^4.11.4","@mdx-js/loader":"^1.6.6","@mdx-js/react":"^1.6.13","@next/mdx":"^10.0.2","@vulcanjs/demo":"^0.0.7","@vulcanjs/graphql":"^0.2.4","@vulcanjs/mdx":"^0.2.3-alpha.0","@vulcanjs/meteor-legacy":"^0.1.8","@vulcanjs/mongo":"^0.2.4","@vulcanjs/react-hooks":"^0.2.3","@vulcanjs/react-ui":"^0.2.3","apollo-server-express":"2.14.2","babel-jest":"26.0.1","babel-plugin-istanbul":"6.0.0","clsx":"^1.1.1","cors":"^2.8.5","cross-env":"7.0.2","debug":"4.1.1","express":"4.17.1","graphql":"15.4.0","graphql-tag":"2.10.3","gray-matter":"^4.0.2","i18next":"^19.4.5","i18next-browser-languagedetector":"^4.2.0","i18next-http-backend":"^1.0.15","lodash":"^4.17.19","mongoose":"^5.9.19","nanoid":"^3.1.25","next":"^11.1.0","next-connect":"^0.9.1","next-i18next":"^5.1.0","next-mdx-remote":"^2.1.3","next-sitemap":"^1.4.17","passport":"^0.4.1","passport-local":"1.0.0","polished":"^3.6.5","postcss-nested":"^4.2.1","react":"^17.0.1","react-dom":"^17.0.1","react-hook-form":"4.9.8","react-i18next":"^11.5.0","react-spring":"^8.0.27","styled-jsx-plugin-postcss":"^3.0.2","swr":"^0.4.0"},"devDependencies":{"@babel/core":"^7.10.2","@storybook/testing-react":"^0.0.22","@types/mongoose":"^5.7.27","@types/node":"^13.7.6","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","@types/shelljs":"^0.8.8","@vercel/ncc":"^0.30.0","babel-loader":"^8.1.0","eslint":"^7.32.0","graphql-voyager":"^1.0.0-rc.31","mongodb-memory-server":"^7.3.6","react-is":"^16.13.1","source-map-support":"^0.5.19","storybook-css-modules-preset":"^1.1.1","ts-loader":"^7.0.5","ts-node":"^8.10.2","typescript":"=4.3.5","yalc":"^1.0.0-pre.53"},"optionalDependencies":{"@cypress/code-coverage":"^3.8.1","@cypress/webpack-preprocessor":"^5.4.1","@istanbuljs/nyc-config-typescript":"^1.0.1","@next/bundle-analyzer":"^9.4.4","@next/plugin-storybook":"^11.1.0","@storybook/addon-a11y":"^6.3.7","@storybook/addon-actions":"^6.3.7","@storybook/addon-backgrounds":"^6.3.7","@storybook/addon-controls":"^6.3.7","@storybook/addon-docs":"^6.3.7","@storybook/addon-essentials":"^6.3.7","@storybook/addon-links":"^6.3.7","@storybook/addons":"^6.3.7","@storybook/react":"^6.3.7","@testing-library/cypress":"^6.0.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^10.2.0","@testing-library/react-hooks":"^3.3.0","@types/jest":"^25.2.3","auto-changelog":"^2.2.1","chromatic":"^5.9.2","cypress":"4.8.0","dotenv-cli":"^4.0.0","eslint-config-next":"^11.1.0","eslint-plugin-cypress":"2.11.1","jest":"^26.0.1","jest-transformer-mdx":"^2.2.0","nyc":"^15.1.0","serve":"^11.3.2","shelljs":"^0.8.4","start-server-and-test":"^1.11.0","storybook-addon-next-router":"^3.0.7"}}'); /***/ }), @@ -112413,7 +112414,7 @@ module.exports = require("zlib"); /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module used 'module' so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(5743); +/******/ var __webpack_exports__ = __nccwpck_require__(1977); /******/ module.exports = __webpack_exports__; /******/ /******/ })() diff --git a/.vn/scripts/db/seed.js b/.vn/scripts/db/seed.js new file mode 100644 index 00000000..80ff11ed --- /dev/null +++ b/.vn/scripts/db/seed.js @@ -0,0 +1,190728 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 51529: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var tslib = __nccwpck_require__(4351); +var optimism = __nccwpck_require__(46864); +var utilities = __nccwpck_require__(56905); +var equality = __nccwpck_require__(9969); +var trie = __nccwpck_require__(71653); +var context = __nccwpck_require__(43792); + +var ApolloCache = (function () { + function ApolloCache() { + this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument); + } + ApolloCache.prototype.batch = function (options) { + var optimisticId = typeof options.optimistic === "string" ? options.optimistic : + options.optimistic === false ? null : void 0; + this.performTransaction(options.update, optimisticId); + }; + ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { + this.performTransaction(transaction, optimisticId); + }; + ApolloCache.prototype.transformDocument = function (document) { + return document; + }; + ApolloCache.prototype.identify = function (object) { + return; + }; + ApolloCache.prototype.gc = function () { + return []; + }; + ApolloCache.prototype.modify = function (options) { + return false; + }; + ApolloCache.prototype.transformForLink = function (document) { + return document; + }; + ApolloCache.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || 'ROOT_QUERY', optimistic: optimistic })); + }; + ApolloCache.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); + }; + ApolloCache.prototype.writeQuery = function (_a) { + var id = _a.id, data = _a.data, options = tslib.__rest(_a, ["id", "data"]); + return this.write(Object.assign(options, { + dataId: id || 'ROOT_QUERY', + result: data, + })); + }; + ApolloCache.prototype.writeFragment = function (_a) { + var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = tslib.__rest(_a, ["id", "data", "fragment", "fragmentName"]); + return this.write(Object.assign(options, { + query: this.getFragmentDoc(fragment, fragmentName), + dataId: id, + result: data, + })); + }; + return ApolloCache; +}()); + +exports.Cache = void 0; +(function (Cache) { +})(exports.Cache || (exports.Cache = {})); + +var MissingFieldError = (function (_super) { + tslib.__extends(MissingFieldError, _super); + function MissingFieldError(message, path, query, variables) { + var _this = _super.call(this, message) || this; + _this.message = message; + _this.path = path; + _this.query = query; + _this.variables = variables; + _this.__proto__ = MissingFieldError.prototype; + return _this; + } + return MissingFieldError; +}(Error)); + +var hasOwn = Object.prototype.hasOwnProperty; +function getTypenameFromStoreObject(store, objectOrReference) { + return utilities.isReference(objectOrReference) + ? store.get(objectOrReference.__ref, "__typename") + : objectOrReference && objectOrReference.__typename; +} +var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; +function fieldNameFromStoreName(storeFieldName) { + var match = storeFieldName.match(TypeOrFieldNameRegExp); + return match ? match[0] : storeFieldName; +} +function selectionSetMatchesResult(selectionSet, result, variables) { + if (utilities.isNonNullObject(result)) { + return Array.isArray(result) + ? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); }) + : selectionSet.selections.every(function (field) { + if (utilities.isField(field) && utilities.shouldInclude(field, variables)) { + var key = utilities.resultKeyNameFromField(field); + return hasOwn.call(result, key) && + (!field.selectionSet || + selectionSetMatchesResult(field.selectionSet, result[key], variables)); + } + return true; + }); + } + return false; +} +function storeValueIsStoreObject(value) { + return utilities.isNonNullObject(value) && + !utilities.isReference(value) && + !Array.isArray(value); +} +function makeProcessedFieldsMerger() { + return new utilities.DeepMerger; +} + +var DELETE = Object.create(null); +var delModifier = function () { return DELETE; }; +var INVALIDATE = Object.create(null); +exports.EntityStore = (function () { + function EntityStore(policies, group) { + var _this = this; + this.policies = policies; + this.group = group; + this.data = Object.create(null); + this.rootIds = Object.create(null); + this.refs = Object.create(null); + this.getFieldValue = function (objectOrReference, storeFieldName) { return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference) + ? _this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName]); }; + this.canRead = function (objOrRef) { + return utilities.isReference(objOrRef) + ? _this.has(objOrRef.__ref) + : typeof objOrRef === "object"; + }; + this.toReference = function (objOrIdOrRef, mergeIntoStore) { + if (typeof objOrIdOrRef === "string") { + return utilities.makeReference(objOrIdOrRef); + } + if (utilities.isReference(objOrIdOrRef)) { + return objOrIdOrRef; + } + var id = _this.policies.identify(objOrIdOrRef)[0]; + if (id) { + var ref = utilities.makeReference(id); + if (mergeIntoStore) { + _this.merge(id, objOrIdOrRef); + } + return ref; + } + }; + } + EntityStore.prototype.toObject = function () { + return tslib.__assign({}, this.data); + }; + EntityStore.prototype.has = function (dataId) { + return this.lookup(dataId, true) !== void 0; + }; + EntityStore.prototype.get = function (dataId, fieldName) { + this.group.depend(dataId, fieldName); + if (hasOwn.call(this.data, dataId)) { + var storeObject = this.data[dataId]; + if (storeObject && hasOwn.call(storeObject, fieldName)) { + return storeObject[fieldName]; + } + } + if (fieldName === "__typename" && + hasOwn.call(this.policies.rootTypenamesById, dataId)) { + return this.policies.rootTypenamesById[dataId]; + } + if (this instanceof Layer) { + return this.parent.get(dataId, fieldName); + } + }; + EntityStore.prototype.lookup = function (dataId, dependOnExistence) { + if (dependOnExistence) + this.group.depend(dataId, "__exists"); + if (hasOwn.call(this.data, dataId)) { + return this.data[dataId]; + } + if (this instanceof Layer) { + return this.parent.lookup(dataId, dependOnExistence); + } + if (this.policies.rootTypenamesById[dataId]) { + return Object.create(null); + } + }; + EntityStore.prototype.merge = function (older, newer) { + var _this = this; + var dataId; + if (utilities.isReference(older)) + older = older.__ref; + if (utilities.isReference(newer)) + newer = newer.__ref; + var existing = typeof older === "string" + ? this.lookup(dataId = older) + : older; + var incoming = typeof newer === "string" + ? this.lookup(dataId = newer) + : newer; + if (!incoming) + return; + __DEV__ ? globals.invariant(typeof dataId === "string", "store.merge expects a string ID") : globals.invariant(typeof dataId === "string", 1); + var merged = new utilities.DeepMerger(storeObjectReconciler).merge(existing, incoming); + this.data[dataId] = merged; + if (merged !== existing) { + delete this.refs[dataId]; + if (this.group.caching) { + var fieldsToDirty_1 = Object.create(null); + if (!existing) + fieldsToDirty_1.__exists = 1; + Object.keys(incoming).forEach(function (storeFieldName) { + if (!existing || existing[storeFieldName] !== merged[storeFieldName]) { + fieldsToDirty_1[storeFieldName] = 1; + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName && + !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { + fieldsToDirty_1[fieldName] = 1; + } + if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { + delete merged[storeFieldName]; + } + } + }); + if (fieldsToDirty_1.__typename && + !(existing && existing.__typename) && + this.policies.rootTypenamesById[dataId] === merged.__typename) { + delete fieldsToDirty_1.__typename; + } + Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); }); + } + } + }; + EntityStore.prototype.modify = function (dataId, fields) { + var _this = this; + var storeObject = this.lookup(dataId); + if (storeObject) { + var changedFields_1 = Object.create(null); + var needToMerge_1 = false; + var allDeleted_1 = true; + var sharedDetails_1 = { + DELETE: DELETE, + INVALIDATE: INVALIDATE, + isReference: utilities.isReference, + toReference: this.toReference, + canRead: this.canRead, + readField: function (fieldNameOrOptions, from) { return _this.policies.readField(typeof fieldNameOrOptions === "string" ? { + fieldName: fieldNameOrOptions, + from: from || utilities.makeReference(dataId), + } : fieldNameOrOptions, { store: _this }); }, + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + var fieldName = fieldNameFromStoreName(storeFieldName); + var fieldValue = storeObject[storeFieldName]; + if (fieldValue === void 0) + return; + var modify = typeof fields === "function" + ? fields + : fields[storeFieldName] || fields[fieldName]; + if (modify) { + var newValue = modify === delModifier ? DELETE : + modify(utilities.maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })); + if (newValue === INVALIDATE) { + _this.group.dirty(dataId, storeFieldName); + } + else { + if (newValue === DELETE) + newValue = void 0; + if (newValue !== fieldValue) { + changedFields_1[storeFieldName] = newValue; + needToMerge_1 = true; + fieldValue = newValue; + } + } + } + if (fieldValue !== void 0) { + allDeleted_1 = false; + } + }); + if (needToMerge_1) { + this.merge(dataId, changedFields_1); + if (allDeleted_1) { + if (this instanceof Layer) { + this.data[dataId] = void 0; + } + else { + delete this.data[dataId]; + } + this.group.dirty(dataId, "__exists"); + } + return true; + } + } + return false; + }; + EntityStore.prototype.delete = function (dataId, fieldName, args) { + var _a; + var storeObject = this.lookup(dataId); + if (storeObject) { + var typename = this.getFieldValue(storeObject, "__typename"); + var storeFieldName = fieldName && args + ? this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) + : fieldName; + return this.modify(dataId, storeFieldName ? (_a = {}, + _a[storeFieldName] = delModifier, + _a) : delModifier); + } + return false; + }; + EntityStore.prototype.evict = function (options) { + var evicted = false; + if (options.id) { + if (hasOwn.call(this.data, options.id)) { + evicted = this.delete(options.id, options.fieldName, options.args); + } + if (this instanceof Layer) { + evicted = this.parent.evict(options) || evicted; + } + if (options.fieldName || evicted) { + this.group.dirty(options.id, options.fieldName || "__exists"); + } + } + return evicted; + }; + EntityStore.prototype.clear = function () { + this.replace(null); + }; + EntityStore.prototype.extract = function () { + var _this = this; + var obj = this.toObject(); + var extraRootIds = []; + this.getRootIdSet().forEach(function (id) { + if (!hasOwn.call(_this.policies.rootTypenamesById, id)) { + extraRootIds.push(id); + } + }); + if (extraRootIds.length) { + obj.__META = { extraRootIds: extraRootIds.sort() }; + } + return obj; + }; + EntityStore.prototype.replace = function (newData) { + var _this = this; + Object.keys(this.data).forEach(function (dataId) { + if (!(newData && hasOwn.call(newData, dataId))) { + _this.delete(dataId); + } + }); + if (newData) { + var __META = newData.__META, rest_1 = tslib.__rest(newData, ["__META"]); + Object.keys(rest_1).forEach(function (dataId) { + _this.merge(dataId, rest_1[dataId]); + }); + if (__META) { + __META.extraRootIds.forEach(this.retain, this); + } + } + }; + EntityStore.prototype.retain = function (rootId) { + return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1; + }; + EntityStore.prototype.release = function (rootId) { + if (this.rootIds[rootId] > 0) { + var count = --this.rootIds[rootId]; + if (!count) + delete this.rootIds[rootId]; + return count; + } + return 0; + }; + EntityStore.prototype.getRootIdSet = function (ids) { + if (ids === void 0) { ids = new Set(); } + Object.keys(this.rootIds).forEach(ids.add, ids); + if (this instanceof Layer) { + this.parent.getRootIdSet(ids); + } + else { + Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); + } + return ids; + }; + EntityStore.prototype.gc = function () { + var _this = this; + var ids = this.getRootIdSet(); + var snapshot = this.toObject(); + ids.forEach(function (id) { + if (hasOwn.call(snapshot, id)) { + Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); + delete snapshot[id]; + } + }); + var idsToRemove = Object.keys(snapshot); + if (idsToRemove.length) { + var root_1 = this; + while (root_1 instanceof Layer) + root_1 = root_1.parent; + idsToRemove.forEach(function (id) { return root_1.delete(id); }); + } + return idsToRemove; + }; + EntityStore.prototype.findChildRefIds = function (dataId) { + if (!hasOwn.call(this.refs, dataId)) { + var found_1 = this.refs[dataId] = Object.create(null); + var root = this.data[dataId]; + if (!root) + return found_1; + var workSet_1 = new Set([root]); + workSet_1.forEach(function (obj) { + if (utilities.isReference(obj)) { + found_1[obj.__ref] = true; + } + if (utilities.isNonNullObject(obj)) { + Object.keys(obj).forEach(function (key) { + var child = obj[key]; + if (utilities.isNonNullObject(child)) { + workSet_1.add(child); + } + }); + } + }); + } + return this.refs[dataId]; + }; + EntityStore.prototype.makeCacheKey = function () { + return this.group.keyMaker.lookupArray(arguments); + }; + return EntityStore; +}()); +var CacheGroup = (function () { + function CacheGroup(caching, parent) { + if (parent === void 0) { parent = null; } + this.caching = caching; + this.parent = parent; + this.d = null; + this.resetCaching(); + } + CacheGroup.prototype.resetCaching = function () { + this.d = this.caching ? optimism.dep() : null; + this.keyMaker = new trie.Trie(utilities.canUseWeakMap); + }; + CacheGroup.prototype.depend = function (dataId, storeFieldName) { + if (this.d) { + this.d(makeDepKey(dataId, storeFieldName)); + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName) { + this.d(makeDepKey(dataId, fieldName)); + } + if (this.parent) { + this.parent.depend(dataId, storeFieldName); + } + } + }; + CacheGroup.prototype.dirty = function (dataId, storeFieldName) { + if (this.d) { + this.d.dirty(makeDepKey(dataId, storeFieldName), storeFieldName === "__exists" ? "forget" : "setDirty"); + } + }; + return CacheGroup; +}()); +function makeDepKey(dataId, storeFieldName) { + return storeFieldName + '#' + dataId; +} +function maybeDependOnExistenceOfEntity(store, entityId) { + if (supportsResultCaching(store)) { + store.group.depend(entityId, "__exists"); + } +} +(function (EntityStore) { + var Root = (function (_super) { + tslib.__extends(Root, _super); + function Root(_a) { + var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; + var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; + _this.stump = new Stump(_this); + _this.storageTrie = new trie.Trie(utilities.canUseWeakMap); + if (seed) + _this.replace(seed); + return _this; + } + Root.prototype.addLayer = function (layerId, replay) { + return this.stump.addLayer(layerId, replay); + }; + Root.prototype.removeLayer = function () { + return this; + }; + Root.prototype.getStorage = function () { + return this.storageTrie.lookupArray(arguments); + }; + return Root; + }(EntityStore)); + EntityStore.Root = Root; +})(exports.EntityStore || (exports.EntityStore = {})); +var Layer = (function (_super) { + tslib.__extends(Layer, _super); + function Layer(id, parent, replay, group) { + var _this = _super.call(this, parent.policies, group) || this; + _this.id = id; + _this.parent = parent; + _this.replay = replay; + _this.group = group; + replay(_this); + return _this; + } + Layer.prototype.addLayer = function (layerId, replay) { + return new Layer(layerId, this, replay, this.group); + }; + Layer.prototype.removeLayer = function (layerId) { + var _this = this; + var parent = this.parent.removeLayer(layerId); + if (layerId === this.id) { + if (this.group.caching) { + Object.keys(this.data).forEach(function (dataId) { + var ownStoreObject = _this.data[dataId]; + var parentStoreObject = parent["lookup"](dataId); + if (!parentStoreObject) { + _this.delete(dataId); + } + else if (!ownStoreObject) { + _this.group.dirty(dataId, "__exists"); + Object.keys(parentStoreObject).forEach(function (storeFieldName) { + _this.group.dirty(dataId, storeFieldName); + }); + } + else if (ownStoreObject !== parentStoreObject) { + Object.keys(ownStoreObject).forEach(function (storeFieldName) { + if (!equality.equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { + _this.group.dirty(dataId, storeFieldName); + } + }); + } + }); + } + return parent; + } + if (parent === this.parent) + return this; + return parent.addLayer(this.id, this.replay); + }; + Layer.prototype.toObject = function () { + return tslib.__assign(tslib.__assign({}, this.parent.toObject()), this.data); + }; + Layer.prototype.findChildRefIds = function (dataId) { + var fromParent = this.parent.findChildRefIds(dataId); + return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; + }; + Layer.prototype.getStorage = function () { + var p = this.parent; + while (p.parent) + p = p.parent; + return p.getStorage.apply(p, arguments); + }; + return Layer; +}(exports.EntityStore)); +var Stump = (function (_super) { + tslib.__extends(Stump, _super); + function Stump(root) { + return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; + } + Stump.prototype.removeLayer = function () { + return this; + }; + Stump.prototype.merge = function () { + return this.parent.merge.apply(this.parent, arguments); + }; + return Stump; +}(Layer)); +function storeObjectReconciler(existingObject, incomingObject, property) { + var existingValue = existingObject[property]; + var incomingValue = incomingObject[property]; + return equality.equal(existingValue, incomingValue) ? existingValue : incomingValue; +} +function supportsResultCaching(store) { + return !!(store instanceof exports.EntityStore && store.group.caching); +} + +function shallowCopy(value) { + if (utilities.isNonNullObject(value)) { + return Array.isArray(value) + ? value.slice(0) + : tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + return value; +} +var ObjectCanon = (function () { + function ObjectCanon() { + this.known = new (utilities.canUseWeakSet ? WeakSet : Set)(); + this.pool = new trie.Trie(utilities.canUseWeakMap); + this.passes = new WeakMap(); + this.keysByJSON = new Map(); + this.empty = this.admit({}); + } + ObjectCanon.prototype.isKnown = function (value) { + return utilities.isNonNullObject(value) && this.known.has(value); + }; + ObjectCanon.prototype.pass = function (value) { + if (utilities.isNonNullObject(value)) { + var copy = shallowCopy(value); + this.passes.set(copy, value); + return copy; + } + return value; + }; + ObjectCanon.prototype.admit = function (value) { + var _this = this; + if (utilities.isNonNullObject(value)) { + var original = this.passes.get(value); + if (original) + return original; + var proto = Object.getPrototypeOf(value); + switch (proto) { + case Array.prototype: { + if (this.known.has(value)) + return value; + var array = value.map(this.admit, this); + var node = this.pool.lookupArray(array); + if (!node.array) { + this.known.add(node.array = array); + if (__DEV__) { + Object.freeze(array); + } + } + return node.array; + } + case null: + case Object.prototype: { + if (this.known.has(value)) + return value; + var proto_1 = Object.getPrototypeOf(value); + var array_1 = [proto_1]; + var keys = this.sortedKeys(value); + array_1.push(keys.json); + var firstValueIndex_1 = array_1.length; + keys.sorted.forEach(function (key) { + array_1.push(_this.admit(value[key])); + }); + var node = this.pool.lookupArray(array_1); + if (!node.object) { + var obj_1 = node.object = Object.create(proto_1); + this.known.add(obj_1); + keys.sorted.forEach(function (key, i) { + obj_1[key] = array_1[firstValueIndex_1 + i]; + }); + if (__DEV__) { + Object.freeze(obj_1); + } + } + return node.object; + } + } + } + return value; + }; + ObjectCanon.prototype.sortedKeys = function (obj) { + var keys = Object.keys(obj); + var node = this.pool.lookupArray(keys); + if (!node.keys) { + keys.sort(); + var json = JSON.stringify(keys); + if (!(node.keys = this.keysByJSON.get(json))) { + this.keysByJSON.set(json, node.keys = { sorted: keys, json: json }); + } + } + return node.keys; + }; + return ObjectCanon; +}()); +var canonicalStringify = Object.assign(function (value) { + if (utilities.isNonNullObject(value)) { + if (stringifyCanon === void 0) { + resetCanonicalStringify(); + } + var canonical = stringifyCanon.admit(value); + var json = stringifyCache.get(canonical); + if (json === void 0) { + stringifyCache.set(canonical, json = JSON.stringify(canonical)); + } + return json; + } + return JSON.stringify(value); +}, { + reset: resetCanonicalStringify, +}); +var stringifyCanon; +var stringifyCache; +function resetCanonicalStringify() { + stringifyCanon = new ObjectCanon; + stringifyCache = new (utilities.canUseWeakMap ? WeakMap : Map)(); +} + +function missingFromInvariant(err, context) { + return new MissingFieldError(err.message, context.path.slice(), context.query, context.variables); +} +function execSelectionSetKeyArgs(options) { + return [ + options.selectionSet, + options.objectOrReference, + options.context, + options.context.canonizeResults, + ]; +} +var StoreReader = (function () { + function StoreReader(config) { + var _this = this; + this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)(); + this.config = tslib.__assign(tslib.__assign({}, config), { addTypename: config.addTypename !== false }); + this.canon = config.canon || new ObjectCanon; + this.executeSelectionSet = optimism.wrap(function (options) { + var _a; + var canonizeResults = options.context.canonizeResults; + var peekArgs = execSelectionSetKeyArgs(options); + peekArgs[3] = !canonizeResults; + var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); + if (other) { + if (canonizeResults) { + return tslib.__assign(tslib.__assign({}, other), { result: _this.canon.admit(other.result) }); + } + return other; + } + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSelectionSetImpl(options); + }, { + max: this.config.resultCacheMaxSize, + keyArgs: execSelectionSetKeyArgs, + makeCacheKey: function (selectionSet, parent, context, canonizeResults) { + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(selectionSet, utilities.isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults); + } + } + }); + this.executeSubSelectedArray = optimism.wrap(function (options) { + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSubSelectedArrayImpl(options); + }, { + max: this.config.resultCacheMaxSize, + makeCacheKey: function (_a) { + var field = _a.field, array = _a.array, context = _a.context; + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(field, array, context.varString); + } + } + }); + } + StoreReader.prototype.resetCanon = function () { + this.canon = new ObjectCanon; + }; + StoreReader.prototype.diffQueryAgainstStore = function (_a) { + var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? 'ROOT_QUERY' : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? true : _d; + var policies = this.config.cache.policies; + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(utilities.getQueryDefinition(query))), variables); + var rootRef = utilities.makeReference(rootId); + var execResult = this.executeSelectionSet({ + selectionSet: utilities.getMainDefinition(query).selectionSet, + objectOrReference: rootRef, + enclosingRef: rootRef, + context: { + store: store, + query: query, + policies: policies, + variables: variables, + varString: canonicalStringify(variables), + canonizeResults: canonizeResults, + fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(query)), + path: [], + }, + }); + var hasMissingFields = execResult.missing && execResult.missing.length > 0; + if (hasMissingFields && !returnPartialData) { + throw execResult.missing[0]; + } + return { + result: execResult.result, + missing: execResult.missing, + complete: !hasMissingFields, + }; + }; + StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { + if (supportsResultCaching(context.store) && + this.knownResults.get(result) === selectionSet) { + var latest = this.executeSelectionSet.peek(selectionSet, parent, context, this.canon.isKnown(result)); + if (latest && result === latest.result) { + return true; + } + } + return false; + }; + StoreReader.prototype.execSelectionSetImpl = function (_a) { + var _this = this; + var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; + if (utilities.isReference(objectOrReference) && + !context.policies.rootTypenamesById[objectOrReference.__ref] && + !context.store.has(objectOrReference.__ref)) { + return { + result: this.canon.empty, + missing: [missingFromInvariant(__DEV__ ? new globals.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new globals.InvariantError(5), context)], + }; + } + var variables = context.variables, policies = context.policies, store = context.store; + var objectsToMerge = []; + var finalResult = { result: null }; + var typename = store.getFieldValue(objectOrReference, "__typename"); + if (this.config.addTypename && + typeof typename === "string" && + !policies.rootIdsByTypename[typename]) { + objectsToMerge.push({ __typename: typename }); + } + function getMissing() { + return finalResult.missing || (finalResult.missing = []); + } + function handleMissing(result) { + var _a; + if (result.missing) + (_a = getMissing()).push.apply(_a, result.missing); + return result.result; + } + var workSet = new Set(selectionSet.selections); + workSet.forEach(function (selection) { + var _a; + if (!utilities.shouldInclude(selection, variables)) + return; + if (utilities.isField(selection)) { + var fieldValue = policies.readField({ + fieldName: selection.name.value, + field: selection, + variables: context.variables, + from: objectOrReference, + }, context); + var resultName = utilities.resultKeyNameFromField(selection); + context.path.push(resultName); + if (fieldValue === void 0) { + if (!utilities.addTypenameToDocument.added(selection)) { + getMissing().push(missingFromInvariant(__DEV__ ? new globals.InvariantError("Can't find field '" + selection.name.value + "' on " + (utilities.isReference(objectOrReference) + ? objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2))) : new globals.InvariantError(6), context)); + } + } + else if (Array.isArray(fieldValue)) { + fieldValue = handleMissing(_this.executeSubSelectedArray({ + field: selection, + array: fieldValue, + enclosingRef: enclosingRef, + context: context, + })); + } + else if (!selection.selectionSet) { + if (context.canonizeResults) { + fieldValue = _this.canon.pass(fieldValue); + } + } + else if (fieldValue != null) { + fieldValue = handleMissing(_this.executeSelectionSet({ + selectionSet: selection.selectionSet, + objectOrReference: fieldValue, + enclosingRef: utilities.isReference(fieldValue) ? fieldValue : enclosingRef, + context: context, + })); + } + if (fieldValue !== void 0) { + objectsToMerge.push((_a = {}, _a[resultName] = fieldValue, _a)); + } + globals.invariant(context.path.pop() === resultName); + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.fragmentMap); + if (fragment && policies.fragmentMatches(fragment, typename)) { + fragment.selectionSet.selections.forEach(workSet.add, workSet); + } + } + }); + var merged = utilities.mergeDeepArray(objectsToMerge); + finalResult.result = context.canonizeResults + ? this.canon.admit(merged) + : utilities.maybeDeepFreeze(merged); + this.knownResults.set(finalResult.result, selectionSet); + return finalResult; + }; + StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { + var _this = this; + var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; + var missing; + function handleMissing(childResult, i) { + if (childResult.missing) { + missing = missing || []; + missing.push.apply(missing, childResult.missing); + } + globals.invariant(context.path.pop() === i); + return childResult.result; + } + if (field.selectionSet) { + array = array.filter(context.store.canRead); + } + array = array.map(function (item, i) { + if (item === null) { + return null; + } + context.path.push(i); + if (Array.isArray(item)) { + return handleMissing(_this.executeSubSelectedArray({ + field: field, + array: item, + enclosingRef: enclosingRef, + context: context, + }), i); + } + if (field.selectionSet) { + return handleMissing(_this.executeSelectionSet({ + selectionSet: field.selectionSet, + objectOrReference: item, + enclosingRef: utilities.isReference(item) ? item : enclosingRef, + context: context, + }), i); + } + if (__DEV__) { + assertSelectionSetForIdValue(context.store, field, item); + } + globals.invariant(context.path.pop() === i); + return item; + }); + return { + result: context.canonizeResults ? this.canon.admit(array) : array, + missing: missing, + }; + }; + return StoreReader; +}()); +function assertSelectionSetForIdValue(store, field, fieldValue) { + if (!field.selectionSet) { + var workSet_1 = new Set([fieldValue]); + workSet_1.forEach(function (value) { + if (utilities.isNonNullObject(value)) { + __DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : globals.invariant(!utilities.isReference(value), 7); + Object.values(value).forEach(workSet_1.add, workSet_1); + } + }); + } +} + +var StoreWriter = (function () { + function StoreWriter(cache, reader) { + this.cache = cache; + this.reader = reader; + } + StoreWriter.prototype.writeToStore = function (store, _a) { + var _this = this; + var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; + var operationDefinition = utilities.getOperationDefinition(query); + var merger = makeProcessedFieldsMerger(); + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(operationDefinition)), variables); + var context = { + store: store, + written: Object.create(null), + merge: function (existing, incoming) { + return merger.merge(existing, incoming); + }, + variables: variables, + varString: canonicalStringify(variables), + fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(query)), + overwrite: !!overwrite, + incomingById: new Map, + clientOnly: false, + }; + var ref = this.processSelectionSet({ + result: result || Object.create(null), + dataId: dataId, + selectionSet: operationDefinition.selectionSet, + mergeTree: { map: new Map }, + context: context, + }); + if (!utilities.isReference(ref)) { + throw __DEV__ ? new globals.InvariantError("Could not identify object " + JSON.stringify(result)) : new globals.InvariantError(8); + } + context.incomingById.forEach(function (_a, dataId) { + var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections; + var entityRef = utilities.makeReference(dataId); + if (mergeTree && mergeTree.map.size) { + var applied = _this.applyMerges(mergeTree, entityRef, fields, context); + if (utilities.isReference(applied)) { + return; + } + fields = applied; + } + if (__DEV__ && !context.overwrite) { + var hasSelectionSet_1 = function (storeFieldName) { + return fieldsWithSelectionSets_1.has(fieldNameFromStoreName(storeFieldName)); + }; + var fieldsWithSelectionSets_1 = new Set(); + selections.forEach(function (selection) { + if (utilities.isField(selection) && selection.selectionSet) { + fieldsWithSelectionSets_1.add(selection.name.value); + } + }); + var hasMergeFunction_1 = function (storeFieldName) { + var childTree = mergeTree && mergeTree.map.get(storeFieldName); + return Boolean(childTree && childTree.info && childTree.info.merge); + }; + Object.keys(fields).forEach(function (storeFieldName) { + if (hasSelectionSet_1(storeFieldName) && + !hasMergeFunction_1(storeFieldName)) { + warnAboutDataLoss(entityRef, fields, storeFieldName, context.store); + } + }); + } + store.merge(dataId, fields); + }); + store.retain(ref.__ref); + return ref; + }; + StoreWriter.prototype.processSelectionSet = function (_a) { + var _this = this; + var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, mergeTree = _a.mergeTree; + var policies = this.cache.policies; + var _b = policies.identify(result, selectionSet, context.fragmentMap), id = _b[0], keyObject = _b[1]; + dataId = dataId || id; + if ("string" === typeof dataId) { + var sets = context.written[dataId] || (context.written[dataId] = []); + var ref = utilities.makeReference(dataId); + if (sets.indexOf(selectionSet) >= 0) + return ref; + sets.push(selectionSet); + if (this.reader && this.reader.isFresh(result, ref, selectionSet, context)) { + return ref; + } + } + var incomingFields = Object.create(null); + if (keyObject) { + incomingFields = context.merge(incomingFields, keyObject); + } + var typename = (dataId && policies.rootTypenamesById[dataId]) || + utilities.getTypenameFromResult(result, selectionSet, context.fragmentMap) || + (dataId && context.store.get(dataId, "__typename")); + if ("string" === typeof typename) { + incomingFields.__typename = typename; + } + var selections = new Set(selectionSet.selections); + selections.forEach(function (selection) { + var _a; + if (!utilities.shouldInclude(selection, context.variables)) + return; + if (utilities.isField(selection)) { + var resultFieldKey = utilities.resultKeyNameFromField(selection); + var value = result[resultFieldKey]; + var wasClientOnly = context.clientOnly; + context.clientOnly = wasClientOnly || !!(selection.directives && + selection.directives.some(function (d) { return d.name.value === "client"; })); + if (value !== void 0) { + var storeFieldName = policies.getStoreFieldName({ + typename: typename, + fieldName: selection.name.value, + field: selection, + variables: context.variables, + }); + var childTree = getChildMergeTree(mergeTree, storeFieldName); + var incomingValue = _this.processFieldValue(value, selection, context, childTree); + var childTypename = void 0; + if (selection.selectionSet) { + childTypename = context.store.getFieldValue(incomingValue, "__typename"); + if (!childTypename && utilities.isReference(incomingValue)) { + var info = context.incomingById.get(incomingValue.__ref); + childTypename = info && info.fields.__typename; + } + } + var merge = policies.getMergeFunction(typename, selection.name.value, childTypename); + if (merge) { + childTree.info = { + field: selection, + typename: typename, + merge: merge, + }; + } + else { + maybeRecycleChildMergeTree(mergeTree, storeFieldName); + } + incomingFields = context.merge(incomingFields, (_a = {}, + _a[storeFieldName] = incomingValue, + _a)); + } + else if (!context.clientOnly && + !utilities.addTypenameToDocument.added(selection)) { + __DEV__ && globals.invariant.error(("Missing field '" + utilities.resultKeyNameFromField(selection) + "' while writing result " + JSON.stringify(result, null, 2)).substring(0, 1000)); + } + context.clientOnly = wasClientOnly; + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.fragmentMap); + if (fragment && + policies.fragmentMatches(fragment, typename, result, context.variables)) { + fragment.selectionSet.selections.forEach(selections.add, selections); + } + } + }); + if ("string" === typeof dataId) { + var previous = context.incomingById.get(dataId); + if (previous) { + previous.fields = context.merge(previous.fields, incomingFields); + previous.mergeTree = mergeMergeTrees(previous.mergeTree, mergeTree); + previous.selections.forEach(selections.add, selections); + previous.selections = selections; + } + else { + context.incomingById.set(dataId, { + fields: incomingFields, + mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, + selections: selections, + }); + } + return utilities.makeReference(dataId); + } + return incomingFields; + }; + StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { + var _this = this; + if (!field.selectionSet || value === null) { + return __DEV__ ? utilities.cloneDeep(value) : value; + } + if (Array.isArray(value)) { + return value.map(function (item, i) { + var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); + maybeRecycleChildMergeTree(mergeTree, i); + return value; + }); + } + return this.processSelectionSet({ + result: value, + selectionSet: field.selectionSet, + context: context, + mergeTree: mergeTree, + }); + }; + StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { + var _a; + var _this = this; + if (mergeTree.map.size && !utilities.isReference(incoming)) { + var e_1 = (!Array.isArray(incoming) && + (utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0; + var i_1 = incoming; + if (e_1 && !getStorageArgs) { + getStorageArgs = [utilities.isReference(e_1) ? e_1.__ref : e_1]; + } + var changedFields_1; + var getValue_1 = function (from, name) { + return Array.isArray(from) + ? (typeof name === "number" ? from[name] : void 0) + : context.store.getFieldValue(from, String(name)); + }; + mergeTree.map.forEach(function (childTree, storeFieldName) { + var eVal = getValue_1(e_1, storeFieldName); + var iVal = getValue_1(i_1, storeFieldName); + if (void 0 === iVal) + return; + if (getStorageArgs) { + getStorageArgs.push(storeFieldName); + } + var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); + if (aVal !== iVal) { + changedFields_1 = changedFields_1 || new Map; + changedFields_1.set(storeFieldName, aVal); + } + if (getStorageArgs) { + globals.invariant(getStorageArgs.pop() === storeFieldName); + } + }); + if (changedFields_1) { + incoming = (Array.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1)); + changedFields_1.forEach(function (value, name) { + incoming[name] = value; + }); + } + } + if (mergeTree.info) { + return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); + } + return incoming; + }; + return StoreWriter; +}()); +var emptyMergeTreePool = []; +function getChildMergeTree(_a, name) { + var map = _a.map; + if (!map.has(name)) { + map.set(name, emptyMergeTreePool.pop() || { map: new Map }); + } + return map.get(name); +} +function mergeMergeTrees(left, right) { + if (left === right || !right || mergeTreeIsEmpty(right)) + return left; + if (!left || mergeTreeIsEmpty(left)) + return right; + var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info; + var needToMergeMaps = left.map.size && right.map.size; + var map = needToMergeMaps ? new Map : + left.map.size ? left.map : right.map; + var merged = { info: info, map: map }; + if (needToMergeMaps) { + var remainingRightKeys_1 = new Set(right.map.keys()); + left.map.forEach(function (leftTree, key) { + merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); + remainingRightKeys_1.delete(key); + }); + remainingRightKeys_1.forEach(function (key) { + merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); + }); + } + return merged; +} +function mergeTreeIsEmpty(tree) { + return !tree || !(tree.info || tree.map.size); +} +function maybeRecycleChildMergeTree(_a, name) { + var map = _a.map; + var childTree = map.get(name); + if (childTree && mergeTreeIsEmpty(childTree)) { + emptyMergeTreePool.push(childTree); + map.delete(name); + } +} +var warnings = new Set(); +function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { + var getChild = function (objOrRef) { + var child = store.getFieldValue(objOrRef, storeFieldName); + return typeof child === "object" && child; + }; + var existing = getChild(existingRef); + if (!existing) + return; + var incoming = getChild(incomingObj); + if (!incoming) + return; + if (utilities.isReference(existing)) + return; + if (equality.equal(existing, incoming)) + return; + if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { + return; + } + var parentType = store.getFieldValue(existingRef, "__typename") || + store.getFieldValue(incomingObj, "__typename"); + var fieldName = fieldNameFromStoreName(storeFieldName); + var typeDotName = parentType + "." + fieldName; + if (warnings.has(typeDotName)) + return; + warnings.add(typeDotName); + var childTypenames = []; + if (!Array.isArray(existing) && + !Array.isArray(incoming)) { + [existing, incoming].forEach(function (child) { + var typename = store.getFieldValue(child, "__typename"); + if (typeof typename === "string" && + !childTypenames.includes(typename)) { + childTypenames.push(typename); + } + }); + } + __DEV__ && globals.invariant.warn("Cache data may be lost when replacing the " + fieldName + " field of a " + parentType + " object.\n\nTo address this problem (which is not a bug in Apollo Client), " + (childTypenames.length + ? "either ensure all objects of type " + + childTypenames.join(" and ") + " have an ID or a custom merge function, or " + : "") + "define a custom merge function for the " + typeDotName + " field, so InMemoryCache can safely merge these objects:\n\n existing: " + JSON.stringify(existing).slice(0, 1000) + "\n incoming: " + JSON.stringify(incoming).slice(0, 1000) + "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"); +} + +var cacheSlot = new context.Slot(); +var cacheInfoMap = new WeakMap(); +function getCacheInfo(cache) { + var info = cacheInfoMap.get(cache); + if (!info) { + cacheInfoMap.set(cache, info = { + vars: new Set, + dep: optimism.dep(), + }); + } + return info; +} +function forgetCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); +} +function recallCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); +} +function makeVar(value) { + var caches = new Set(); + var listeners = new Set(); + var rv = function (newValue) { + if (arguments.length > 0) { + if (value !== newValue) { + value = newValue; + caches.forEach(function (cache) { + getCacheInfo(cache).dep.dirty(rv); + broadcast(cache); + }); + var oldListeners = Array.from(listeners); + listeners.clear(); + oldListeners.forEach(function (listener) { return listener(value); }); + } + } + else { + var cache = cacheSlot.getValue(); + if (cache) { + attach(cache); + getCacheInfo(cache).dep(rv); + } + } + return value; + }; + rv.onNextChange = function (listener) { + listeners.add(listener); + return function () { + listeners.delete(listener); + }; + }; + var attach = rv.attachCache = function (cache) { + caches.add(cache); + getCacheInfo(cache).vars.add(rv); + return rv; + }; + rv.forgetCache = function (cache) { return caches.delete(cache); }; + return rv; +} +function broadcast(cache) { + if (cache.broadcastWatches) { + cache.broadcastWatches(); + } +} + +utilities.getStoreKeyName.setStringify(canonicalStringify); +function argsFromFieldSpecifier(spec) { + return spec.args !== void 0 ? spec.args : + spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables) : null; +} +var defaultDataIdFromObject = function (_a, context) { + var __typename = _a.__typename, id = _a.id, _id = _a._id; + if (typeof __typename === "string") { + if (context) { + context.keyObject = + id !== void 0 ? { id: id } : + _id !== void 0 ? { _id: _id } : + void 0; + } + if (id === void 0) + id = _id; + if (id !== void 0) { + return __typename + ":" + ((typeof id === "number" || + typeof id === "string") ? id : JSON.stringify(id)); + } + } +}; +var nullKeyFieldsFn = function () { return void 0; }; +var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; +var mergeTrueFn = function (existing, incoming, _a) { + var mergeObjects = _a.mergeObjects; + return mergeObjects(existing, incoming); +}; +var mergeFalseFn = function (_, incoming) { return incoming; }; +var Policies = (function () { + function Policies(config) { + this.config = config; + this.typePolicies = Object.create(null); + this.toBeAdded = Object.create(null); + this.supertypeMap = new Map(); + this.fuzzySubtypes = new Map(); + this.rootIdsByTypename = Object.create(null); + this.rootTypenamesById = Object.create(null); + this.usingPossibleTypes = false; + this.config = tslib.__assign({ dataIdFromObject: defaultDataIdFromObject }, config); + this.cache = this.config.cache; + this.setRootTypename("Query"); + this.setRootTypename("Mutation"); + this.setRootTypename("Subscription"); + if (config.possibleTypes) { + this.addPossibleTypes(config.possibleTypes); + } + if (config.typePolicies) { + this.addTypePolicies(config.typePolicies); + } + } + Policies.prototype.identify = function (object, selectionSet, fragmentMap) { + var typename = selectionSet && fragmentMap + ? utilities.getTypenameFromResult(object, selectionSet, fragmentMap) + : object.__typename; + if (typename === this.rootTypenamesById.ROOT_QUERY) { + return ["ROOT_QUERY"]; + } + var context = { + typename: typename, + selectionSet: selectionSet, + fragmentMap: fragmentMap, + }; + var id; + var policy = typename && this.getTypePolicy(typename); + var keyFn = policy && policy.keyFn || this.config.dataIdFromObject; + while (keyFn) { + var specifierOrId = keyFn(object, context); + if (Array.isArray(specifierOrId)) { + keyFn = keyFieldsFnFromSpecifier(specifierOrId); + } + else { + id = specifierOrId; + break; + } + } + id = id ? String(id) : void 0; + return context.keyObject ? [id, context.keyObject] : [id]; + }; + Policies.prototype.addTypePolicies = function (typePolicies) { + var _this = this; + Object.keys(typePolicies).forEach(function (typename) { + var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = tslib.__rest(_a, ["queryType", "mutationType", "subscriptionType"]); + if (queryType) + _this.setRootTypename("Query", typename); + if (mutationType) + _this.setRootTypename("Mutation", typename); + if (subscriptionType) + _this.setRootTypename("Subscription", typename); + if (hasOwn.call(_this.toBeAdded, typename)) { + _this.toBeAdded[typename].push(incoming); + } + else { + _this.toBeAdded[typename] = [incoming]; + } + }); + }; + Policies.prototype.updateTypePolicy = function (typename, incoming) { + var _this = this; + var existing = this.getTypePolicy(typename); + var keyFields = incoming.keyFields, fields = incoming.fields; + function setMerge(existing, merge) { + existing.merge = + typeof merge === "function" ? merge : + merge === true ? mergeTrueFn : + merge === false ? mergeFalseFn : + existing.merge; + } + setMerge(existing, incoming.merge); + existing.keyFn = + keyFields === false ? nullKeyFieldsFn : + Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) : + typeof keyFields === "function" ? keyFields : + existing.keyFn; + if (fields) { + Object.keys(fields).forEach(function (fieldName) { + var existing = _this.getFieldPolicy(typename, fieldName, true); + var incoming = fields[fieldName]; + if (typeof incoming === "function") { + existing.read = incoming; + } + else { + var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; + existing.keyFn = + keyArgs === false ? simpleKeyArgsFn : + Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) : + typeof keyArgs === "function" ? keyArgs : + existing.keyFn; + if (typeof read === "function") { + existing.read = read; + } + setMerge(existing, merge); + } + if (existing.read && existing.merge) { + existing.keyFn = existing.keyFn || simpleKeyArgsFn; + } + }); + } + }; + Policies.prototype.setRootTypename = function (which, typename) { + if (typename === void 0) { typename = which; } + var rootId = "ROOT_" + which.toUpperCase(); + var old = this.rootTypenamesById[rootId]; + if (typename !== old) { + __DEV__ ? globals.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : globals.invariant(!old || old === which, 2); + if (old) + delete this.rootIdsByTypename[old]; + this.rootIdsByTypename[typename] = rootId; + this.rootTypenamesById[rootId] = typename; + } + }; + Policies.prototype.addPossibleTypes = function (possibleTypes) { + var _this = this; + this.usingPossibleTypes = true; + Object.keys(possibleTypes).forEach(function (supertype) { + _this.getSupertypeSet(supertype, true); + possibleTypes[supertype].forEach(function (subtype) { + _this.getSupertypeSet(subtype, true).add(supertype); + var match = subtype.match(TypeOrFieldNameRegExp); + if (!match || match[0] !== subtype) { + _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); + } + }); + }); + }; + Policies.prototype.getTypePolicy = function (typename) { + var _this = this; + if (!hasOwn.call(this.typePolicies, typename)) { + var policy_1 = this.typePolicies[typename] = Object.create(null); + policy_1.fields = Object.create(null); + var supertypes = this.supertypeMap.get(typename); + if (supertypes && supertypes.size) { + supertypes.forEach(function (supertype) { + var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]); + Object.assign(policy_1, rest); + Object.assign(policy_1.fields, fields); + }); + } + } + var inbox = this.toBeAdded[typename]; + if (inbox && inbox.length) { + inbox.splice(0).forEach(function (policy) { + _this.updateTypePolicy(typename, policy); + }); + } + return this.typePolicies[typename]; + }; + Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { + if (typename) { + var fieldPolicies = this.getTypePolicy(typename).fields; + return fieldPolicies[fieldName] || (createIfMissing && (fieldPolicies[fieldName] = Object.create(null))); + } + }; + Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { + var supertypeSet = this.supertypeMap.get(subtype); + if (!supertypeSet && createIfMissing) { + this.supertypeMap.set(subtype, supertypeSet = new Set()); + } + return supertypeSet; + }; + Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { + var _this = this; + if (!fragment.typeCondition) + return true; + if (!typename) + return false; + var supertype = fragment.typeCondition.name.value; + if (typename === supertype) + return true; + if (this.usingPossibleTypes && + this.supertypeMap.has(supertype)) { + var typenameSupertypeSet = this.getSupertypeSet(typename, true); + var workQueue_1 = [typenameSupertypeSet]; + var maybeEnqueue_1 = function (subtype) { + var supertypeSet = _this.getSupertypeSet(subtype, false); + if (supertypeSet && + supertypeSet.size && + workQueue_1.indexOf(supertypeSet) < 0) { + workQueue_1.push(supertypeSet); + } + }; + var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); + var checkingFuzzySubtypes = false; + for (var i = 0; i < workQueue_1.length; ++i) { + var supertypeSet = workQueue_1[i]; + if (supertypeSet.has(supertype)) { + if (!typenameSupertypeSet.has(supertype)) { + if (checkingFuzzySubtypes) { + __DEV__ && globals.invariant.warn("Inferring subtype " + typename + " of supertype " + supertype); + } + typenameSupertypeSet.add(supertype); + } + return true; + } + supertypeSet.forEach(maybeEnqueue_1); + if (needToCheckFuzzySubtypes && + i === workQueue_1.length - 1 && + selectionSetMatchesResult(fragment.selectionSet, result, variables)) { + needToCheckFuzzySubtypes = false; + checkingFuzzySubtypes = true; + this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { + var match = typename.match(regExp); + if (match && match[0] === typename) { + maybeEnqueue_1(fuzzyString); + } + }); + } + } + } + return false; + }; + Policies.prototype.hasKeyArgs = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return !!(policy && policy.keyFn); + }; + Policies.prototype.getStoreFieldName = function (fieldSpec) { + var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; + var policy = this.getFieldPolicy(typename, fieldName, false); + var storeFieldName; + var keyFn = policy && policy.keyFn; + if (keyFn && typename) { + var context = { + typename: typename, + fieldName: fieldName, + field: fieldSpec.field || null, + variables: fieldSpec.variables, + }; + var args = argsFromFieldSpecifier(fieldSpec); + while (keyFn) { + var specifierOrString = keyFn(args, context); + if (Array.isArray(specifierOrString)) { + keyFn = keyArgsFnFromSpecifier(specifierOrString); + } + else { + storeFieldName = specifierOrString || fieldName; + break; + } + } + } + if (storeFieldName === void 0) { + storeFieldName = fieldSpec.field + ? utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + : utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); + } + if (storeFieldName === false) { + return fieldName; + } + return fieldName === fieldNameFromStoreName(storeFieldName) + ? storeFieldName + : fieldName + ":" + storeFieldName; + }; + Policies.prototype.readField = function (options, context) { + var objectOrReference = options.from; + if (!objectOrReference) + return; + var nameOrField = options.field || options.fieldName; + if (!nameOrField) + return; + if (options.typename === void 0) { + var typename = context.store.getFieldValue(objectOrReference, "__typename"); + if (typename) + options.typename = typename; + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); + var existing = context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { + var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) + ? objectOrReference.__ref + : objectOrReference, storeFieldName)); + return cacheSlot.withValue(this.cache, read, [existing, readOptions]); + } + return existing; + }; + Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { + var policy = this.getFieldPolicy(parentTypename, fieldName, false); + var merge = policy && policy.merge; + if (!merge && childTypename) { + policy = this.getTypePolicy(childTypename); + merge = policy && policy.merge; + } + return merge; + }; + Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { + var field = _a.field, typename = _a.typename, merge = _a.merge; + if (merge === mergeTrueFn) { + return makeMergeObjectsFunction(context.store)(existing, incoming); + } + if (merge === mergeFalseFn) { + return incoming; + } + if (context.overwrite) { + existing = void 0; + } + return merge(existing, incoming, makeFieldFunctionOptions(this, void 0, { typename: typename, fieldName: field.name.value, field: field, variables: context.variables }, context, storage || Object.create(null))); + }; + return Policies; +}()); +function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { + var storeFieldName = policies.getStoreFieldName(fieldSpec); + var fieldName = fieldNameFromStoreName(storeFieldName); + var variables = fieldSpec.variables || context.variables; + var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; + return { + args: argsFromFieldSpecifier(fieldSpec), + field: fieldSpec.field || null, + fieldName: fieldName, + storeFieldName: storeFieldName, + variables: variables, + isReference: utilities.isReference, + toReference: toReference, + storage: storage, + cache: policies.cache, + canRead: canRead, + readField: function (fieldNameOrOptions, from) { + var options; + if (typeof fieldNameOrOptions === "string") { + options = { + fieldName: fieldNameOrOptions, + from: arguments.length > 1 ? from : objectOrReference, + }; + } + else if (utilities.isNonNullObject(fieldNameOrOptions)) { + options = tslib.__assign({}, fieldNameOrOptions); + if (!hasOwn.call(fieldNameOrOptions, "from")) { + options.from = objectOrReference; + } + } + else { + __DEV__ && globals.invariant.warn("Unexpected readField arguments: " + utilities.stringifyForDisplay(Array.from(arguments))); + return; + } + if (__DEV__ && options.from === void 0) { + __DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments " + utilities.stringifyForDisplay(Array.from(arguments))); + } + if (void 0 === options.variables) { + options.variables = variables; + } + return policies.readField(options, context); + }, + mergeObjects: makeMergeObjectsFunction(context.store), + }; +} +function makeMergeObjectsFunction(store) { + return function mergeObjects(existing, incoming) { + if (Array.isArray(existing) || Array.isArray(incoming)) { + throw __DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(3); + } + if (utilities.isNonNullObject(existing) && + utilities.isNonNullObject(incoming)) { + var eType = store.getFieldValue(existing, "__typename"); + var iType = store.getFieldValue(incoming, "__typename"); + var typesDiffer = eType && iType && eType !== iType; + if (typesDiffer) { + return incoming; + } + if (utilities.isReference(existing) && + storeValueIsStoreObject(incoming)) { + store.merge(existing.__ref, incoming); + return existing; + } + if (storeValueIsStoreObject(existing) && + utilities.isReference(incoming)) { + store.merge(existing, incoming.__ref); + return incoming; + } + if (storeValueIsStoreObject(existing) && + storeValueIsStoreObject(incoming)) { + return tslib.__assign(tslib.__assign({}, existing), incoming); + } + } + return incoming; + }; +} +function keyArgsFnFromSpecifier(specifier) { + return function (args, context) { + return args ? context.fieldName + ":" + JSON.stringify(computeKeyObject(args, specifier, false)) : context.fieldName; + }; +} +function keyFieldsFnFromSpecifier(specifier) { + var trie$1 = new trie.Trie(utilities.canUseWeakMap); + return function (object, context) { + var aliasMap; + if (context.selectionSet && context.fragmentMap) { + var info = trie$1.lookupArray([ + context.selectionSet, + context.fragmentMap, + ]); + aliasMap = info.aliasMap || (info.aliasMap = makeAliasMap(context.selectionSet, context.fragmentMap)); + } + var keyObject = context.keyObject = + computeKeyObject(object, specifier, true, aliasMap); + return context.typename + ":" + JSON.stringify(keyObject); + }; +} +function makeAliasMap(selectionSet, fragmentMap) { + var map = Object.create(null); + var workQueue = new Set([selectionSet]); + workQueue.forEach(function (selectionSet) { + selectionSet.selections.forEach(function (selection) { + if (utilities.isField(selection)) { + if (selection.alias) { + var responseKey = selection.alias.value; + var storeKey = selection.name.value; + if (storeKey !== responseKey) { + var aliases = map.aliases || (map.aliases = Object.create(null)); + aliases[storeKey] = responseKey; + } + } + if (selection.selectionSet) { + var subsets = map.subsets || (map.subsets = Object.create(null)); + subsets[selection.name.value] = + makeAliasMap(selection.selectionSet, fragmentMap); + } + } + else { + var fragment = utilities.getFragmentFromSelection(selection, fragmentMap); + if (fragment) { + workQueue.add(fragment.selectionSet); + } + } + }); + }); + return map; +} +function computeKeyObject(response, specifier, strict, aliasMap) { + var keyObj = Object.create(null); + var lastResponseKey; + var lastActualKey; + specifier.forEach(function (s) { + if (Array.isArray(s)) { + if (typeof lastActualKey === "string" && + typeof lastResponseKey === "string") { + var subsets = aliasMap && aliasMap.subsets; + var subset = subsets && subsets[lastActualKey]; + keyObj[lastActualKey] = + computeKeyObject(response[lastResponseKey], s, strict, subset); + } + } + else { + var aliases = aliasMap && aliasMap.aliases; + var responseName = aliases && aliases[s] || s; + if (hasOwn.call(response, responseName)) { + keyObj[lastActualKey = s] = response[lastResponseKey = responseName]; + } + else { + __DEV__ ? globals.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : globals.invariant(!strict, 4); + lastResponseKey = lastActualKey = void 0; + } + } + }); + return keyObj; +} + +var defaultConfig = { + dataIdFromObject: defaultDataIdFromObject, + addTypename: true, + resultCaching: true, + typePolicies: {}, +}; +var InMemoryCache = (function (_super) { + tslib.__extends(InMemoryCache, _super); + function InMemoryCache(config) { + if (config === void 0) { config = {}; } + var _this = _super.call(this) || this; + _this.watches = new Set(); + _this.typenameDocumentCache = new Map(); + _this.makeVar = makeVar; + _this.txCount = 0; + _this.config = tslib.__assign(tslib.__assign({}, defaultConfig), config); + _this.addTypename = !!_this.config.addTypename; + _this.policies = new Policies({ + cache: _this, + dataIdFromObject: _this.config.dataIdFromObject, + possibleTypes: _this.config.possibleTypes, + typePolicies: _this.config.typePolicies, + }); + _this.init(); + return _this; + } + InMemoryCache.prototype.init = function () { + var rootStore = this.data = new exports.EntityStore.Root({ + policies: this.policies, + resultCaching: this.config.resultCaching, + }); + this.optimisticData = rootStore.stump; + this.resetResultCache(); + }; + InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { + var _this = this; + var previousReader = this.storeReader; + this.storeWriter = new StoreWriter(this, this.storeReader = new StoreReader({ + cache: this, + addTypename: this.addTypename, + resultCacheMaxSize: this.config.resultCacheMaxSize, + canon: resetResultIdentities + ? void 0 + : previousReader && previousReader.canon, + })); + this.maybeBroadcastWatch = optimism.wrap(function (c, options) { + return _this.broadcastWatch(c, options); + }, { + max: this.config.resultCacheMaxSize, + makeCacheKey: function (c) { + var store = c.optimistic ? _this.optimisticData : _this.data; + if (supportsResultCaching(store)) { + var optimistic = c.optimistic, rootId = c.rootId, variables = c.variables; + return store.makeCacheKey(c.query, c.callback, canonicalStringify({ optimistic: optimistic, rootId: rootId, variables: variables })); + } + } + }); + new Set([ + this.data.group, + this.optimisticData.group, + ]).forEach(function (group) { return group.resetCaching(); }); + }; + InMemoryCache.prototype.restore = function (data) { + this.init(); + if (data) + this.data.replace(data); + return this; + }; + InMemoryCache.prototype.extract = function (optimistic) { + if (optimistic === void 0) { optimistic = false; } + return (optimistic ? this.optimisticData : this.data).extract(); + }; + InMemoryCache.prototype.read = function (options) { + var _a = options.returnPartialData, returnPartialData = _a === void 0 ? false : _a; + try { + return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null; + } + catch (e) { + if (e instanceof MissingFieldError) { + return null; + } + throw e; + } + }; + InMemoryCache.prototype.write = function (options) { + try { + ++this.txCount; + return this.storeWriter.writeToStore(this.data, options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.modify = function (options) { + if (hasOwn.call(options, "id") && !options.id) { + return false; + } + var store = options.optimistic + ? this.optimisticData + : this.data; + try { + ++this.txCount; + return store.modify(options.id || "ROOT_QUERY", options.fields); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.diff = function (options) { + return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); + }; + InMemoryCache.prototype.watch = function (watch) { + var _this = this; + if (!this.watches.size) { + recallCache(this); + } + this.watches.add(watch); + if (watch.immediate) { + this.maybeBroadcastWatch(watch); + } + return function () { + if (_this.watches.delete(watch) && !_this.watches.size) { + forgetCache(_this); + } + _this.maybeBroadcastWatch.forget(watch); + }; + }; + InMemoryCache.prototype.gc = function (options) { + canonicalStringify.reset(); + var ids = this.optimisticData.gc(); + if (options && !this.txCount) { + if (options.resetResultCache) { + this.resetResultCache(options.resetResultIdentities); + } + else if (options.resetResultIdentities) { + this.storeReader.resetCanon(); + } + } + return ids; + }; + InMemoryCache.prototype.retain = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).retain(rootId); + }; + InMemoryCache.prototype.release = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).release(rootId); + }; + InMemoryCache.prototype.identify = function (object) { + return utilities.isReference(object) ? object.__ref : + this.policies.identify(object)[0]; + }; + InMemoryCache.prototype.evict = function (options) { + if (!options.id) { + if (hasOwn.call(options, "id")) { + return false; + } + options = tslib.__assign(tslib.__assign({}, options), { id: "ROOT_QUERY" }); + } + try { + ++this.txCount; + return this.optimisticData.evict(options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.reset = function () { + this.init(); + this.broadcastWatches(); + canonicalStringify.reset(); + return Promise.resolve(); + }; + InMemoryCache.prototype.removeOptimistic = function (idToRemove) { + var newOptimisticData = this.optimisticData.removeLayer(idToRemove); + if (newOptimisticData !== this.optimisticData) { + this.optimisticData = newOptimisticData; + this.broadcastWatches(); + } + }; + InMemoryCache.prototype.batch = function (options) { + var _this = this; + var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; + var perform = function (layer) { + var _a = _this, data = _a.data, optimisticData = _a.optimisticData; + ++_this.txCount; + if (layer) { + _this.data = _this.optimisticData = layer; + } + try { + update(_this); + } + finally { + --_this.txCount; + _this.data = data; + _this.optimisticData = optimisticData; + } + }; + var alreadyDirty = new Set(); + if (onWatchUpdated && !this.txCount) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch) { + alreadyDirty.add(watch); + return false; + } })); + } + if (typeof optimistic === 'string') { + this.optimisticData = this.optimisticData.addLayer(optimistic, perform); + } + else if (optimistic === false) { + perform(this.data); + } + else { + perform(); + } + if (typeof removeOptimistic === "string") { + this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); + } + if (onWatchUpdated && alreadyDirty.size) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch, diff) { + var result = onWatchUpdated.call(this, watch, diff); + if (result !== false) { + alreadyDirty.delete(watch); + } + return result; + } })); + if (alreadyDirty.size) { + alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); + } + } + else { + this.broadcastWatches(options); + } + }; + InMemoryCache.prototype.performTransaction = function (update, optimisticId) { + return this.batch({ + update: update, + optimistic: optimisticId || (optimisticId !== null), + }); + }; + InMemoryCache.prototype.transformDocument = function (document) { + if (this.addTypename) { + var result = this.typenameDocumentCache.get(document); + if (!result) { + result = utilities.addTypenameToDocument(document); + this.typenameDocumentCache.set(document, result); + this.typenameDocumentCache.set(result, result); + } + return result; + } + return document; + }; + InMemoryCache.prototype.broadcastWatches = function (options) { + var _this = this; + if (!this.txCount) { + this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); + } + }; + InMemoryCache.prototype.broadcastWatch = function (c, options) { + var lastDiff = c.lastDiff; + var diff = this.diff({ + query: c.query, + variables: c.variables, + optimistic: c.optimistic, + }); + if (options) { + if (c.optimistic && + typeof options.optimistic === "string") { + diff.fromOptimisticTransaction = true; + } + if (options.onWatchUpdated && + options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { + return; + } + } + if (!lastDiff || !equality.equal(lastDiff.result, diff.result)) { + c.callback(c.lastDiff = diff, lastDiff); + } + }; + return InMemoryCache; +}(ApolloCache)); + +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.ApolloCache = ApolloCache; +exports.InMemoryCache = InMemoryCache; +exports.MissingFieldError = MissingFieldError; +exports.Policies = Policies; +exports.cacheSlot = cacheSlot; +exports.canonicalStringify = canonicalStringify; +exports.defaultDataIdFromObject = defaultDataIdFromObject; +exports.fieldNameFromStoreName = fieldNameFromStoreName; +exports.makeVar = makeVar; +//# sourceMappingURL=cache.cjs.js.map + + +/***/ }), + +/***/ 19900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var tslib = __nccwpck_require__(4351); +var core = __nccwpck_require__(30090); +var utilities = __nccwpck_require__(56905); +var http = __nccwpck_require__(24894); +var equality = __nccwpck_require__(9969); +var cache = __nccwpck_require__(51529); +var errors = __nccwpck_require__(81188); +var graphql = __nccwpck_require__(16155); +var utils = __nccwpck_require__(49288); +var tsInvariant = __nccwpck_require__(15641); +var graphqlTag = __nccwpck_require__(38246); + +var version = '3.4.10'; + +exports.NetworkStatus = void 0; +(function (NetworkStatus) { + NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; + NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; + NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; + NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; + NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; + NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; + NetworkStatus[NetworkStatus["error"] = 8] = "error"; +})(exports.NetworkStatus || (exports.NetworkStatus = {})); +function isNetworkRequestInFlight(networkStatus) { + return networkStatus ? networkStatus < 7 : false; +} + +var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty; +var warnedAboutUpdateQuery = false; +var ObservableQuery = (function (_super) { + tslib.__extends(ObservableQuery, _super); + function ObservableQuery(_a) { + var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; + var _this = _super.call(this, function (observer) { + try { + var subObserver = observer._subscription._observer; + if (subObserver && !subObserver.error) { + subObserver.error = defaultSubscriptionObserverErrorCallback; + } + } + catch (_a) { } + var first = !_this.observers.size; + _this.observers.add(observer); + var last = _this.last; + if (last && last.error) { + observer.error && observer.error(last.error); + } + else if (last && last.result) { + observer.next && observer.next(last.result); + } + if (first) { + _this.reobserve().catch(function () { }); + } + return function () { + if (_this.observers.delete(observer) && !_this.observers.size) { + _this.tearDownQuery(); + } + }; + }) || this; + _this.observers = new Set(); + _this.subscriptions = new Set(); + _this.isTornDown = false; + _this.options = options; + _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); + var opDef = utilities.getOperationDefinition(options.query); + _this.queryName = opDef && opDef.name && opDef.name.value; + _this.initialFetchPolicy = options.fetchPolicy || "cache-first"; + _this.queryManager = queryManager; + _this.queryInfo = queryInfo; + return _this; + } + Object.defineProperty(ObservableQuery.prototype, "variables", { + get: function () { + return this.options.variables; + }, + enumerable: false, + configurable: true + }); + ObservableQuery.prototype.result = function () { + var _this = this; + return new Promise(function (resolve, reject) { + var observer = { + next: function (result) { + resolve(result); + _this.observers.delete(observer); + if (!_this.observers.size) { + _this.queryManager.removeQuery(_this.queryId); + } + setTimeout(function () { + subscription.unsubscribe(); + }, 0); + }, + error: reject, + }; + var subscription = _this.subscribe(observer); + }); + }; + ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { + if (saveAsLastResult === void 0) { saveAsLastResult = true; } + var lastResult = this.getLastResult(true); + var networkStatus = this.queryInfo.networkStatus || + (lastResult && lastResult.networkStatus) || + exports.NetworkStatus.ready; + var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }); + var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; + var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' && + fetchPolicy !== 'no-cache' && + fetchPolicy !== 'standby'); + if (shouldReturnCachedData && + !this.queryManager.transform(this.options.query).hasForcedResolvers) { + var diff = this.queryInfo.getDiff(); + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equality.equal(result.data, {})) { + result.data = void 0; + } + if (diff.complete) { + if (result.networkStatus === exports.NetworkStatus.loading && + (fetchPolicy === 'cache-first' || + fetchPolicy === 'cache-only')) { + result.networkStatus = exports.NetworkStatus.ready; + result.loading = false; + } + delete result.partial; + } + else if (fetchPolicy !== "no-cache") { + result.partial = true; + } + if (__DEV__ && + !diff.complete && + !this.options.partialRefetch && + !result.loading && + !result.data && + !result.error) { + logMissingFieldErrors(diff.missing); + } + } + if (saveAsLastResult) { + this.updateLastResult(result); + } + return result; + }; + ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { + return !this.last || !equality.equal(this.last.result, newResult); + }; + ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { + var last = this.last; + if (last && + last[key] && + (!variablesMustMatch || equality.equal(last.variables, this.variables))) { + return last[key]; + } + }; + ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { + return this.getLast("result", variablesMustMatch); + }; + ObservableQuery.prototype.getLastError = function (variablesMustMatch) { + return this.getLast("error", variablesMustMatch); + }; + ObservableQuery.prototype.resetLastResults = function () { + delete this.last; + this.isTornDown = false; + }; + ObservableQuery.prototype.resetQueryStoreErrors = function () { + this.queryManager.resetErrors(this.queryId); + }; + ObservableQuery.prototype.refetch = function (variables) { + var _a; + var reobserveOptions = { + pollInterval: 0, + }; + var fetchPolicy = this.options.fetchPolicy; + if (fetchPolicy === 'no-cache') { + reobserveOptions.fetchPolicy = 'no-cache'; + } + else if (fetchPolicy !== 'cache-and-network') { + reobserveOptions.fetchPolicy = 'network-only'; + } + if (__DEV__ && variables && hasOwnProperty$1.call(variables, "variables")) { + var queryDef = utilities.getQueryDefinition(this.options.query); + var vars = queryDef.variableDefinitions; + if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { + __DEV__ && globals.invariant.warn("Called refetch(" + JSON.stringify(variables) + ") for query " + (((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef)) + ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"); + } + } + if (variables && !equality.equal(this.options.variables, variables)) { + reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables); + } + this.queryInfo.resetLastWrite(); + return this.reobserve(reobserveOptions, exports.NetworkStatus.refetch); + }; + ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { + var _this = this; + var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" }); + var qid = this.queryManager.generateQueryId(); + if (combinedOptions.notifyOnNetworkStatusChange) { + this.queryInfo.networkStatus = exports.NetworkStatus.fetchMore; + this.observe(); + } + return this.queryManager.fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore).then(function (fetchMoreResult) { + var data = fetchMoreResult.data; + var updateQuery = fetchMoreOptions.updateQuery; + if (updateQuery) { + if (__DEV__ && + !warnedAboutUpdateQuery) { + __DEV__ && globals.invariant.warn("The updateQuery callback for fetchMore is deprecated, and will be removed\nin the next major version of Apollo Client.\n\nPlease convert updateQuery functions to field policies with appropriate\nread and merge functions, or use/adapt a helper function (such as\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\n@apollo/client/utilities.\n\nThe field policy system handles pagination more effectively than a\nhand-written updateQuery function, and you only need to define the policy\nonce, rather than every time you call fetchMore."); + warnedAboutUpdateQuery = true; + } + _this.updateQuery(function (previous) { return updateQuery(previous, { + fetchMoreResult: data, + variables: combinedOptions.variables, + }); }); + } + else { + _this.queryManager.cache.writeQuery({ + query: combinedOptions.query, + variables: combinedOptions.variables, + data: data, + }); + } + return fetchMoreResult; + }).finally(function () { + _this.queryManager.stopQuery(qid); + _this.reobserve(); + }); + }; + ObservableQuery.prototype.subscribeToMore = function (options) { + var _this = this; + var subscription = this.queryManager + .startGraphQLSubscription({ + query: options.document, + variables: options.variables, + context: options.context, + }) + .subscribe({ + next: function (subscriptionData) { + var updateQuery = options.updateQuery; + if (updateQuery) { + _this.updateQuery(function (previous, _a) { + var variables = _a.variables; + return updateQuery(previous, { + subscriptionData: subscriptionData, + variables: variables, + }); + }); + } + }, + error: function (err) { + if (options.onError) { + options.onError(err); + return; + } + __DEV__ && globals.invariant.error('Unhandled GraphQL subscription error', err); + }, + }); + this.subscriptions.add(subscription); + return function () { + if (_this.subscriptions.delete(subscription)) { + subscription.unsubscribe(); + } + }; + }; + ObservableQuery.prototype.setOptions = function (newOptions) { + return this.reobserve(newOptions); + }; + ObservableQuery.prototype.setVariables = function (variables) { + if (equality.equal(this.variables, variables)) { + return this.observers.size + ? this.result() + : Promise.resolve(); + } + this.options.variables = variables; + if (!this.observers.size) { + return Promise.resolve(); + } + return this.reobserve({ + fetchPolicy: this.initialFetchPolicy, + variables: variables, + }, exports.NetworkStatus.setVariables); + }; + ObservableQuery.prototype.updateQuery = function (mapFn) { + var queryManager = this.queryManager; + var result = queryManager.cache.diff({ + query: this.options.query, + variables: this.variables, + returnPartialData: true, + optimistic: false, + }).result; + var newResult = mapFn(result, { + variables: this.variables, + }); + if (newResult) { + queryManager.cache.writeQuery({ + query: this.options.query, + data: newResult, + variables: this.variables, + }); + queryManager.broadcastQueries(); + } + }; + ObservableQuery.prototype.startPolling = function (pollInterval) { + this.options.pollInterval = pollInterval; + this.updatePolling(); + }; + ObservableQuery.prototype.stopPolling = function () { + this.options.pollInterval = 0; + this.updatePolling(); + }; + ObservableQuery.prototype.fetch = function (options, newNetworkStatus) { + this.queryManager.setObservableQuery(this); + return this.queryManager.fetchQueryObservable(this.queryId, options, newNetworkStatus); + }; + ObservableQuery.prototype.updatePolling = function () { + var _this = this; + if (this.queryManager.ssrMode) { + return; + } + var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; + if (!pollInterval) { + if (pollingInfo) { + clearTimeout(pollingInfo.timeout); + delete this.pollingInfo; + } + return; + } + if (pollingInfo && + pollingInfo.interval === pollInterval) { + return; + } + __DEV__ ? globals.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : globals.invariant(pollInterval, 12); + var info = pollingInfo || (this.pollingInfo = {}); + info.interval = pollInterval; + var maybeFetch = function () { + if (_this.pollingInfo) { + if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) { + _this.reobserve({ + fetchPolicy: "network-only", + }, exports.NetworkStatus.poll).then(poll, poll); + } + else { + poll(); + } + } + }; + var poll = function () { + var info = _this.pollingInfo; + if (info) { + clearTimeout(info.timeout); + info.timeout = setTimeout(maybeFetch, info.interval); + } + }; + poll(); + }; + ObservableQuery.prototype.updateLastResult = function (newResult, variables) { + if (variables === void 0) { variables = this.variables; } + this.last = tslib.__assign(tslib.__assign({}, this.last), { result: this.queryManager.assumeImmutableResults + ? newResult + : utilities.cloneDeep(newResult), variables: variables }); + if (!utilities.isNonEmptyArray(newResult.errors)) { + delete this.last.error; + } + return this.last; + }; + ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { + var _this = this; + this.isTornDown = false; + var useDisposableConcast = newNetworkStatus === exports.NetworkStatus.refetch || + newNetworkStatus === exports.NetworkStatus.fetchMore || + newNetworkStatus === exports.NetworkStatus.poll; + var oldVariables = this.options.variables; + var options = useDisposableConcast + ? utilities.compact(this.options, newOptions) + : assign(this.options, utilities.compact(newOptions)); + if (!useDisposableConcast) { + this.updatePolling(); + if (newOptions && + newOptions.variables && + !newOptions.fetchPolicy && + !equality.equal(newOptions.variables, oldVariables)) { + options.fetchPolicy = this.initialFetchPolicy; + if (newNetworkStatus === void 0) { + newNetworkStatus = exports.NetworkStatus.setVariables; + } + } + } + var variables = options.variables && tslib.__assign({}, options.variables); + var concast = this.fetch(options, newNetworkStatus); + var observer = { + next: function (result) { + _this.reportResult(result, variables); + }, + error: function (error) { + _this.reportError(error, variables); + }, + }; + if (!useDisposableConcast) { + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer, true); + } + this.concast = concast; + this.observer = observer; + } + concast.addObserver(observer); + return concast.promise; + }; + ObservableQuery.prototype.observe = function () { + this.reportResult(this.getCurrentResult(false), this.variables); + }; + ObservableQuery.prototype.reportResult = function (result, variables) { + if (this.getLastError() || this.isDifferentFromLastResult(result)) { + this.updateLastResult(result, variables); + utilities.iterateObserversSafely(this.observers, 'next', result); + } + }; + ObservableQuery.prototype.reportError = function (error, variables) { + var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false }); + this.updateLastResult(errorResult, variables); + utilities.iterateObserversSafely(this.observers, 'error', this.last.error = error); + }; + ObservableQuery.prototype.hasObservers = function () { + return this.observers.size > 0; + }; + ObservableQuery.prototype.tearDownQuery = function () { + if (this.isTornDown) + return; + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + delete this.concast; + delete this.observer; + } + this.stopPolling(); + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + this.subscriptions.clear(); + this.queryManager.stopQuery(this.queryId); + this.observers.clear(); + this.isTornDown = true; + }; + return ObservableQuery; +}(utilities.Observable)); +utilities.fixObservableSubclass(ObservableQuery); +function defaultSubscriptionObserverErrorCallback(error) { + __DEV__ && globals.invariant.error('Unhandled error', error.message, error.stack); +} +function logMissingFieldErrors(missing) { + if (__DEV__ && utilities.isNonEmptyArray(missing)) { + __DEV__ && globals.invariant.debug("Missing cache result fields: " + missing.map(function (m) { return m.path.join('.'); }).join(', '), missing); + } +} +function applyNextFetchPolicy(options) { + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, nextFetchPolicy = options.nextFetchPolicy; + if (nextFetchPolicy) { + options.fetchPolicy = typeof nextFetchPolicy === "function" + ? nextFetchPolicy.call(options, fetchPolicy) + : nextFetchPolicy; + } +} + +var LocalState = (function () { + function LocalState(_a) { + var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; + this.cache = cache; + if (client) { + this.client = client; + } + if (resolvers) { + this.addResolvers(resolvers); + } + if (fragmentMatcher) { + this.setFragmentMatcher(fragmentMatcher); + } + } + LocalState.prototype.addResolvers = function (resolvers) { + var _this = this; + this.resolvers = this.resolvers || {}; + if (Array.isArray(resolvers)) { + resolvers.forEach(function (resolverGroup) { + _this.resolvers = utilities.mergeDeep(_this.resolvers, resolverGroup); + }); + } + else { + this.resolvers = utilities.mergeDeep(this.resolvers, resolvers); + } + }; + LocalState.prototype.setResolvers = function (resolvers) { + this.resolvers = {}; + this.addResolvers(resolvers); + }; + LocalState.prototype.getResolvers = function () { + return this.resolvers || {}; + }; + LocalState.prototype.runResolvers = function (_a) { + var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_c) { + if (document) { + return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })]; + } + return [2, remoteResult]; + }); + }); + }; + LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { + this.fragmentMatcher = fragmentMatcher; + }; + LocalState.prototype.getFragmentMatcher = function () { + return this.fragmentMatcher; + }; + LocalState.prototype.clientQuery = function (document) { + if (utilities.hasDirectives(['client'], document)) { + if (this.resolvers) { + return document; + } + } + return null; + }; + LocalState.prototype.serverQuery = function (document) { + return utilities.removeClientSetsFromDocument(document); + }; + LocalState.prototype.prepareContext = function (context) { + var cache = this.cache; + return tslib.__assign(tslib.__assign({}, context), { cache: cache, getCacheKey: function (obj) { + return cache.identify(obj); + } }); + }; + LocalState.prototype.addExportedVariables = function (document, variables, context) { + if (variables === void 0) { variables = {}; } + if (context === void 0) { context = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (document) { + return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })]; + } + return [2, tslib.__assign({}, variables)]; + }); + }); + }; + LocalState.prototype.shouldForceResolvers = function (document) { + var forceResolvers = false; + graphql.visit(document, { + Directive: { + enter: function (node) { + if (node.name.value === 'client' && node.arguments) { + forceResolvers = node.arguments.some(function (arg) { + return arg.name.value === 'always' && + arg.value.kind === 'BooleanValue' && + arg.value.value === true; + }); + if (forceResolvers) { + return graphql.BREAK; + } + } + }, + }, + }); + return forceResolvers; + }; + LocalState.prototype.buildRootValueFromCache = function (document, variables) { + return this.cache.diff({ + query: utilities.buildQueryFromSelectionSet(document), + variables: variables, + returnPartialData: true, + optimistic: false, + }).result; + }; + LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { + if (context === void 0) { context = {}; } + if (variables === void 0) { variables = {}; } + if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } + if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } + return tslib.__awaiter(this, void 0, void 0, function () { + var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; + return tslib.__generator(this, function (_b) { + mainDefinition = utilities.getMainDefinition(document); + fragments = utilities.getFragmentDefinitions(document); + fragmentMap = utilities.createFragmentMap(fragments); + definitionOperation = mainDefinition + .operation; + defaultOperationType = definitionOperation + ? definitionOperation.charAt(0).toUpperCase() + + definitionOperation.slice(1) + : 'Query'; + _a = this, cache = _a.cache, client = _a.client; + execContext = { + fragmentMap: fragmentMap, + context: tslib.__assign(tslib.__assign({}, context), { cache: cache, client: client }), + variables: variables, + fragmentMatcher: fragmentMatcher, + defaultOperationType: defaultOperationType, + exportedVariables: {}, + onlyRunForcedResolvers: onlyRunForcedResolvers, + }; + return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ + result: result, + exportedVariables: execContext.exportedVariables, + }); })]; + }); + }); + }; + LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var fragmentMap, context, variables, resultsToMerge, execute; + var _this = this; + return tslib.__generator(this, function (_a) { + fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; + resultsToMerge = [rootValue]; + execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () { + var fragment, typeCondition; + return tslib.__generator(this, function (_a) { + if (!utilities.shouldInclude(selection, variables)) { + return [2]; + } + if (utilities.isField(selection)) { + return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { + var _a; + if (typeof fieldResult !== 'undefined') { + resultsToMerge.push((_a = {}, + _a[utilities.resultKeyNameFromField(selection)] = fieldResult, + _a)); + } + })]; + } + if (utilities.isInlineFragment(selection)) { + fragment = selection; + } + else { + fragment = fragmentMap[selection.name.value]; + __DEV__ ? globals.invariant(fragment, "No fragment named " + selection.name.value) : globals.invariant(fragment, 11); + } + if (fragment && fragment.typeCondition) { + typeCondition = fragment.typeCondition.name.value; + if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { + return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { + resultsToMerge.push(fragmentResult); + })]; + } + } + return [2]; + }); + }); }; + return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { + return utilities.mergeDeepArray(resultsToMerge); + })]; + }); + }); + }; + LocalState.prototype.resolveField = function (field, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; + var _this = this; + return tslib.__generator(this, function (_a) { + variables = execContext.variables; + fieldName = field.name.value; + aliasedFieldName = utilities.resultKeyNameFromField(field); + aliasUsed = fieldName !== aliasedFieldName; + defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; + resultPromise = Promise.resolve(defaultResult); + if (!execContext.onlyRunForcedResolvers || + this.shouldForceResolvers(field)) { + resolverType = rootValue.__typename || execContext.defaultOperationType; + resolverMap = this.resolvers && this.resolvers[resolverType]; + if (resolverMap) { + resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; + if (resolve) { + resultPromise = Promise.resolve(cache.cacheSlot.withValue(this.cache, resolve, [ + rootValue, + utilities.argumentsObjectFromField(field, variables), + execContext.context, + { field: field, fragmentMap: execContext.fragmentMap }, + ])); + } + } + } + return [2, resultPromise.then(function (result) { + if (result === void 0) { result = defaultResult; } + if (field.directives) { + field.directives.forEach(function (directive) { + if (directive.name.value === 'export' && directive.arguments) { + directive.arguments.forEach(function (arg) { + if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { + execContext.exportedVariables[arg.value.value] = result; + } + }); + } + }); + } + if (!field.selectionSet) { + return result; + } + if (result == null) { + return result; + } + if (Array.isArray(result)) { + return _this.resolveSubSelectedArray(field, result, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, result, execContext); + } + })]; + }); + }); + }; + LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { + var _this = this; + return Promise.all(result.map(function (item) { + if (item === null) { + return null; + } + if (Array.isArray(item)) { + return _this.resolveSubSelectedArray(field, item, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, item, execContext); + } + })); + }; + return LocalState; +}()); + +var destructiveMethodCounts = new (utilities.canUseWeakMap ? WeakMap : Map)(); +function wrapDestructiveCacheMethod(cache, methodName) { + var original = cache[methodName]; + if (typeof original === "function") { + cache[methodName] = function () { + destructiveMethodCounts.set(cache, (destructiveMethodCounts.get(cache) + 1) % 1e15); + return original.apply(this, arguments); + }; + } +} +function cancelNotifyTimeout(info) { + if (info["notifyTimeout"]) { + clearTimeout(info["notifyTimeout"]); + info["notifyTimeout"] = void 0; + } +} +var QueryInfo = (function () { + function QueryInfo(queryManager, queryId) { + if (queryId === void 0) { queryId = queryManager.generateQueryId(); } + this.queryId = queryId; + this.listeners = new Set(); + this.document = null; + this.lastRequestId = 1; + this.subscriptions = new Set(); + this.stopped = false; + this.dirty = false; + this.observableQuery = null; + var cache = this.cache = queryManager.cache; + if (!destructiveMethodCounts.has(cache)) { + destructiveMethodCounts.set(cache, 0); + wrapDestructiveCacheMethod(cache, "evict"); + wrapDestructiveCacheMethod(cache, "modify"); + wrapDestructiveCacheMethod(cache, "reset"); + } + } + QueryInfo.prototype.init = function (query) { + var networkStatus = query.networkStatus || exports.NetworkStatus.loading; + if (this.variables && + this.networkStatus !== exports.NetworkStatus.loading && + !equality.equal(this.variables, query.variables)) { + networkStatus = exports.NetworkStatus.setVariables; + } + if (!equality.equal(query.variables, this.variables)) { + this.lastDiff = void 0; + } + Object.assign(this, { + document: query.document, + variables: query.variables, + networkError: null, + graphQLErrors: this.graphQLErrors || [], + networkStatus: networkStatus, + }); + if (query.observableQuery) { + this.setObservableQuery(query.observableQuery); + } + if (query.lastRequestId) { + this.lastRequestId = query.lastRequestId; + } + return this; + }; + QueryInfo.prototype.reset = function () { + cancelNotifyTimeout(this); + this.lastDiff = void 0; + this.dirty = false; + }; + QueryInfo.prototype.getDiff = function (variables) { + if (variables === void 0) { variables = this.variables; } + var options = this.getDiffOptions(variables); + if (this.lastDiff && equality.equal(options, this.lastDiff.options)) { + return this.lastDiff.diff; + } + this.updateWatch(this.variables = variables); + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return { complete: false }; + } + var diff = this.cache.diff(options); + this.updateLastDiff(diff, options); + return diff; + }; + QueryInfo.prototype.updateLastDiff = function (diff, options) { + this.lastDiff = diff ? { + diff: diff, + options: options || this.getDiffOptions(), + } : void 0; + }; + QueryInfo.prototype.getDiffOptions = function (variables) { + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + return { + query: this.document, + variables: variables, + returnPartialData: true, + optimistic: true, + canonizeResults: !oq || oq.options.canonizeResults !== false, + }; + }; + QueryInfo.prototype.setDiff = function (diff) { + var _this = this; + var oldDiff = this.lastDiff && this.lastDiff.diff; + this.updateLastDiff(diff); + if (!this.dirty && + !equality.equal(oldDiff && oldDiff.result, diff && diff.result)) { + this.dirty = true; + if (!this.notifyTimeout) { + this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); + } + } + }; + QueryInfo.prototype.setObservableQuery = function (oq) { + var _this = this; + if (oq === this.observableQuery) + return; + if (this.oqListener) { + this.listeners.delete(this.oqListener); + } + this.observableQuery = oq; + if (oq) { + oq["queryInfo"] = this; + this.listeners.add(this.oqListener = function () { + if (_this.getDiff().fromOptimisticTransaction) { + oq["observe"](); + } + else { + oq.reobserve(); + } + }); + } + else { + delete this.oqListener; + } + }; + QueryInfo.prototype.notify = function () { + var _this = this; + cancelNotifyTimeout(this); + if (this.shouldNotify()) { + this.listeners.forEach(function (listener) { return listener(_this); }); + } + this.dirty = false; + }; + QueryInfo.prototype.shouldNotify = function () { + if (!this.dirty || !this.listeners.size) { + return false; + } + if (isNetworkRequestInFlight(this.networkStatus) && + this.observableQuery) { + var fetchPolicy = this.observableQuery.options.fetchPolicy; + if (fetchPolicy !== "cache-only" && + fetchPolicy !== "cache-and-network") { + return false; + } + } + return true; + }; + QueryInfo.prototype.stop = function () { + if (!this.stopped) { + this.stopped = true; + this.reset(); + this.cancel(); + this.cancel = QueryInfo.prototype.cancel; + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + var oq = this.observableQuery; + if (oq) + oq.stopPolling(); + } + }; + QueryInfo.prototype.cancel = function () { }; + QueryInfo.prototype.updateWatch = function (variables) { + var _this = this; + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return; + } + var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); + if (!this.lastWatch || + !equality.equal(watchOptions, this.lastWatch)) { + this.cancel(); + this.cancel = this.cache.watch(this.lastWatch = watchOptions); + } + }; + QueryInfo.prototype.resetLastWrite = function () { + this.lastWrite = void 0; + }; + QueryInfo.prototype.shouldWrite = function (result, variables) { + var lastWrite = this.lastWrite; + return !(lastWrite && + lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && + equality.equal(variables, lastWrite.variables) && + equality.equal(result.data, lastWrite.result.data)); + }; + QueryInfo.prototype.markResult = function (result, options, cacheWriteBehavior) { + var _this = this; + this.graphQLErrors = utilities.isNonEmptyArray(result.errors) ? result.errors : []; + this.reset(); + if (options.fetchPolicy === 'no-cache') { + this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); + } + else if (cacheWriteBehavior !== 0) { + if (shouldWriteResult(result, options.errorPolicy)) { + this.cache.performTransaction(function (cache) { + if (_this.shouldWrite(result, options.variables)) { + cache.writeQuery({ + query: _this.document, + data: result.data, + variables: options.variables, + overwrite: cacheWriteBehavior === 1, + }); + _this.lastWrite = { + result: result, + variables: options.variables, + dmCount: destructiveMethodCounts.get(_this.cache), + }; + } + else { + if (_this.lastDiff && + _this.lastDiff.diff.complete) { + result.data = _this.lastDiff.diff.result; + return; + } + } + var diffOptions = _this.getDiffOptions(options.variables); + var diff = cache.diff(diffOptions); + if (!_this.stopped) { + _this.updateWatch(options.variables); + } + _this.updateLastDiff(diff, diffOptions); + if (diff.complete) { + result.data = diff.result; + } + }); + } + else { + this.lastWrite = void 0; + } + } + }; + QueryInfo.prototype.markReady = function () { + this.networkError = null; + return this.networkStatus = exports.NetworkStatus.ready; + }; + QueryInfo.prototype.markError = function (error) { + this.networkStatus = exports.NetworkStatus.error; + this.lastWrite = void 0; + this.reset(); + if (error.graphQLErrors) { + this.graphQLErrors = error.graphQLErrors; + } + if (error.networkError) { + this.networkError = error.networkError; + } + return error; + }; + return QueryInfo; +}()); +function shouldWriteResult(result, errorPolicy) { + if (errorPolicy === void 0) { errorPolicy = "none"; } + var ignoreErrors = errorPolicy === "ignore" || + errorPolicy === "all"; + var writeWithErrors = !utilities.graphQLResultHasError(result); + if (!writeWithErrors && ignoreErrors && result.data) { + writeWithErrors = true; + } + return writeWithErrors; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var QueryManager = (function () { + function QueryManager(_a) { + var cache = _a.cache, link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; + this.clientAwareness = {}; + this.queries = new Map(); + this.fetchCancelFns = new Map(); + this.transformCache = new (utilities.canUseWeakMap ? WeakMap : Map)(); + this.queryIdCounter = 1; + this.requestIdCounter = 1; + this.mutationIdCounter = 1; + this.inFlightLinkObservables = new Map(); + this.cache = cache; + this.link = link; + this.queryDeduplication = queryDeduplication; + this.clientAwareness = clientAwareness; + this.localState = localState || new LocalState({ cache: cache }); + this.ssrMode = ssrMode; + this.assumeImmutableResults = !!assumeImmutableResults; + if ((this.onBroadcast = onBroadcast)) { + this.mutationStore = Object.create(null); + } + } + QueryManager.prototype.stop = function () { + var _this = this; + this.queries.forEach(function (_info, queryId) { + _this.stopQueryNoBroadcast(queryId); + }); + this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('QueryManager stopped while query was in flight') : new globals.InvariantError(13)); + }; + QueryManager.prototype.cancelPendingFetches = function (error) { + this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); + this.fetchCancelFns.clear(); + }; + QueryManager.prototype.mutate = function (_a) { + var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, _e = _a.fetchPolicy, fetchPolicy = _e === void 0 ? 'network-only' : _e, keepRootFields = _a.keepRootFields, context = _a.context; + return tslib.__awaiter(this, void 0, void 0, function () { + var mutationId, mutationStoreValue, self; + return tslib.__generator(this, function (_f) { + switch (_f.label) { + case 0: + __DEV__ ? globals.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : globals.invariant(mutation, 14); + __DEV__ ? globals.invariant(fetchPolicy === 'network-only' || + fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : globals.invariant(fetchPolicy === 'network-only' || + fetchPolicy === 'no-cache', 15); + mutationId = this.generateMutationId(); + mutation = this.transform(mutation).document; + variables = this.getVariables(mutation, variables); + if (!this.transform(mutation).hasClientExports) return [3, 2]; + return [4, this.localState.addExportedVariables(mutation, variables, context)]; + case 1: + variables = (_f.sent()); + _f.label = 2; + case 2: + mutationStoreValue = this.mutationStore && + (this.mutationStore[mutationId] = { + mutation: mutation, + variables: variables, + loading: true, + error: null, + }); + if (optimisticResponse) { + this.markMutationOptimistic(optimisticResponse, { + mutationId: mutationId, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + updateQueries: updateQueries, + update: updateWithProxyFn, + keepRootFields: keepRootFields, + }); + } + this.broadcastQueries(); + self = this; + return [2, new Promise(function (resolve, reject) { + return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) { + if (utilities.graphQLResultHasError(result) && errorPolicy === 'none') { + throw new errors.ApolloError({ + graphQLErrors: result.errors, + }); + } + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = null; + } + var storeResult = tslib.__assign({}, result); + if (typeof refetchQueries === "function") { + refetchQueries = refetchQueries(storeResult); + } + if (errorPolicy === 'ignore' && + utilities.graphQLResultHasError(storeResult)) { + delete storeResult.errors; + } + return self.markMutationResult({ + mutationId: mutationId, + result: storeResult, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + update: updateWithProxyFn, + updateQueries: updateQueries, + awaitRefetchQueries: awaitRefetchQueries, + refetchQueries: refetchQueries, + removeOptimistic: optimisticResponse ? mutationId : void 0, + onQueryUpdated: onQueryUpdated, + keepRootFields: keepRootFields, + }); + }).subscribe({ + next: function (storeResult) { + self.broadcastQueries(); + resolve(storeResult); + }, + error: function (err) { + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = err; + } + if (optimisticResponse) { + self.cache.removeOptimistic(mutationId); + } + self.broadcastQueries(); + reject(err instanceof errors.ApolloError ? err : new errors.ApolloError({ + networkError: err, + })); + }, + }); + })]; + } + }); + }); + }; + QueryManager.prototype.markMutationResult = function (mutation, cache) { + var _this = this; + if (cache === void 0) { cache = this.cache; } + var result = mutation.result; + var cacheWrites = []; + var skipCache = mutation.fetchPolicy === "no-cache"; + if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) { + cacheWrites.push({ + result: result.data, + dataId: 'ROOT_MUTATION', + query: mutation.document, + variables: mutation.variables, + }); + var updateQueries_1 = mutation.updateQueries; + if (updateQueries_1) { + this.queries.forEach(function (_a, queryId) { + var observableQuery = _a.observableQuery; + var queryName = observableQuery && observableQuery.queryName; + if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) { + return; + } + var updater = updateQueries_1[queryName]; + var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; + var _c = cache.diff({ + query: document, + variables: variables, + returnPartialData: true, + optimistic: false, + }), currentQueryResult = _c.result, complete = _c.complete; + if (complete && currentQueryResult) { + var nextQueryResult = updater(currentQueryResult, { + mutationResult: result, + queryName: document && utilities.getOperationName(document) || void 0, + queryVariables: variables, + }); + if (nextQueryResult) { + cacheWrites.push({ + result: nextQueryResult, + dataId: 'ROOT_QUERY', + query: document, + variables: variables, + }); + } + } + }); + } + } + if (cacheWrites.length > 0 || + mutation.refetchQueries || + mutation.update || + mutation.onQueryUpdated || + mutation.removeOptimistic) { + var results_1 = []; + this.refetchQueries({ + updateCache: function (cache) { + if (!skipCache) { + cacheWrites.forEach(function (write) { return cache.write(write); }); + } + var update = mutation.update; + if (update) { + if (!skipCache) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: _this.transform(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + if (diff.complete) { + result = tslib.__assign(tslib.__assign({}, result), { data: diff.result }); + } + } + update(cache, result, { + context: mutation.context, + variables: mutation.variables, + }); + } + if (!skipCache && !mutation.keepRootFields) { + cache.modify({ + id: 'ROOT_MUTATION', + fields: function (value, _a) { + var fieldName = _a.fieldName, DELETE = _a.DELETE; + return fieldName === "__typename" ? value : DELETE; + }, + }); + } + }, + include: mutation.refetchQueries, + optimistic: false, + removeOptimistic: mutation.removeOptimistic, + onQueryUpdated: mutation.onQueryUpdated || null, + }).forEach(function (result) { return results_1.push(result); }); + if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { + return Promise.all(results_1).then(function () { return result; }); + } + } + return Promise.resolve(result); + }; + QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { + var _this = this; + var data = typeof optimisticResponse === "function" + ? optimisticResponse(mutation.variables) + : optimisticResponse; + return this.cache.recordOptimisticTransaction(function (cache) { + try { + _this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache); + } + catch (error) { + __DEV__ && globals.invariant.error(error); + } + }, mutation.mutationId); + }; + QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { + return this.fetchQueryObservable(queryId, options, networkStatus).promise; + }; + QueryManager.prototype.getQueryStore = function () { + var store = Object.create(null); + this.queries.forEach(function (info, queryId) { + store[queryId] = { + variables: info.variables, + networkStatus: info.networkStatus, + networkError: info.networkError, + graphQLErrors: info.graphQLErrors, + }; + }); + return store; + }; + QueryManager.prototype.resetErrors = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) { + queryInfo.networkError = undefined; + queryInfo.graphQLErrors = []; + } + }; + QueryManager.prototype.transform = function (document) { + var transformCache = this.transformCache; + if (!transformCache.has(document)) { + var transformed = this.cache.transformDocument(document); + var forLink = utilities.removeConnectionDirectiveFromDocument(this.cache.transformForLink(transformed)); + var clientQuery = this.localState.clientQuery(transformed); + var serverQuery = forLink && this.localState.serverQuery(forLink); + var cacheEntry_1 = { + document: transformed, + hasClientExports: utilities.hasClientExports(transformed), + hasForcedResolvers: this.localState.shouldForceResolvers(transformed), + clientQuery: clientQuery, + serverQuery: serverQuery, + defaultVars: utilities.getDefaultValues(utilities.getOperationDefinition(transformed)), + asQuery: tslib.__assign(tslib.__assign({}, transformed), { definitions: transformed.definitions.map(function (def) { + if (def.kind === "OperationDefinition" && + def.operation !== "query") { + return tslib.__assign(tslib.__assign({}, def), { operation: "query" }); + } + return def; + }) }) + }; + var add = function (doc) { + if (doc && !transformCache.has(doc)) { + transformCache.set(doc, cacheEntry_1); + } + }; + add(document); + add(transformed); + add(clientQuery); + add(serverQuery); + } + return transformCache.get(document); + }; + QueryManager.prototype.getVariables = function (document, variables) { + return tslib.__assign(tslib.__assign({}, this.transform(document).defaultVars), variables); + }; + QueryManager.prototype.watchQuery = function (options) { + options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(options.query, options.variables) }); + if (typeof options.notifyOnNetworkStatusChange === 'undefined') { + options.notifyOnNetworkStatusChange = false; + } + var queryInfo = new QueryInfo(this); + var observable = new ObservableQuery({ + queryManager: this, + queryInfo: queryInfo, + options: options, + }); + this.queries.set(observable.queryId, queryInfo); + queryInfo.init({ + document: options.query, + observableQuery: observable, + variables: options.variables, + }); + return observable; + }; + QueryManager.prototype.query = function (options, queryId) { + var _this = this; + if (queryId === void 0) { queryId = this.generateQueryId(); } + __DEV__ ? globals.invariant(options.query, 'query option is required. You must specify your GraphQL document ' + + 'in the query option.') : globals.invariant(options.query, 16); + __DEV__ ? globals.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : globals.invariant(options.query.kind === 'Document', 17); + __DEV__ ? globals.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : globals.invariant(!options.returnPartialData, 18); + __DEV__ ? globals.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : globals.invariant(!options.pollInterval, 19); + return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); }); + }; + QueryManager.prototype.generateQueryId = function () { + return String(this.queryIdCounter++); + }; + QueryManager.prototype.generateRequestId = function () { + return this.requestIdCounter++; + }; + QueryManager.prototype.generateMutationId = function () { + return String(this.mutationIdCounter++); + }; + QueryManager.prototype.stopQueryInStore = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) + queryInfo.stop(); + }; + QueryManager.prototype.clearStore = function () { + this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('Store reset while query was in flight (not completed in link chain)') : new globals.InvariantError(20)); + this.queries.forEach(function (queryInfo) { + if (queryInfo.observableQuery) { + queryInfo.networkStatus = exports.NetworkStatus.loading; + } + else { + queryInfo.stop(); + } + }); + if (this.mutationStore) { + this.mutationStore = Object.create(null); + } + return this.cache.reset(); + }; + QueryManager.prototype.resetStore = function () { + var _this = this; + return this.clearStore().then(function () { + return _this.reFetchObservableQueries(); + }); + }; + QueryManager.prototype.getObservableQueries = function (include) { + var _this = this; + if (include === void 0) { include = "active"; } + var queries = new Map(); + var queryNamesAndDocs = new Map(); + var legacyQueryOptions = new Set(); + if (Array.isArray(include)) { + include.forEach(function (desc) { + if (typeof desc === "string") { + queryNamesAndDocs.set(desc, false); + } + else if (utilities.isDocumentNode(desc)) { + queryNamesAndDocs.set(_this.transform(desc).document, false); + } + else if (utilities.isNonNullObject(desc) && desc.query) { + legacyQueryOptions.add(desc); + } + }); + } + this.queries.forEach(function (_a, queryId) { + var oq = _a.observableQuery, document = _a.document; + if (oq) { + if (include === "all") { + queries.set(queryId, oq); + return; + } + var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; + if (fetchPolicy === "standby" || !oq.hasObservers()) { + return; + } + if (include === "active" || + (queryName && queryNamesAndDocs.has(queryName)) || + (document && queryNamesAndDocs.has(document))) { + queries.set(queryId, oq); + if (queryName) + queryNamesAndDocs.set(queryName, true); + if (document) + queryNamesAndDocs.set(document, true); + } + } + }); + if (legacyQueryOptions.size) { + legacyQueryOptions.forEach(function (options) { + var queryId = utilities.makeUniqueId("legacyOneTimeQuery"); + var queryInfo = _this.getQuery(queryId).init({ + document: options.query, + variables: options.variables, + }); + var oq = new ObservableQuery({ + queryManager: _this, + queryInfo: queryInfo, + options: tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "network-only" }), + }); + globals.invariant(oq.queryId === queryId); + queryInfo.setObservableQuery(oq); + queries.set(queryId, oq); + }); + } + if (__DEV__ && queryNamesAndDocs.size) { + queryNamesAndDocs.forEach(function (included, nameOrDoc) { + if (!included) { + __DEV__ && globals.invariant.warn("Unknown query " + (typeof nameOrDoc === "string" ? "named " : "") + JSON.stringify(nameOrDoc, null, 2) + " requested in refetchQueries options.include array"); + } + }); + } + return queries; + }; + QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { + var _this = this; + if (includeStandby === void 0) { includeStandby = false; } + var observableQueryPromises = []; + this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { + var fetchPolicy = observableQuery.options.fetchPolicy; + observableQuery.resetLastResults(); + if (includeStandby || + (fetchPolicy !== "standby" && + fetchPolicy !== "cache-only")) { + observableQueryPromises.push(observableQuery.refetch()); + } + _this.getQuery(queryId).setDiff(null); + }); + this.broadcastQueries(); + return Promise.all(observableQueryPromises); + }; + QueryManager.prototype.setObservableQuery = function (observableQuery) { + this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); + }; + QueryManager.prototype.startGraphQLSubscription = function (_a) { + var _this = this; + var query = _a.query, fetchPolicy = _a.fetchPolicy, errorPolicy = _a.errorPolicy, variables = _a.variables, _b = _a.context, context = _b === void 0 ? {} : _b; + query = this.transform(query).document; + variables = this.getVariables(query, variables); + var makeObservable = function (variables) { + return _this.getObservableFromLink(query, context, variables).map(function (result) { + if (fetchPolicy !== 'no-cache') { + if (shouldWriteResult(result, errorPolicy)) { + _this.cache.write({ + query: query, + result: result.data, + dataId: 'ROOT_SUBSCRIPTION', + variables: variables, + }); + } + _this.broadcastQueries(); + } + if (utilities.graphQLResultHasError(result)) { + throw new errors.ApolloError({ + graphQLErrors: result.errors, + }); + } + return result; + }); + }; + if (this.transform(query).hasClientExports) { + var observablePromise_1 = this.localState.addExportedVariables(query, variables, context).then(makeObservable); + return new utilities.Observable(function (observer) { + var sub = null; + observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); + return function () { return sub && sub.unsubscribe(); }; + }); + } + return makeObservable(variables); + }; + QueryManager.prototype.stopQuery = function (queryId) { + this.stopQueryNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.removeQuery(queryId); + }; + QueryManager.prototype.removeQuery = function (queryId) { + this.fetchCancelFns.delete(queryId); + this.getQuery(queryId).stop(); + this.queries.delete(queryId); + }; + QueryManager.prototype.broadcastQueries = function () { + if (this.onBroadcast) + this.onBroadcast(); + this.queries.forEach(function (info) { return info.notify(); }); + }; + QueryManager.prototype.getLocalState = function () { + return this.localState; + }; + QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { + var _this = this; + var _a; + if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } + var observable; + var serverQuery = this.transform(query).serverQuery; + if (serverQuery) { + var _b = this, inFlightLinkObservables_1 = _b.inFlightLinkObservables, link = _b.link; + var operation = { + query: serverQuery, + variables: variables, + operationName: utilities.getOperationName(serverQuery) || void 0, + context: this.prepareContext(tslib.__assign(tslib.__assign({}, context), { forceFetch: !deduplication })), + }; + context = operation.context; + if (deduplication) { + var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); + inFlightLinkObservables_1.set(serverQuery, byVariables_1); + var varJson_1 = cache.canonicalStringify(variables); + observable = byVariables_1.get(varJson_1); + if (!observable) { + var concast = new utilities.Concast([ + core.execute(link, operation) + ]); + byVariables_1.set(varJson_1, observable = concast); + concast.cleanup(function () { + if (byVariables_1.delete(varJson_1) && + byVariables_1.size < 1) { + inFlightLinkObservables_1.delete(serverQuery); + } + }); + } + } + else { + observable = new utilities.Concast([ + core.execute(link, operation) + ]); + } + } + else { + observable = new utilities.Concast([ + utilities.Observable.of({ data: {} }) + ]); + context = this.prepareContext(context); + } + var clientQuery = this.transform(query).clientQuery; + if (clientQuery) { + observable = utilities.asyncMap(observable, function (result) { + return _this.localState.runResolvers({ + document: clientQuery, + remoteResult: result, + context: context, + variables: variables, + }); + }); + } + return observable; + }; + QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { + var requestId = queryInfo.lastRequestId = this.generateRequestId(); + return utilities.asyncMap(this.getObservableFromLink(queryInfo.document, options.context, options.variables), function (result) { + var hasErrors = utilities.isNonEmptyArray(result.errors); + if (requestId >= queryInfo.lastRequestId) { + if (hasErrors && options.errorPolicy === "none") { + throw queryInfo.markError(new errors.ApolloError({ + graphQLErrors: result.errors, + })); + } + queryInfo.markResult(result, options, cacheWriteBehavior); + queryInfo.markReady(); + } + var aqr = { + data: result.data, + loading: false, + networkStatus: queryInfo.networkStatus || exports.NetworkStatus.ready, + }; + if (hasErrors && options.errorPolicy !== "ignore") { + aqr.errors = result.errors; + } + return aqr; + }, function (networkError) { + var error = errors.isApolloError(networkError) + ? networkError + : new errors.ApolloError({ networkError: networkError }); + if (requestId >= queryInfo.lastRequestId) { + queryInfo.markError(error); + } + throw error; + }); + }; + QueryManager.prototype.fetchQueryObservable = function (queryId, options, networkStatus) { + var _this = this; + if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; } + var query = this.transform(options.query).document; + var variables = this.getVariables(query, options.variables); + var queryInfo = this.getQuery(queryId); + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; + var normalized = Object.assign({}, options, { + query: query, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + returnPartialData: returnPartialData, + notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, + context: context, + }); + var fromVariables = function (variables) { + normalized.variables = variables; + return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); + }; + this.fetchCancelFns.set(queryId, function (reason) { + setTimeout(function () { return concast.cancel(reason); }); + }); + var concast = new utilities.Concast(this.transform(normalized.query).hasClientExports + ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables) + : fromVariables(normalized.variables)); + concast.cleanup(function () { + _this.fetchCancelFns.delete(queryId); + applyNextFetchPolicy(options); + }); + return concast; + }; + QueryManager.prototype.refetchQueries = function (_a) { + var _this = this; + var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? utilities.makeUniqueId("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; + var includedQueriesById = new Map(); + if (include) { + this.getObservableQueries(include).forEach(function (oq, queryId) { + includedQueriesById.set(queryId, { + oq: oq, + lastDiff: _this.getQuery(queryId).getDiff(), + }); + }); + } + var results = new Map; + if (updateCache) { + this.cache.batch({ + update: updateCache, + optimistic: optimistic && removeOptimistic || false, + removeOptimistic: removeOptimistic, + onWatchUpdated: function (watch, diff, lastDiff) { + var oq = watch.watcher instanceof QueryInfo && + watch.watcher.observableQuery; + if (oq) { + if (onQueryUpdated) { + includedQueriesById.delete(oq.queryId); + var result = onQueryUpdated(oq, diff, lastDiff); + if (result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + return false; + } + if (onQueryUpdated !== null) { + includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); + } + } + }, + }); + } + if (includedQueriesById.size) { + includedQueriesById.forEach(function (_a, queryId) { + var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; + var result; + if (onQueryUpdated) { + if (!diff) { + var info = oq["queryInfo"]; + info.reset(); + diff = info.getDiff(); + } + result = onQueryUpdated(oq, diff, lastDiff); + } + if (!onQueryUpdated || result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + if (queryId.indexOf("legacyOneTimeQuery") >= 0) { + _this.stopQueryNoBroadcast(queryId); + } + }); + } + if (removeOptimistic) { + this.cache.removeOptimistic(removeOptimistic); + } + return results; + }; + QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, networkStatus) { + var _this = this; + var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; + var oldNetworkStatus = queryInfo.networkStatus; + queryInfo.init({ + document: query, + variables: variables, + networkStatus: networkStatus, + }); + var readCache = function () { return queryInfo.getDiff(variables); }; + var resultsFromCache = function (diff, networkStatus) { + if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; } + var data = diff.result; + if (__DEV__ && + !returnPartialData && + !equality.equal(data, {})) { + logMissingFieldErrors(diff.missing); + } + var fromData = function (data) { return utilities.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); }; + if (data && _this.transform(query).hasForcedResolvers) { + return _this.localState.runResolvers({ + document: query, + remoteResult: { data: data }, + context: context, + variables: variables, + onlyRunForcedResolvers: true, + }).then(function (resolved) { return fromData(resolved.data || void 0); }); + } + return fromData(data); + }; + var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 : + (networkStatus === exports.NetworkStatus.refetch && + refetchWritePolicy !== "merge") ? 1 + : 2; + var resultsFromLink = function () { + return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { + variables: variables, + context: context, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + }); + }; + var shouldNotify = notifyOnNetworkStatusChange && + typeof oldNetworkStatus === "number" && + oldNetworkStatus !== networkStatus && + isNetworkRequestInFlight(networkStatus); + switch (fetchPolicy) { + default: + case "cache-first": { + var diff = readCache(); + if (diff.complete) { + return [ + resultsFromCache(diff, queryInfo.markReady()), + ]; + } + if (returnPartialData || shouldNotify) { + return [ + resultsFromCache(diff), + resultsFromLink(), + ]; + } + return [ + resultsFromLink(), + ]; + } + case "cache-and-network": { + var diff = readCache(); + if (diff.complete || returnPartialData || shouldNotify) { + return [ + resultsFromCache(diff), + resultsFromLink(), + ]; + } + return [ + resultsFromLink(), + ]; + } + case "cache-only": + return [ + resultsFromCache(readCache(), queryInfo.markReady()), + ]; + case "network-only": + if (shouldNotify) { + return [ + resultsFromCache(readCache()), + resultsFromLink(), + ]; + } + return [resultsFromLink()]; + case "no-cache": + if (shouldNotify) { + return [ + resultsFromCache(queryInfo.getDiff()), + resultsFromLink(), + ]; + } + return [resultsFromLink()]; + case "standby": + return []; + } + }; + QueryManager.prototype.getQuery = function (queryId) { + if (queryId && !this.queries.has(queryId)) { + this.queries.set(queryId, new QueryInfo(this, queryId)); + } + return this.queries.get(queryId); + }; + QueryManager.prototype.prepareContext = function (context) { + if (context === void 0) { context = {}; } + var newContext = this.localState.prepareContext(context); + return tslib.__assign(tslib.__assign({}, newContext), { clientAwareness: this.clientAwareness }); + }; + return QueryManager; +}()); + +var hasSuggestedDevtools = false; +function mergeOptions(defaults, options) { + return utilities.compact(defaults, options, options.variables && { + variables: tslib.__assign(tslib.__assign({}, defaults.variables), options.variables), + }); +} +var ApolloClient = (function () { + function ApolloClient(options) { + var _this = this; + this.defaultOptions = {}; + this.resetStoreCallbacks = []; + this.clearStoreCallbacks = []; + var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === 'object' && + !window.__APOLLO_CLIENT__ && + __DEV__ : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? false : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; + var link = options.link; + if (!link) { + link = uri + ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers }) + : core.ApolloLink.empty(); + } + if (!cache) { + throw __DEV__ ? new globals.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " + + "in the options object. \n" + + "For more information, please visit: https://go.apollo.dev/c/docs") : new globals.InvariantError(9); + } + this.link = link; + this.cache = cache; + this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; + this.queryDeduplication = queryDeduplication; + this.defaultOptions = defaultOptions || {}; + this.typeDefs = typeDefs; + if (ssrForceFetchDelay) { + setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); + } + this.watchQuery = this.watchQuery.bind(this); + this.query = this.query.bind(this); + this.mutate = this.mutate.bind(this); + this.resetStore = this.resetStore.bind(this); + this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); + if (connectToDevTools && typeof window === 'object') { + window.__APOLLO_CLIENT__ = this; + } + if (!hasSuggestedDevtools && __DEV__) { + hasSuggestedDevtools = true; + if (typeof window !== 'undefined' && + window.document && + window.top === window.self && + !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { + var nav = window.navigator; + var ua = nav && nav.userAgent; + var url = void 0; + if (typeof ua === "string") { + if (ua.indexOf("Chrome/") > -1) { + url = "https://chrome.google.com/webstore/detail/" + + "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; + } + else if (ua.indexOf("Firefox/") > -1) { + url = "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; + } + } + if (url) { + __DEV__ && globals.invariant.log("Download the Apollo DevTools for a better development " + + "experience: " + url); + } + } + } + this.version = version; + this.localState = new LocalState({ + cache: cache, + client: this, + resolvers: resolvers, + fragmentMatcher: fragmentMatcher, + }); + this.queryManager = new QueryManager({ + cache: this.cache, + link: this.link, + queryDeduplication: queryDeduplication, + ssrMode: ssrMode, + clientAwareness: { + name: clientAwarenessName, + version: clientAwarenessVersion, + }, + localState: this.localState, + assumeImmutableResults: assumeImmutableResults, + onBroadcast: connectToDevTools ? function () { + if (_this.devToolsHookCb) { + _this.devToolsHookCb({ + action: {}, + state: { + queries: _this.queryManager.getQueryStore(), + mutations: _this.queryManager.mutationStore || {}, + }, + dataWithOptimisticResults: _this.cache.extract(true), + }); + } + } : void 0, + }); + } + ApolloClient.prototype.stop = function () { + this.queryManager.stop(); + }; + ApolloClient.prototype.watchQuery = function (options) { + if (this.defaultOptions.watchQuery) { + options = mergeOptions(this.defaultOptions.watchQuery, options); + } + if (this.disableNetworkFetches && + (options.fetchPolicy === 'network-only' || + options.fetchPolicy === 'cache-and-network')) { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' }); + } + return this.queryManager.watchQuery(options); + }; + ApolloClient.prototype.query = function (options) { + if (this.defaultOptions.query) { + options = mergeOptions(this.defaultOptions.query, options); + } + __DEV__ ? globals.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + + 'client.query can only return a single result. Please use client.watchQuery ' + + 'to receive multiple results from the cache and the network, or consider ' + + 'using a different fetchPolicy, such as cache-first or network-only.') : globals.invariant(options.fetchPolicy !== 'cache-and-network', 10); + if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' }); + } + return this.queryManager.query(options); + }; + ApolloClient.prototype.mutate = function (options) { + if (this.defaultOptions.mutate) { + options = mergeOptions(this.defaultOptions.mutate, options); + } + return this.queryManager.mutate(options); + }; + ApolloClient.prototype.subscribe = function (options) { + return this.queryManager.startGraphQLSubscription(options); + }; + ApolloClient.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readQuery(options, optimistic); + }; + ApolloClient.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readFragment(options, optimistic); + }; + ApolloClient.prototype.writeQuery = function (options) { + this.cache.writeQuery(options); + this.queryManager.broadcastQueries(); + }; + ApolloClient.prototype.writeFragment = function (options) { + this.cache.writeFragment(options); + this.queryManager.broadcastQueries(); + }; + ApolloClient.prototype.__actionHookForDevTools = function (cb) { + this.devToolsHookCb = cb; + }; + ApolloClient.prototype.__requestRaw = function (payload) { + return core.execute(this.link, payload); + }; + ApolloClient.prototype.resetStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { return _this.queryManager.clearStore(); }) + .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) + .then(function () { return _this.reFetchObservableQueries(); }); + }; + ApolloClient.prototype.clearStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { return _this.queryManager.clearStore(); }) + .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); + }; + ApolloClient.prototype.onResetStore = function (cb) { + var _this = this; + this.resetStoreCallbacks.push(cb); + return function () { + _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.onClearStore = function (cb) { + var _this = this; + this.clearStoreCallbacks.push(cb); + return function () { + _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { + return this.queryManager.reFetchObservableQueries(includeStandby); + }; + ApolloClient.prototype.refetchQueries = function (options) { + var map = this.queryManager.refetchQueries(options); + var queries = []; + var results = []; + map.forEach(function (result, obsQuery) { + queries.push(obsQuery); + results.push(result); + }); + var result = Promise.all(results); + result.queries = queries; + result.results = results; + result.catch(function (error) { + __DEV__ && globals.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error " + error); + }); + return result; + }; + ApolloClient.prototype.getObservableQueries = function (include) { + if (include === void 0) { include = "active"; } + return this.queryManager.getObservableQueries(include); + }; + ApolloClient.prototype.extract = function (optimistic) { + return this.cache.extract(optimistic); + }; + ApolloClient.prototype.restore = function (serializedState) { + return this.cache.restore(serializedState); + }; + ApolloClient.prototype.addResolvers = function (resolvers) { + this.localState.addResolvers(resolvers); + }; + ApolloClient.prototype.setResolvers = function (resolvers) { + this.localState.setResolvers(resolvers); + }; + ApolloClient.prototype.getResolvers = function () { + return this.localState.getResolvers(); + }; + ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { + this.localState.setFragmentMatcher(fragmentMatcher); + }; + ApolloClient.prototype.setLink = function (newLink) { + this.link = this.queryManager.link = newLink; + }; + return ApolloClient; +}()); + +tsInvariant.setVerbosity(globals.DEV ? "log" : "silent"); + +exports.Observable = utilities.Observable; +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.ApolloCache = cache.ApolloCache; +exports.Cache = cache.Cache; +exports.InMemoryCache = cache.InMemoryCache; +exports.MissingFieldError = cache.MissingFieldError; +exports.defaultDataIdFromObject = cache.defaultDataIdFromObject; +exports.makeVar = cache.makeVar; +exports.ApolloError = errors.ApolloError; +exports.isApolloError = errors.isApolloError; +exports.fromError = utils.fromError; +exports.fromPromise = utils.fromPromise; +exports.throwServerError = utils.throwServerError; +exports.toPromise = utils.toPromise; +exports.setLogVerbosity = tsInvariant.setVerbosity; +exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables; +exports.disableFragmentWarnings = graphqlTag.disableFragmentWarnings; +exports.enableExperimentalFragmentVariables = graphqlTag.enableExperimentalFragmentVariables; +exports.gql = graphqlTag.gql; +exports.resetCaches = graphqlTag.resetCaches; +exports.ApolloClient = ApolloClient; +exports.ObservableQuery = ObservableQuery; +exports.applyNextFetchPolicy = applyNextFetchPolicy; +exports.mergeOptions = mergeOptions; +Object.keys(core).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +}); +Object.keys(http).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = http[k]; +}); +//# sourceMappingURL=core.cjs.js.map + + +/***/ }), + +/***/ 81188: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var tslib = __nccwpck_require__(4351); +__nccwpck_require__(4035); +var utilities = __nccwpck_require__(56905); + +function isApolloError(err) { + return err.hasOwnProperty('graphQLErrors'); +} +var generateErrorMessage = function (err) { + var message = ''; + if (utilities.isNonEmptyArray(err.graphQLErrors) || utilities.isNonEmptyArray(err.clientErrors)) { + var errors = (err.graphQLErrors || []) + .concat(err.clientErrors || []); + errors.forEach(function (error) { + var errorMessage = error + ? error.message + : 'Error message not found.'; + message += errorMessage + "\n"; + }); + } + if (err.networkError) { + message += err.networkError.message + "\n"; + } + message = message.replace(/\n$/, ''); + return message; +}; +var ApolloError = (function (_super) { + tslib.__extends(ApolloError, _super); + function ApolloError(_a) { + var graphQLErrors = _a.graphQLErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; + var _this = _super.call(this, errorMessage) || this; + _this.graphQLErrors = graphQLErrors || []; + _this.clientErrors = clientErrors || []; + _this.networkError = networkError || null; + _this.message = errorMessage || generateErrorMessage(_this); + _this.extraInfo = extraInfo; + _this.__proto__ = ApolloError.prototype; + return _this; + } + return ApolloError; +}(Error)); + +exports.ApolloError = ApolloError; +exports.isApolloError = isApolloError; +//# sourceMappingURL=errors.cjs.js.map + + +/***/ }), + +/***/ 30090: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var tslib = __nccwpck_require__(4351); +var utilities = __nccwpck_require__(56905); +var utils = __nccwpck_require__(49288); + +function passthrough(op, forward) { + return (forward ? forward(op) : utilities.Observable.of()); +} +function toLink(handler) { + return typeof handler === 'function' ? new ApolloLink(handler) : handler; +} +function isTerminating(link) { + return link.request.length <= 1; +} +var LinkError = (function (_super) { + tslib.__extends(LinkError, _super); + function LinkError(message, link) { + var _this = _super.call(this, message) || this; + _this.link = link; + return _this; + } + return LinkError; +}(Error)); +var ApolloLink = (function () { + function ApolloLink(request) { + if (request) + this.request = request; + } + ApolloLink.empty = function () { + return new ApolloLink(function () { return utilities.Observable.of(); }); + }; + ApolloLink.from = function (links) { + if (links.length === 0) + return ApolloLink.empty(); + return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); + }; + ApolloLink.split = function (test, left, right) { + var leftLink = toLink(left); + var rightLink = toLink(right || new ApolloLink(passthrough)); + if (isTerminating(leftLink) && isTerminating(rightLink)) { + return new ApolloLink(function (operation) { + return test(operation) + ? leftLink.request(operation) || utilities.Observable.of() + : rightLink.request(operation) || utilities.Observable.of(); + }); + } + else { + return new ApolloLink(function (operation, forward) { + return test(operation) + ? leftLink.request(operation, forward) || utilities.Observable.of() + : rightLink.request(operation, forward) || utilities.Observable.of(); + }); + } + }; + ApolloLink.execute = function (link, operation) { + return (link.request(utils.createOperation(operation.context, utils.transformOperation(utils.validateOperation(operation)))) || utilities.Observable.of()); + }; + ApolloLink.concat = function (first, second) { + var firstLink = toLink(first); + if (isTerminating(firstLink)) { + __DEV__ && globals.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); + return firstLink; + } + var nextLink = toLink(second); + if (isTerminating(nextLink)) { + return new ApolloLink(function (operation) { + return firstLink.request(operation, function (op) { return nextLink.request(op) || utilities.Observable.of(); }) || utilities.Observable.of(); + }); + } + else { + return new ApolloLink(function (operation, forward) { + return (firstLink.request(operation, function (op) { + return nextLink.request(op, forward) || utilities.Observable.of(); + }) || utilities.Observable.of()); + }); + } + }; + ApolloLink.prototype.split = function (test, left, right) { + return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); + }; + ApolloLink.prototype.concat = function (next) { + return ApolloLink.concat(this, next); + }; + ApolloLink.prototype.request = function (operation, forward) { + throw __DEV__ ? new globals.InvariantError('request is not implemented') : new globals.InvariantError(21); + }; + ApolloLink.prototype.onError = function (error, observer) { + if (observer && observer.error) { + observer.error(error); + return false; + } + throw error; + }; + ApolloLink.prototype.setOnError = function (fn) { + this.onError = fn; + return this; + }; + return ApolloLink; +}()); + +var empty = ApolloLink.empty; + +var from = ApolloLink.from; + +var split = ApolloLink.split; + +var concat = ApolloLink.concat; + +var execute = ApolloLink.execute; + +exports.ApolloLink = ApolloLink; +exports.concat = concat; +exports.empty = empty; +exports.execute = execute; +exports.from = from; +exports.split = split; +//# sourceMappingURL=core.cjs.js.map + + +/***/ }), + +/***/ 24894: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var utils = __nccwpck_require__(49288); +var tslib = __nccwpck_require__(4351); +var graphql = __nccwpck_require__(16155); +var core = __nccwpck_require__(30090); +var utilities = __nccwpck_require__(56905); + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function parseAndCheckHttpResponse(operations) { + return function (response) { return response + .text() + .then(function (bodyText) { + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = 'ServerParseError'; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } + }) + .then(function (result) { + if (response.status >= 300) { + utils.throwServerError(response, result, "Response not successful: Received status code " + response.status); + } + if (!Array.isArray(result) && + !hasOwnProperty.call(result, 'data') && + !hasOwnProperty.call(result, 'errors')) { + utils.throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations) + ? operations.map(function (op) { return op.operationName; }) + : operations.operationName) + "'."); + } + return result; + }); }; +} + +var serializeFetchParameter = function (p, label) { + var serialized; + try { + serialized = JSON.stringify(p); + } + catch (e) { + var parseError = __DEV__ ? new globals.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new globals.InvariantError(23); + parseError.parseError = e; + throw parseError; + } + return serialized; +}; + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, +}; +var defaultHeaders = { + accept: '*/*', + 'content-type': 'application/json', +}; +var defaultOptions = { + method: 'POST', +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; +var selectHttpOptionsAndBody = function (operation, fallbackConfig) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + var options = tslib.__assign(tslib.__assign({}, fallbackConfig.options), { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials }); + var http = fallbackConfig.http || {}; + configs.forEach(function (config) { + options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), headersToLowerCase(config.headers)) }); + if (config.credentials) + options.credentials = config.credentials; + http = tslib.__assign(tslib.__assign({}, http), config.http); + }); + var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; + var body = { operationName: operationName, variables: variables }; + if (http.includeExtensions) + body.extensions = extensions; + if (http.includeQuery) + body.query = graphql.print(query); + return { + options: options, + body: body, + }; +}; +function headersToLowerCase(headers) { + if (headers) { + var normalized_1 = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + normalized_1[name.toLowerCase()] = headers[name]; + }); + return normalized_1; + } + return headers; +} + +var checkFetcher = function (fetcher) { + if (!fetcher && typeof fetch === 'undefined') { + throw __DEV__ ? new globals.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new globals.InvariantError(22); + } +}; + +var createSignalIfSupported = function () { + if (typeof AbortController === 'undefined') + return { controller: false, signal: false }; + var controller = new AbortController(); + var signal = controller.signal; + return { controller: controller, signal: signal }; +}; + +var selectURI = function (operation, fallbackURI) { + var context = operation.getContext(); + var contextURI = context.uri; + if (contextURI) { + return contextURI; + } + else if (typeof fallbackURI === 'function') { + return fallbackURI(operation); + } + else { + return fallbackURI || '/graphql'; + } +}; + +function rewriteURIForGET(chosenURI, body) { + var queryParams = []; + var addQueryParam = function (key, value) { + queryParams.push(key + "=" + encodeURIComponent(value)); + }; + if ('query' in body) { + addQueryParam('query', body.query); + } + if (body.operationName) { + addQueryParam('operationName', body.operationName); + } + if (body.variables) { + var serializedVariables = void 0; + try { + serializedVariables = serializeFetchParameter(body.variables, 'Variables map'); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam('variables', serializedVariables); + } + if (body.extensions) { + var serializedExtensions = void 0; + try { + serializedExtensions = serializeFetchParameter(body.extensions, 'Extensions map'); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam('extensions', serializedExtensions); + } + var fragment = '', preFragment = chosenURI; + var fragmentStart = chosenURI.indexOf('#'); + if (fragmentStart !== -1) { + fragment = chosenURI.substr(fragmentStart); + preFragment = chosenURI.substr(0, fragmentStart); + } + var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&'; + var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment; + return { newURI: newURI }; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +var createHttpLink = function (linkOptions) { + if (linkOptions === void 0) { linkOptions = {}; } + var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, _b = linkOptions.includeUnusedVariables, includeUnusedVariables = _b === void 0 ? false : _b, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "includeExtensions", "useGETForQueries", "includeUnusedVariables"]); + if (__DEV__) { + checkFetcher(preferredFetch || backupFetch); + } + var linkConfig = { + http: { includeExtensions: includeExtensions }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + return new core.ApolloLink(function (operation) { + var chosenURI = selectURI(operation, uri); + var context = operation.getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders['apollographql-client-name'] = name_1; + } + if (version) { + clientAwarenessHeaders['apollographql-client-version'] = version; + } + } + var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: contextHeaders, + }; + var _b = selectHttpOptionsAndBody(operation, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; + if (body.variables && !includeUnusedVariables) { + var unusedNames_1 = new Set(Object.keys(body.variables)); + graphql.visit(operation.query, { + Variable: function (node, _key, parent) { + if (parent && parent.kind !== 'VariableDefinition') { + unusedNames_1.delete(node.name.value); + } + }, + }); + if (unusedNames_1.size) { + body.variables = tslib.__assign({}, body.variables); + unusedNames_1.forEach(function (name) { + delete body.variables[name]; + }); + } + } + var controller; + if (!options.signal) { + var _c = createSignalIfSupported(), _controller = _c.controller, signal = _c.signal; + controller = _controller; + if (controller) + options.signal = signal; + } + var definitionIsMutation = function (d) { + return d.kind === 'OperationDefinition' && d.operation === 'mutation'; + }; + if (useGETForQueries && + !operation.query.definitions.some(definitionIsMutation)) { + options.method = 'GET'; + } + if (options.method === 'GET') { + var _d = rewriteURIForGET(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError; + if (parseError) { + return utils.fromError(parseError); + } + chosenURI = newURI; + } + else { + try { + options.body = serializeFetchParameter(body, 'Payload'); + } + catch (parseError) { + return utils.fromError(parseError); + } + } + return new utilities.Observable(function (observer) { + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + currentFetch(chosenURI, options) + .then(function (response) { + operation.setContext({ response: response }); + return response; + }) + .then(parseAndCheckHttpResponse(operation)) + .then(function (result) { + observer.next(result); + observer.complete(); + return result; + }) + .catch(function (err) { + if (err.name === 'AbortError') + return; + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }); +}; + +var HttpLink = (function (_super) { + tslib.__extends(HttpLink, _super); + function HttpLink(options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this, createHttpLink(options).request) || this; + _this.options = options; + return _this; + } + return HttpLink; +}(core.ApolloLink)); + +exports.HttpLink = HttpLink; +exports.checkFetcher = checkFetcher; +exports.createHttpLink = createHttpLink; +exports.createSignalIfSupported = createSignalIfSupported; +exports.fallbackHttpConfig = fallbackHttpConfig; +exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse; +exports.rewriteURIForGET = rewriteURIForGET; +exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody; +exports.selectURI = selectURI; +exports.serializeFetchParameter = serializeFetchParameter; +//# sourceMappingURL=http.cjs.js.map + + +/***/ }), + +/***/ 49288: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var utilities = __nccwpck_require__(56905); +var tslib = __nccwpck_require__(4351); + +function fromError(errorValue) { + return new utilities.Observable(function (observer) { + observer.error(errorValue); + }); +} + +function toPromise(observable) { + var completed = false; + return new Promise(function (resolve, reject) { + observable.subscribe({ + next: function (data) { + if (completed) { + __DEV__ && globals.invariant.warn("Promise Wrapper does not support multiple results from Observable"); + } + else { + completed = true; + resolve(data); + } + }, + error: reject, + }); + }); +} + +function fromPromise(promise) { + return new utilities.Observable(function (observer) { + promise + .then(function (value) { + observer.next(value); + observer.complete(); + }) + .catch(observer.error.bind(observer)); + }); +} + +var throwServerError = function (response, result, message) { + var error = new Error(message); + error.name = 'ServerError'; + error.response = response; + error.statusCode = response.status; + error.result = result; + throw error; +}; + +function validateOperation(operation) { + var OPERATION_FIELDS = [ + 'query', + 'operationName', + 'variables', + 'extensions', + 'context', + ]; + for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { + var key = _a[_i]; + if (OPERATION_FIELDS.indexOf(key) < 0) { + throw __DEV__ ? new globals.InvariantError("illegal argument: " + key) : new globals.InvariantError(26); + } + } + return operation; +} + +function createOperation(starting, operation) { + var context = tslib.__assign({}, starting); + var setContext = function (next) { + if (typeof next === 'function') { + context = tslib.__assign(tslib.__assign({}, context), next(context)); + } + else { + context = tslib.__assign(tslib.__assign({}, context), next); + } + }; + var getContext = function () { return (tslib.__assign({}, context)); }; + Object.defineProperty(operation, 'setContext', { + enumerable: false, + value: setContext, + }); + Object.defineProperty(operation, 'getContext', { + enumerable: false, + value: getContext, + }); + return operation; +} + +function transformOperation(operation) { + var transformedOperation = { + variables: operation.variables || {}, + extensions: operation.extensions || {}, + operationName: operation.operationName, + query: operation.query, + }; + if (!transformedOperation.operationName) { + transformedOperation.operationName = + typeof transformedOperation.query !== 'string' + ? utilities.getOperationName(transformedOperation.query) || undefined + : ''; + } + return transformedOperation; +} + +exports.createOperation = createOperation; +exports.fromError = fromError; +exports.fromPromise = fromPromise; +exports.throwServerError = throwServerError; +exports.toPromise = toPromise; +exports.transformOperation = transformOperation; +exports.validateOperation = validateOperation; +//# sourceMappingURL=utils.cjs.js.map + + +/***/ }), + +/***/ 86790: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var core = __nccwpck_require__(19900); +var react = __nccwpck_require__(90835); + + + +Object.keys(core).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +}); +Object.keys(react).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = react[k]; +}); +//# sourceMappingURL=main.cjs.js.map + + +/***/ }), + +/***/ 6981: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +(function (global, factory) { + true ? factory(exports, __nccwpck_require__(4351), __nccwpck_require__(16155)) : + 0; +}(this, (function (exports, tslib, graphql) { 'use strict'; + + var docCache = new Map(); + var fragmentSourceMap = new Map(); + var printFragmentWarnings = true; + var experimentalFragmentVariables = false; + function normalize(string) { + return string.replace(/[\s,]+/g, ' ').trim(); + } + function cacheKeyFromLoc(loc) { + return normalize(loc.source.body.substring(loc.start, loc.end)); + } + function processFragments(ast) { + var seenKeys = new Set(); + var definitions = []; + ast.definitions.forEach(function (fragmentDefinition) { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); + var sourceKeySet = fragmentSourceMap.get(fragmentName); + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } + else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + sourceKeySet.add(sourceKey); + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } + else { + definitions.push(fragmentDefinition); + } + }); + return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions }); + } + function stripLoc(doc) { + var workSet = new Set(doc.definitions); + workSet.forEach(function (node) { + if (node.loc) + delete node.loc; + Object.keys(node).forEach(function (key) { + var value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + var loc = doc.loc; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + return doc; + } + function parseDocument(source) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + var parsed = graphql.parse(source, { + experimentalFragmentVariables: experimentalFragmentVariables + }); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set(cacheKey, stripLoc(processFragments(parsed))); + } + return docCache.get(cacheKey); + } + function gql(literals) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof literals === 'string') { + literals = [literals]; + } + var result = literals[0]; + args.forEach(function (arg, i) { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } + else { + result += arg; + } + result += literals[i + 1]; + }); + return parseDocument(result); + } + function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); + } + function disableFragmentWarnings() { + printFragmentWarnings = false; + } + function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; + } + function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; + } + var extras = { + gql: gql, + resetCaches: resetCaches, + disableFragmentWarnings: disableFragmentWarnings, + enableExperimentalFragmentVariables: enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables: disableExperimentalFragmentVariables + }; + (function (gql_1) { + gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables; + })(gql || (gql = {})); + gql["default"] = gql; + var gql$1 = gql; + + exports.default = gql$1; + exports.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; + exports.disableFragmentWarnings = disableFragmentWarnings; + exports.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; + exports.gql = gql; + exports.resetCaches = resetCaches; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=graphql-tag.umd.js.map + + +/***/ }), + +/***/ 38246: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// For backwards compatibility, make sure require("graphql-tag") returns +// the gql function, rather than an exports object. +module.exports = __nccwpck_require__(6981).gql; + + +/***/ }), + +/***/ 22783: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +/* module decorator */ module = __nccwpck_require__.nmd(module); + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _ponyfill = __nccwpck_require__(73344); + +var _ponyfill2 = _interopRequireDefault(_ponyfill); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var root; /* global window */ + + +if (typeof self !== 'undefined') { + root = self; +} else if (typeof window !== 'undefined') { + root = window; +} else if (typeof global !== 'undefined') { + root = global; +} else if (true) { + root = module; +} else {} + +var result = (0, _ponyfill2['default'])(root); +exports.default = result; + +/***/ }), + +/***/ 73344: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = symbolObservablePonyfill; +function symbolObservablePonyfill(root) { + var result; + var _Symbol = root.Symbol; + + if (typeof _Symbol === 'function') { + if (_Symbol.observable) { + result = _Symbol.observable; + } else { + + if (typeof _Symbol['for'] === 'function') { + // This just needs to be something that won't trample other user's Symbol.for use + // It also will guide people to the source of their issues, if this is problematic. + // META: It's a resource locator! + result = _Symbol['for']('https://github.com/benlesh/symbol-observable'); + } else { + // Symbol.for didn't exist! The best we can do at this point is a totally + // unique symbol. Note that the string argument here is a descriptor, not + // an identifier. This symbol is unique. + result = _Symbol('https://github.com/benlesh/symbol-observable'); + } + try { + _Symbol.observable = result; + } catch (err) { + // Do nothing. In some environments, users have frozen `Symbol` for security reasons, + // if it is frozen assigning to it will throw. In this case, we don't care, because + // they will need to use the returned value from the ponyfill. + } + } + } else { + result = '@@observable'; + } + + return result; +}; + +/***/ }), + +/***/ 15641: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var tslib = __nccwpck_require__(4351); + +var genericMessage = "Invariant Violation"; +var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { + obj.__proto__ = proto; + return obj; +} : _a; +var InvariantError = /** @class */ (function (_super) { + tslib.__extends(InvariantError, _super); + function InvariantError(message) { + if (message === void 0) { message = genericMessage; } + var _this = _super.call(this, typeof message === "number" + ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" + : message) || this; + _this.framesToPop = 1; + _this.name = genericMessage; + setPrototypeOf(_this, InvariantError.prototype); + return _this; + } + return InvariantError; +}(Error)); +function invariant(condition, message) { + if (!condition) { + throw new InvariantError(message); + } +} +var verbosityLevels = ["debug", "log", "warn", "error", "silent"]; +var verbosityLevel = verbosityLevels.indexOf("log"); +function wrapConsoleMethod(name) { + return function () { + if (verbosityLevels.indexOf(name) >= verbosityLevel) { + // Default to console.log if this host environment happens not to provide + // all the console.* methods we need. + var method = console[name] || console.log; + return method.apply(console, arguments); + } + }; +} +(function (invariant) { + invariant.debug = wrapConsoleMethod("debug"); + invariant.log = wrapConsoleMethod("log"); + invariant.warn = wrapConsoleMethod("warn"); + invariant.error = wrapConsoleMethod("error"); +})(invariant || (invariant = {})); +function setVerbosity(level) { + var old = verbosityLevels[verbosityLevel]; + verbosityLevel = Math.max(0, verbosityLevels.indexOf(level)); + return old; +} +var invariant$1 = invariant; + +exports.InvariantError = InvariantError; +exports.default = invariant$1; +exports.invariant = invariant; +exports.setVerbosity = setVerbosity; +//# sourceMappingURL=invariant.js.map + + +/***/ }), + +/***/ 20770: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function maybe(thunk) { + try { return thunk() } catch (_) {} +} + +const safeGlobal = ( + maybe(function() { return globalThis }) || + maybe(function() { return window }) || + maybe(function() { return self }) || + maybe(function() { return global }) || + maybe(function() { return Function("return this")() }) +); + +let needToRemove = false; + +function install() { + if (safeGlobal && + !maybe(function() { return process.env.NODE_ENV }) && + !maybe(function() { return process })) { + Object.defineProperty(safeGlobal, "process", { + value: { + env: { + // This default needs to be "production" instead of "development", to + // avoid the problem https://github.com/graphql/graphql-js/pull/2894 + // will eventually solve, once merged and released. + NODE_ENV: "production", + }, + }, + // Let anyone else change global.process as they see fit, but hide it from + // Object.keys(global) enumeration. + configurable: true, + enumerable: false, + writable: true, + }); + needToRemove = true; + } +} + +// Call install() at least once, when this module is imported. +install(); + +function remove() { + if (needToRemove) { + delete safeGlobal.process; + needToRemove = false; + } +} + +exports.install = install; +exports.remove = remove; +//# sourceMappingURL=main.js.map + + +/***/ }), + +/***/ 62907: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var React = __nccwpck_require__(18444); +var utilities = __nccwpck_require__(56905); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + n[k] = e[k]; + }); + } + n['default'] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var cache = new (utilities.canUseWeakMap ? WeakMap : Map)(); +function getApolloContext() { + var context = cache.get(React__namespace.createContext); + if (!context) { + context = React__namespace.createContext({}); + context.displayName = 'ApolloContext'; + cache.set(React__namespace.createContext, context); + } + return context; +} + +var ApolloConsumer = function (props) { + var ApolloContext = getApolloContext(); + return React__namespace.createElement(ApolloContext.Consumer, null, function (context) { + __DEV__ ? globals.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + + 'Wrap the root component in an .') : globals.invariant(context && context.client, 27); + return props.children(context.client); + }); +}; + +var ApolloProvider = function (_a) { + var client = _a.client, children = _a.children; + var ApolloContext = getApolloContext(); + return React__namespace.createElement(ApolloContext.Consumer, null, function (context) { + if (context === void 0) { context = {}; } + if (client && context.client !== client) { + context = Object.assign({}, context, { client: client }); + } + __DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' + + 'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 28); + return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children)); + }); +}; + +exports.ApolloConsumer = ApolloConsumer; +exports.ApolloProvider = ApolloProvider; +exports.getApolloContext = getApolloContext; +exports.resetApolloContext = getApolloContext; +//# sourceMappingURL=context.cjs.js.map + + +/***/ }), + +/***/ 19309: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var tslib = __nccwpck_require__(4351); +var equality = __nccwpck_require__(9969); +var parser = __nccwpck_require__(25300); +var errors = __nccwpck_require__(81188); +var core = __nccwpck_require__(19900); + +var OperationData = (function () { + function OperationData(options, context) { + this.isMounted = false; + this.previousOptions = {}; + this.context = {}; + this.options = {}; + this.options = options || {}; + this.context = context || {}; + } + OperationData.prototype.getOptions = function () { + return this.options; + }; + OperationData.prototype.setOptions = function (newOptions, storePrevious) { + if (storePrevious === void 0) { storePrevious = false; } + if (storePrevious && !equality.equal(this.options, newOptions)) { + this.previousOptions = this.options; + } + this.options = newOptions; + }; + OperationData.prototype.unmount = function () { + this.isMounted = false; + }; + OperationData.prototype.refreshClient = function () { + var client = (this.options && this.options.client) || + (this.context && this.context.client); + __DEV__ ? globals.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' + + 'Wrap the root component in an , or pass an ' + + 'ApolloClient instance in via options.') : globals.invariant(!!client, 29); + var isNew = false; + if (client !== this.client) { + isNew = true; + this.client = client; + this.cleanup(); + } + return { + client: this.client, + isNew: isNew + }; + }; + OperationData.prototype.verifyDocumentType = function (document, type) { + var operation = parser.parser(document); + var requiredOperationName = parser.operationName(type); + var usedOperationName = parser.operationName(operation.type); + __DEV__ ? globals.invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + + (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : globals.invariant(operation.type === type, 30); + }; + return OperationData; +}()); + +var SubscriptionData = (function (_super) { + tslib.__extends(SubscriptionData, _super); + function SubscriptionData(_a) { + var options = _a.options, context = _a.context, setResult = _a.setResult; + var _this = _super.call(this, options, context) || this; + _this.currentObservable = {}; + _this.setResult = setResult; + _this.initialize(options); + return _this; + } + SubscriptionData.prototype.execute = function (result) { + if (this.getOptions().skip === true) { + this.cleanup(); + return { + loading: false, + error: undefined, + data: undefined, + variables: this.getOptions().variables + }; + } + var currentResult = result; + if (this.refreshClient().isNew) { + currentResult = this.getLoadingResult(); + } + var shouldResubscribe = this.getOptions().shouldResubscribe; + if (typeof shouldResubscribe === 'function') { + shouldResubscribe = !!shouldResubscribe(this.getOptions()); + } + if (shouldResubscribe !== false && + this.previousOptions && + Object.keys(this.previousOptions).length > 0 && + (this.previousOptions.subscription !== this.getOptions().subscription || + !equality.equal(this.previousOptions.variables, this.getOptions().variables) || + this.previousOptions.skip !== this.getOptions().skip)) { + this.cleanup(); + currentResult = this.getLoadingResult(); + } + this.initialize(this.getOptions()); + this.startSubscription(); + this.previousOptions = this.getOptions(); + return tslib.__assign(tslib.__assign({}, currentResult), { variables: this.getOptions().variables }); + }; + SubscriptionData.prototype.afterExecute = function () { + this.isMounted = true; + }; + SubscriptionData.prototype.cleanup = function () { + this.endSubscription(); + delete this.currentObservable.query; + }; + SubscriptionData.prototype.initialize = function (options) { + if (this.currentObservable.query || this.getOptions().skip === true) + return; + this.currentObservable.query = this.refreshClient().client.subscribe({ + query: options.subscription, + variables: options.variables, + fetchPolicy: options.fetchPolicy, + context: options.context, + }); + }; + SubscriptionData.prototype.startSubscription = function () { + if (this.currentObservable.subscription) + return; + this.currentObservable.subscription = this.currentObservable.query.subscribe({ + next: this.updateCurrentData.bind(this), + error: this.updateError.bind(this), + complete: this.completeSubscription.bind(this) + }); + }; + SubscriptionData.prototype.getLoadingResult = function () { + return { + loading: true, + error: undefined, + data: undefined + }; + }; + SubscriptionData.prototype.updateResult = function (result) { + if (this.isMounted) { + this.setResult(result); + } + }; + SubscriptionData.prototype.updateCurrentData = function (result) { + var onSubscriptionData = this.getOptions().onSubscriptionData; + this.updateResult({ + data: result.data, + loading: false, + error: undefined + }); + if (onSubscriptionData) { + onSubscriptionData({ + client: this.refreshClient().client, + subscriptionData: result + }); + } + }; + SubscriptionData.prototype.updateError = function (error) { + this.updateResult({ + error: error, + loading: false + }); + }; + SubscriptionData.prototype.completeSubscription = function () { + var _this = this; + Promise.resolve().then(function () { + var onSubscriptionComplete = _this.getOptions().onSubscriptionComplete; + if (onSubscriptionComplete) + onSubscriptionComplete(); + _this.endSubscription(); + }); + }; + SubscriptionData.prototype.endSubscription = function () { + if (this.currentObservable.subscription) { + this.currentObservable.subscription.unsubscribe(); + delete this.currentObservable.subscription; + } + }; + return SubscriptionData; +}(OperationData)); + +var MutationData = (function (_super) { + tslib.__extends(MutationData, _super); + function MutationData(_a) { + var options = _a.options, context = _a.context, result = _a.result, setResult = _a.setResult; + var _this = _super.call(this, options, context) || this; + _this.runMutation = function (mutationFunctionOptions) { + if (mutationFunctionOptions === void 0) { mutationFunctionOptions = {}; } + _this.onMutationStart(); + var mutationId = _this.generateNewMutationId(); + return _this.mutate(mutationFunctionOptions) + .then(function (response) { + _this.onMutationCompleted(response, mutationId); + return response; + }) + .catch(function (error) { + var onError = _this.getOptions().onError; + _this.onMutationError(error, mutationId); + if (onError) { + onError(error); + return { + data: undefined, + errors: error, + }; + } + else { + throw error; + } + }); + }; + _this.verifyDocumentType(options.mutation, parser.DocumentType.Mutation); + _this.result = result; + _this.setResult = setResult; + _this.mostRecentMutationId = 0; + return _this; + } + MutationData.prototype.execute = function (result) { + this.isMounted = true; + this.verifyDocumentType(this.getOptions().mutation, parser.DocumentType.Mutation); + return [ + this.runMutation, + tslib.__assign(tslib.__assign({}, result), { client: this.refreshClient().client }) + ]; + }; + MutationData.prototype.afterExecute = function () { + this.isMounted = true; + return this.unmount.bind(this); + }; + MutationData.prototype.cleanup = function () { + }; + MutationData.prototype.mutate = function (options) { + return this.refreshClient().client.mutate(core.mergeOptions(this.getOptions(), options)); + }; + MutationData.prototype.onMutationStart = function () { + if (!this.result.loading && !this.getOptions().ignoreResults) { + this.updateResult({ + loading: true, + error: undefined, + data: undefined, + called: true + }); + } + }; + MutationData.prototype.onMutationCompleted = function (response, mutationId) { + var _a = this.getOptions(), onCompleted = _a.onCompleted, ignoreResults = _a.ignoreResults; + var data = response.data, errors$1 = response.errors; + var error = errors$1 && errors$1.length > 0 + ? new errors.ApolloError({ graphQLErrors: errors$1 }) + : undefined; + var callOncomplete = function () { + return onCompleted ? onCompleted(data) : null; + }; + if (this.isMostRecentMutation(mutationId) && !ignoreResults) { + this.updateResult({ + called: true, + loading: false, + data: data, + error: error + }); + } + callOncomplete(); + }; + MutationData.prototype.onMutationError = function (error, mutationId) { + if (this.isMostRecentMutation(mutationId)) { + this.updateResult({ + loading: false, + error: error, + data: undefined, + called: true + }); + } + }; + MutationData.prototype.generateNewMutationId = function () { + return ++this.mostRecentMutationId; + }; + MutationData.prototype.isMostRecentMutation = function (mutationId) { + return this.mostRecentMutationId === mutationId; + }; + MutationData.prototype.updateResult = function (result) { + if (this.isMounted && + (!this.previousResult || !equality.equal(this.previousResult, result))) { + this.setResult(result); + this.previousResult = result; + return result; + } + }; + return MutationData; +}(OperationData)); + +var QueryData = (function (_super) { + tslib.__extends(QueryData, _super); + function QueryData(_a) { + var options = _a.options, context = _a.context, onNewData = _a.onNewData; + var _this = _super.call(this, options, context) || this; + _this.runLazy = false; + _this.previous = Object.create(null); + _this.runLazyQuery = function (options) { + _this.cleanup(); + _this.runLazy = true; + _this.lazyOptions = options; + _this.onNewData(); + }; + _this.obsRefetch = function (variables) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.refetch(variables); }; + _this.obsFetchMore = function (fetchMoreOptions) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.fetchMore(fetchMoreOptions); }; + _this.obsUpdateQuery = function (mapFn) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.updateQuery(mapFn); }; + _this.obsStartPolling = function (pollInterval) { + var _a; + (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.startPolling(pollInterval); + }; + _this.obsStopPolling = function () { + var _a; + (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.stopPolling(); + }; + _this.obsSubscribeToMore = function (options) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.subscribeToMore(options); }; + _this.onNewData = onNewData; + return _this; + } + QueryData.prototype.execute = function () { + this.refreshClient(); + var _a = this.getOptions(), skip = _a.skip, query = _a.query; + if (skip || query !== this.previous.query) { + this.removeQuerySubscription(); + this.removeObservable(!skip); + this.previous.query = query; + } + this.updateObservableQuery(); + return this.getExecuteSsrResult() || this.getExecuteResult(); + }; + QueryData.prototype.executeLazy = function () { + return !this.runLazy + ? [ + this.runLazyQuery, + { + loading: false, + networkStatus: core.NetworkStatus.ready, + called: false, + data: undefined + } + ] + : [this.runLazyQuery, this.execute()]; + }; + QueryData.prototype.fetchData = function () { + var _this = this; + var options = this.getOptions(); + if (options.skip || options.ssr === false) + return false; + return new Promise(function (resolve) { return _this.startQuerySubscription(resolve); }); + }; + QueryData.prototype.afterExecute = function (_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c; + this.isMounted = true; + var options = this.getOptions(); + if (this.currentObservable && !this.ssrInitiated()) { + this.startQuerySubscription(); + } + if (!lazy || this.runLazy) { + this.handleErrorOrCompleted(); + } + this.previousOptions = options; + return this.unmount.bind(this); + }; + QueryData.prototype.cleanup = function () { + this.removeQuerySubscription(); + this.removeObservable(true); + delete this.previous.result; + }; + QueryData.prototype.getOptions = function () { + var options = _super.prototype.getOptions.call(this); + if (this.lazyOptions) { + options.variables = tslib.__assign(tslib.__assign({}, options.variables), this.lazyOptions.variables); + options.context = tslib.__assign(tslib.__assign({}, options.context), this.lazyOptions.context); + } + if (this.runLazy) { + delete options.skip; + } + return options; + }; + QueryData.prototype.ssrInitiated = function () { + return this.context && this.context.renderPromises; + }; + QueryData.prototype.getExecuteSsrResult = function () { + var _a = this.getOptions(), ssr = _a.ssr, skip = _a.skip; + var ssrDisabled = ssr === false; + var fetchDisabled = this.refreshClient().client.disableNetworkFetches; + var ssrLoading = tslib.__assign({ loading: true, networkStatus: core.NetworkStatus.loading, called: true, data: undefined, stale: false, client: this.client }, this.observableQueryFields()); + if (ssrDisabled && (this.ssrInitiated() || fetchDisabled)) { + this.previous.result = ssrLoading; + return ssrLoading; + } + if (this.ssrInitiated()) { + var result = this.getExecuteResult() || ssrLoading; + if (result.loading && !skip) { + this.context.renderPromises.addQueryPromise(this, function () { return null; }); + } + return result; + } + }; + QueryData.prototype.prepareObservableQueryOptions = function () { + var options = this.getOptions(); + this.verifyDocumentType(options.query, parser.DocumentType.Query); + var displayName = options.displayName || 'Query'; + if (this.ssrInitiated() && + (options.fetchPolicy === 'network-only' || + options.fetchPolicy === 'cache-and-network')) { + options.fetchPolicy = 'cache-first'; + } + return tslib.__assign(tslib.__assign({}, options), { displayName: displayName, context: options.context }); + }; + QueryData.prototype.initializeObservableQuery = function () { + if (this.ssrInitiated()) { + this.currentObservable = this.context.renderPromises.getSSRObservable(this.getOptions()); + } + if (!this.currentObservable) { + var observableQueryOptions = this.prepareObservableQueryOptions(); + this.previous.observableQueryOptions = tslib.__assign(tslib.__assign({}, observableQueryOptions), { children: void 0 }); + this.currentObservable = this.refreshClient().client.watchQuery(tslib.__assign({}, observableQueryOptions)); + if (this.ssrInitiated()) { + this.context.renderPromises.registerSSRObservable(this.currentObservable, observableQueryOptions); + } + } + }; + QueryData.prototype.updateObservableQuery = function () { + if (!this.currentObservable) { + this.initializeObservableQuery(); + return; + } + var newObservableQueryOptions = tslib.__assign(tslib.__assign({}, this.prepareObservableQueryOptions()), { children: void 0 }); + if (this.getOptions().skip) { + this.previous.observableQueryOptions = newObservableQueryOptions; + return; + } + if (!equality.equal(newObservableQueryOptions, this.previous.observableQueryOptions)) { + this.previous.observableQueryOptions = newObservableQueryOptions; + this.currentObservable + .setOptions(newObservableQueryOptions) + .catch(function () { }); + } + }; + QueryData.prototype.startQuerySubscription = function (onNewData) { + var _this = this; + if (onNewData === void 0) { onNewData = this.onNewData; } + if (this.currentSubscription || this.getOptions().skip) + return; + this.currentSubscription = this.currentObservable.subscribe({ + next: function (_a) { + var loading = _a.loading, networkStatus = _a.networkStatus, data = _a.data; + var previousResult = _this.previous.result; + if (previousResult && + previousResult.loading === loading && + previousResult.networkStatus === networkStatus && + equality.equal(previousResult.data, data)) { + return; + } + onNewData(); + }, + error: function (error) { + _this.resubscribeToQuery(); + if (!error.hasOwnProperty('graphQLErrors')) + throw error; + var previousResult = _this.previous.result; + if ((previousResult && previousResult.loading) || + !equality.equal(error, _this.previous.error)) { + _this.previous.error = error; + onNewData(); + } + } + }); + }; + QueryData.prototype.resubscribeToQuery = function () { + this.removeQuerySubscription(); + var currentObservable = this.currentObservable; + if (currentObservable) { + var last = currentObservable["last"]; + try { + currentObservable.resetLastResults(); + this.startQuerySubscription(); + } + finally { + currentObservable["last"] = last; + } + } + }; + QueryData.prototype.getExecuteResult = function () { + var result = this.observableQueryFields(); + var options = this.getOptions(); + if (options.skip) { + result = tslib.__assign(tslib.__assign({}, result), { data: undefined, error: undefined, loading: false, networkStatus: core.NetworkStatus.ready, called: true }); + } + else if (this.currentObservable) { + var currentResult = this.currentObservable.getCurrentResult(); + var data = currentResult.data, loading = currentResult.loading, partial = currentResult.partial, networkStatus = currentResult.networkStatus, errors$1 = currentResult.errors; + var error = currentResult.error; + if (errors$1 && errors$1.length > 0) { + error = new errors.ApolloError({ graphQLErrors: errors$1 }); + } + result = tslib.__assign(tslib.__assign({}, result), { data: data, loading: loading, networkStatus: networkStatus, error: error, called: true }); + if (loading) ; + else if (error) { + Object.assign(result, { + data: (this.currentObservable.getLastResult() || {}) + .data + }); + } + else { + var fetchPolicy = this.currentObservable.options.fetchPolicy; + var partialRefetch = options.partialRefetch; + if (partialRefetch && + partial && + (!data || Object.keys(data).length === 0) && + fetchPolicy !== 'cache-only') { + Object.assign(result, { + loading: true, + networkStatus: core.NetworkStatus.loading + }); + result.refetch(); + return result; + } + } + } + result.client = this.client; + this.setOptions(options, true); + var previousResult = this.previous.result; + this.previous.loading = + previousResult && previousResult.loading || false; + result.previousData = previousResult && + (previousResult.data || previousResult.previousData); + this.previous.result = result; + this.currentObservable && this.currentObservable.resetQueryStoreErrors(); + return result; + }; + QueryData.prototype.handleErrorOrCompleted = function () { + if (!this.currentObservable || !this.previous.result) + return; + var _a = this.previous.result, data = _a.data, loading = _a.loading, error = _a.error; + if (!loading) { + var _b = this.getOptions(), query = _b.query, variables = _b.variables, onCompleted = _b.onCompleted, onError = _b.onError, skip = _b.skip; + if (this.previousOptions && + !this.previous.loading && + equality.equal(this.previousOptions.query, query) && + equality.equal(this.previousOptions.variables, variables)) { + return; + } + if (onCompleted && !error && !skip) { + onCompleted(data); + } + else if (onError && error) { + onError(error); + } + } + }; + QueryData.prototype.removeQuerySubscription = function () { + if (this.currentSubscription) { + this.currentSubscription.unsubscribe(); + delete this.currentSubscription; + } + }; + QueryData.prototype.removeObservable = function (andDelete) { + if (this.currentObservable) { + this.currentObservable["tearDownQuery"](); + if (andDelete) { + delete this.currentObservable; + } + } + }; + QueryData.prototype.observableQueryFields = function () { + var _a; + return { + variables: (_a = this.currentObservable) === null || _a === void 0 ? void 0 : _a.variables, + refetch: this.obsRefetch, + fetchMore: this.obsFetchMore, + updateQuery: this.obsUpdateQuery, + startPolling: this.obsStartPolling, + stopPolling: this.obsStopPolling, + subscribeToMore: this.obsSubscribeToMore + }; + }; + return QueryData; +}(OperationData)); + +exports.MutationData = MutationData; +exports.OperationData = OperationData; +exports.QueryData = QueryData; +exports.SubscriptionData = SubscriptionData; +//# sourceMappingURL=data.cjs.js.map + + +/***/ }), + +/***/ 55873: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var React = __nccwpck_require__(18444); +var context = __nccwpck_require__(62907); +var tslib = __nccwpck_require__(4351); +var data = __nccwpck_require__(19309); +var equality = __nccwpck_require__(9969); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + n[k] = e[k]; + }); + } + n['default'] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +function useApolloClient() { + var client = React__namespace.useContext(context.getApolloContext()).client; + __DEV__ ? globals.invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' + + 'have called `ApolloProvider` higher up in your tree.') : globals.invariant(client, 33); + return client; +} + +function useDeepMemo(memoFn, key) { + var ref = React.useRef(); + if (!ref.current || !equality.equal(key, ref.current.key)) { + ref.current = { key: key, value: memoFn() }; + } + return ref.current.value; +} + +function useAfterFastRefresh(effectFn) { + if (__DEV__) { + var didRefresh_1 = React.useRef(false); + React.useEffect(function () { + return function () { + didRefresh_1.current = true; + }; + }, []); + React.useEffect(function () { + if (didRefresh_1.current === true) { + didRefresh_1.current = false; + effectFn(); + } + }, []); + } +} + +function useBaseQuery(query, options, lazy) { + if (lazy === void 0) { lazy = false; } + var context$1 = React.useContext(context.getApolloContext()); + var _a = React.useReducer(function (x) { return x + 1; }, 0), tick = _a[0], forceUpdate = _a[1]; + var updatedOptions = options ? tslib.__assign(tslib.__assign({}, options), { query: query }) : { query: query }; + var queryDataRef = React.useRef(); + var queryData = queryDataRef.current || (queryDataRef.current = new data.QueryData({ + options: updatedOptions, + context: context$1, + onNewData: function () { + if (!queryData.ssrInitiated()) { + Promise.resolve().then(function () { return queryDataRef.current && queryDataRef.current.isMounted && forceUpdate(); }); + } + else { + forceUpdate(); + } + } + })); + queryData.setOptions(updatedOptions); + queryData.context = context$1; + var memo = { + options: tslib.__assign(tslib.__assign({}, updatedOptions), { onError: void 0, onCompleted: void 0 }), + context: context$1, + tick: tick + }; + var result = useDeepMemo(function () { return (lazy ? queryData.executeLazy() : queryData.execute()); }, memo); + var queryResult = lazy + ? result[1] + : result; + if (__DEV__) { + useAfterFastRefresh(forceUpdate); + } + React.useEffect(function () { + return function () { + queryData.cleanup(); + queryDataRef.current = void 0; + }; + }, []); + React.useEffect(function () { return queryData.afterExecute({ lazy: lazy }); }, [ + queryResult.loading, + queryResult.networkStatus, + queryResult.error, + queryResult.data, + queryData.currentObservable, + ]); + return result; +} + +function useLazyQuery(query, options) { + return useBaseQuery(query, options, true); +} + +function useMutation(mutation, options) { + var context$1 = React.useContext(context.getApolloContext()); + var _a = React.useState({ called: false, loading: false }), result = _a[0], setResult = _a[1]; + var updatedOptions = options ? tslib.__assign(tslib.__assign({}, options), { mutation: mutation }) : { mutation: mutation }; + var mutationDataRef = React.useRef(); + function getMutationDataRef() { + if (!mutationDataRef.current) { + mutationDataRef.current = new data.MutationData({ + options: updatedOptions, + context: context$1, + result: result, + setResult: setResult + }); + } + return mutationDataRef.current; + } + var mutationData = getMutationDataRef(); + mutationData.setOptions(updatedOptions); + mutationData.context = context$1; + React.useEffect(function () { return mutationData.afterExecute(); }); + return mutationData.execute(result); +} + +function useQuery(query, options) { + return useBaseQuery(query, options, false); +} + +function useSubscription(subscription, options) { + var _a = React.useReducer(function (x) { return x + 1; }, 0), forceUpdate = _a[1]; + var context$1 = React.useContext(context.getApolloContext()); + var updatedOptions = options + ? tslib.__assign(tslib.__assign({}, options), { subscription: subscription }) : { subscription: subscription }; + var _b = React.useState({ + loading: !updatedOptions.skip, + error: void 0, + data: void 0, + }), result = _b[0], setResult = _b[1]; + var subscriptionDataRef = React.useRef(); + function getSubscriptionDataRef() { + if (!subscriptionDataRef.current) { + subscriptionDataRef.current = new data.SubscriptionData({ + options: updatedOptions, + context: context$1, + setResult: setResult + }); + } + return subscriptionDataRef.current; + } + var subscriptionData = getSubscriptionDataRef(); + subscriptionData.setOptions(updatedOptions, true); + subscriptionData.context = context$1; + if (__DEV__) { + useAfterFastRefresh(forceUpdate); + } + React.useEffect(function () { return subscriptionData.afterExecute(); }); + React.useEffect(function () { + return function () { + subscriptionData.cleanup(); + subscriptionDataRef.current = void 0; + }; + }, []); + return subscriptionData.execute(result); +} + +function useReactiveVar(rv) { + var value = rv(); + var setValue = React.useState(value)[1]; + React.useEffect(function () { + var probablySameValue = rv(); + if (value !== probablySameValue) { + setValue(probablySameValue); + } + else { + return rv.onNextChange(setValue); + } + }, [value]); + return value; +} + +exports.useApolloClient = useApolloClient; +exports.useLazyQuery = useLazyQuery; +exports.useMutation = useMutation; +exports.useQuery = useQuery; +exports.useReactiveVar = useReactiveVar; +exports.useSubscription = useSubscription; +//# sourceMappingURL=hooks.cjs.js.map + + +/***/ }), + +/***/ 25300: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); + +exports.DocumentType = void 0; +(function (DocumentType) { + DocumentType[DocumentType["Query"] = 0] = "Query"; + DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; + DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; +})(exports.DocumentType || (exports.DocumentType = {})); +var cache = new Map(); +function operationName(type) { + var name; + switch (type) { + case exports.DocumentType.Query: + name = 'Query'; + break; + case exports.DocumentType.Mutation: + name = 'Mutation'; + break; + case exports.DocumentType.Subscription: + name = 'Subscription'; + break; + } + return name; +} +function parser(document) { + var cached = cache.get(document); + if (cached) + return cached; + var variables, type, name; + __DEV__ ? globals.invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + + "DocumentNode. You may need to use 'graphql-tag' or another method " + + "to convert your operation into a document") : globals.invariant(!!document && !!document.kind, 34); + var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; }); + var queries = document.definitions.filter(function (x) { + return x.kind === 'OperationDefinition' && x.operation === 'query'; + }); + var mutations = document.definitions.filter(function (x) { + return x.kind === 'OperationDefinition' && x.operation === 'mutation'; + }); + var subscriptions = document.definitions.filter(function (x) { + return x.kind === 'OperationDefinition' && x.operation === 'subscription'; + }); + __DEV__ ? globals.invariant(!fragments.length || + (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " + + "You must include a query, subscription or mutation as well") : globals.invariant(!fragments.length || + (queries.length || mutations.length || subscriptions.length), 35); + __DEV__ ? globals.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + + (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + + ("subscriptions and " + mutations.length + " mutations. ") + + "You can use 'compose' to join multiple operation types to a component") : globals.invariant(queries.length + mutations.length + subscriptions.length <= 1, 36); + type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation; + if (!queries.length && !mutations.length) + type = exports.DocumentType.Subscription; + var definitions = queries.length + ? queries + : mutations.length + ? mutations + : subscriptions; + __DEV__ ? globals.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + + (definitions.length + " definitions. ") + + "You can use 'compose' to join multiple operation types to a component") : globals.invariant(definitions.length === 1, 37); + var definition = definitions[0]; + variables = definition.variableDefinitions || []; + if (definition.name && definition.name.kind === 'Name') { + name = definition.name.value; + } + else { + name = 'data'; + } + var payload = { name: name, type: type, variables: variables }; + cache.set(document, payload); + return payload; +} + +exports.operationName = operationName; +exports.parser = parser; +//# sourceMappingURL=parser.cjs.js.map + + +/***/ }), + +/***/ 90835: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +__nccwpck_require__(4035); +var context = __nccwpck_require__(62907); +var hooks = __nccwpck_require__(55873); +var parser = __nccwpck_require__(25300); + + + +exports.ApolloConsumer = context.ApolloConsumer; +exports.ApolloProvider = context.ApolloProvider; +exports.getApolloContext = context.getApolloContext; +exports.resetApolloContext = context.resetApolloContext; +exports.DocumentType = parser.DocumentType; +exports.operationName = parser.operationName; +exports.parser = parser.parser; +Object.keys(hooks).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = hooks[k]; +}); +//# sourceMappingURL=react.cjs.js.map + + +/***/ }), + +/***/ 4035: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var tsInvariant = __nccwpck_require__(15641); +var process$1 = __nccwpck_require__(20770); +var graphql = __nccwpck_require__(16155); + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || + maybe(function () { return Function("return this")(); })); + +var __ = "__"; +var GLOBAL_KEY = [__, __].join("DEV"); +function getDEV() { + try { + return Boolean(__DEV__); + } + catch (_a) { + Object.defineProperty(global$1, GLOBAL_KEY, { + value: maybe(function () { return process.env.NODE_ENV; }) !== "production", + enumerable: false, + configurable: true, + writable: true, + }); + return global$1[GLOBAL_KEY]; + } +} +var DEV = getDEV(); + +function removeTemporaryGlobals() { + graphql.isType(null); + return process$1.remove(); +} + +function checkDEV() { + __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38); +} +removeTemporaryGlobals(); + +exports.InvariantError = tsInvariant.InvariantError; +exports.invariant = tsInvariant.invariant; +exports.DEV = DEV; +exports.checkDEV = checkDEV; +exports.global = global$1; +exports.maybe = maybe; +//# sourceMappingURL=globals.cjs.js.map + + +/***/ }), + +/***/ 56905: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var globals = __nccwpck_require__(4035); +var graphql = __nccwpck_require__(16155); +var tslib = __nccwpck_require__(4351); +var zenObservableTs = __nccwpck_require__(36589); +__nccwpck_require__(22783); + +function shouldInclude(_a, variables) { + var directives = _a.directives; + if (!directives || !directives.length) { + return true; + } + return getInclusionDirectives(directives).every(function (_a) { + var directive = _a.directive, ifArgument = _a.ifArgument; + var evaledValue = false; + if (ifArgument.value.kind === 'Variable') { + evaledValue = variables && variables[ifArgument.value.name.value]; + __DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : globals.invariant(evaledValue !== void 0, 39); + } + else { + evaledValue = ifArgument.value.value; + } + return directive.name.value === 'skip' ? !evaledValue : evaledValue; + }); +} +function getDirectiveNames(root) { + var names = []; + graphql.visit(root, { + Directive: function (node) { + names.push(node.name.value); + }, + }); + return names; +} +function hasDirectives(names, root) { + return getDirectiveNames(root).some(function (name) { return names.indexOf(name) > -1; }); +} +function hasClientExports(document) { + return (document && + hasDirectives(['client'], document) && + hasDirectives(['export'], document)); +} +function isInclusionDirective(_a) { + var value = _a.name.value; + return value === 'skip' || value === 'include'; +} +function getInclusionDirectives(directives) { + var result = []; + if (directives && directives.length) { + directives.forEach(function (directive) { + if (!isInclusionDirective(directive)) + return; + var directiveArguments = directive.arguments; + var directiveName = directive.name.value; + __DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : globals.invariant(directiveArguments && directiveArguments.length === 1, 40); + var ifArgument = directiveArguments[0]; + __DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 41); + var ifValue = ifArgument.value; + __DEV__ ? globals.invariant(ifValue && + (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : globals.invariant(ifValue && + (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42); + result.push({ directive: directive, ifArgument: ifArgument }); + }); + } + return result; +} + +function getFragmentQueryDocument(document, fragmentName) { + var actualFragmentName = fragmentName; + var fragments = []; + document.definitions.forEach(function (definition) { + if (definition.kind === 'OperationDefinition') { + throw __DEV__ ? new globals.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(43); + } + if (definition.kind === 'FragmentDefinition') { + fragments.push(definition); + } + }); + if (typeof actualFragmentName === 'undefined') { + __DEV__ ? globals.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : globals.invariant(fragments.length === 1, 44); + actualFragmentName = fragments[0].name.value; + } + var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([ + { + kind: 'OperationDefinition', + operation: 'query', + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: actualFragmentName, + }, + }, + ], + }, + } + ], document.definitions) }); + return query; +} +function createFragmentMap(fragments) { + if (fragments === void 0) { fragments = []; } + var symTable = {}; + fragments.forEach(function (fragment) { + symTable[fragment.name.value] = fragment; + }); + return symTable; +} +function getFragmentFromSelection(selection, fragmentMap) { + switch (selection.kind) { + case 'InlineFragment': + return selection; + case 'FragmentSpread': { + var fragment = fragmentMap && fragmentMap[selection.name.value]; + __DEV__ ? globals.invariant(fragment, "No fragment named " + selection.name.value + ".") : globals.invariant(fragment, 45); + return fragment; + } + default: + return null; + } +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === 'object'; +} + +function makeReference(id) { + return { __ref: String(id) }; +} +function isReference(obj) { + return Boolean(obj && typeof obj === 'object' && typeof obj.__ref === 'string'); +} +function isDocumentNode(value) { + return (isNonNullObject(value) && + value.kind === "Document" && + Array.isArray(value.definitions)); +} +function isStringValue(value) { + return value.kind === 'StringValue'; +} +function isBooleanValue(value) { + return value.kind === 'BooleanValue'; +} +function isIntValue(value) { + return value.kind === 'IntValue'; +} +function isFloatValue(value) { + return value.kind === 'FloatValue'; +} +function isVariable(value) { + return value.kind === 'Variable'; +} +function isObjectValue(value) { + return value.kind === 'ObjectValue'; +} +function isListValue(value) { + return value.kind === 'ListValue'; +} +function isEnumValue(value) { + return value.kind === 'EnumValue'; +} +function isNullValue(value) { + return value.kind === 'NullValue'; +} +function valueToObjectRepresentation(argObj, name, value, variables) { + if (isIntValue(value) || isFloatValue(value)) { + argObj[name.value] = Number(value.value); + } + else if (isBooleanValue(value) || isStringValue(value)) { + argObj[name.value] = value.value; + } + else if (isObjectValue(value)) { + var nestedArgObj_1 = {}; + value.fields.map(function (obj) { + return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); + }); + argObj[name.value] = nestedArgObj_1; + } + else if (isVariable(value)) { + var variableValue = (variables || {})[value.name.value]; + argObj[name.value] = variableValue; + } + else if (isListValue(value)) { + argObj[name.value] = value.values.map(function (listValue) { + var nestedArgArrayObj = {}; + valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); + return nestedArgArrayObj[name.value]; + }); + } + else if (isEnumValue(value)) { + argObj[name.value] = value.value; + } + else if (isNullValue(value)) { + argObj[name.value] = null; + } + else { + throw __DEV__ ? new globals.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + + 'is not supported. Use variables instead of inline arguments to ' + + 'overcome this limitation.') : new globals.InvariantError(54); + } +} +function storeKeyNameFromField(field, variables) { + var directivesObj = null; + if (field.directives) { + directivesObj = {}; + field.directives.forEach(function (directive) { + directivesObj[directive.name.value] = {}; + if (directive.arguments) { + directive.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); + }); + } + }); + } + var argObj = null; + if (field.arguments && field.arguments.length) { + argObj = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj, name, value, variables); + }); + } + return getStoreKeyName(field.name.value, argObj, directivesObj); +} +var KNOWN_DIRECTIVES = [ + 'connection', + 'include', + 'skip', + 'client', + 'rest', + 'export', +]; +var getStoreKeyName = Object.assign(function (fieldName, args, directives) { + if (args && + directives && + directives['connection'] && + directives['connection']['key']) { + if (directives['connection']['filter'] && + directives['connection']['filter'].length > 0) { + var filterKeys = directives['connection']['filter'] + ? directives['connection']['filter'] + : []; + filterKeys.sort(); + var filteredArgs_1 = {}; + filterKeys.forEach(function (key) { + filteredArgs_1[key] = args[key]; + }); + return directives['connection']['key'] + "(" + stringify(filteredArgs_1) + ")"; + } + else { + return directives['connection']['key']; + } + } + var completeFieldName = fieldName; + if (args) { + var stringifiedArgs = stringify(args); + completeFieldName += "(" + stringifiedArgs + ")"; + } + if (directives) { + Object.keys(directives).forEach(function (key) { + if (KNOWN_DIRECTIVES.indexOf(key) !== -1) + return; + if (directives[key] && Object.keys(directives[key]).length) { + completeFieldName += "@" + key + "(" + stringify(directives[key]) + ")"; + } + else { + completeFieldName += "@" + key; + } + }); + } + return completeFieldName; +}, { + setStringify: function (s) { + var previous = stringify; + stringify = s; + return previous; + }, +}); +var stringify = function defaultStringify(value) { + return JSON.stringify(value, stringifyReplacer); +}; +function stringifyReplacer(_key, value) { + if (isNonNullObject(value) && !Array.isArray(value)) { + value = Object.keys(value).sort().reduce(function (copy, key) { + copy[key] = value[key]; + return copy; + }, {}); + } + return value; +} +function argumentsObjectFromField(field, variables) { + if (field.arguments && field.arguments.length) { + var argObj_1 = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj_1, name, value, variables); + }); + return argObj_1; + } + return null; +} +function resultKeyNameFromField(field) { + return field.alias ? field.alias.value : field.name.value; +} +function getTypenameFromResult(result, selectionSet, fragmentMap) { + if (typeof result.__typename === 'string') { + return result.__typename; + } + for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { + var selection = _a[_i]; + if (isField(selection)) { + if (selection.name.value === '__typename') { + return result[resultKeyNameFromField(selection)]; + } + } + else { + var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap); + if (typeof typename === 'string') { + return typename; + } + } + } +} +function isField(selection) { + return selection.kind === 'Field'; +} +function isInlineFragment(selection) { + return selection.kind === 'InlineFragment'; +} + +function checkDocument(doc) { + __DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 46); + var operations = doc.definitions + .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) + .map(function (definition) { + if (definition.kind !== 'OperationDefinition') { + throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new globals.InvariantError(47); + } + return definition; + }); + __DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : globals.invariant(operations.length <= 1, 48); + return doc; +} +function getOperationDefinition(doc) { + checkDocument(doc); + return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; +} +function getOperationName(doc) { + return (doc.definitions + .filter(function (definition) { + return definition.kind === 'OperationDefinition' && definition.name; + }) + .map(function (x) { return x.name.value; })[0] || null); +} +function getFragmentDefinitions(doc) { + return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); +} +function getQueryDefinition(doc) { + var queryDef = getOperationDefinition(doc); + __DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 49); + return queryDef; +} +function getFragmentDefinition(doc) { + __DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 50); + __DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 51); + var fragmentDef = doc.definitions[0]; + __DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 52); + return fragmentDef; +} +function getMainDefinition(queryDoc) { + checkDocument(queryDoc); + var fragmentDefinition; + for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { + var definition = _a[_i]; + if (definition.kind === 'OperationDefinition') { + var operation = definition.operation; + if (operation === 'query' || + operation === 'mutation' || + operation === 'subscription') { + return definition; + } + } + if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { + fragmentDefinition = definition; + } + } + if (fragmentDefinition) { + return fragmentDefinition; + } + throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(53); +} +function getDefaultValues(definition) { + var defaultValues = Object.create(null); + var defs = definition && definition.variableDefinitions; + if (defs && defs.length) { + defs.forEach(function (def) { + if (def.defaultValue) { + valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue); + } + }); + } + return defaultValues; +} + +function filterInPlace(array, test, context) { + var target = 0; + array.forEach(function (elem, i) { + if (test.call(this, elem, i, array)) { + array[target++] = elem; + } + }, context); + array.length = target; + return array; +} + +var TYPENAME_FIELD = { + kind: 'Field', + name: { + kind: 'Name', + value: '__typename', + }, +}; +function isEmpty(op, fragments) { + return op.selectionSet.selections.every(function (selection) { + return selection.kind === 'FragmentSpread' && + isEmpty(fragments[selection.name.value], fragments); + }); +} +function nullIfDocIsEmpty(doc) { + return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) + ? null + : doc; +} +function getDirectiveMatcher(directives) { + return function directiveMatcher(directive) { + return directives.some(function (dir) { + return (dir.name && dir.name === directive.name.value) || + (dir.test && dir.test(directive)); + }); + }; +} +function removeDirectivesFromDocument(directives, doc) { + var variablesInUse = Object.create(null); + var variablesToRemove = []; + var fragmentSpreadsInUse = Object.create(null); + var fragmentSpreadsToRemove = []; + var modifiedDoc = nullIfDocIsEmpty(graphql.visit(doc, { + Variable: { + enter: function (node, _key, parent) { + if (parent.kind !== 'VariableDefinition') { + variablesInUse[node.name.value] = true; + } + }, + }, + Field: { + enter: function (node) { + if (directives && node.directives) { + var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); + if (shouldRemoveField && + node.directives && + node.directives.some(getDirectiveMatcher(directives))) { + if (node.arguments) { + node.arguments.forEach(function (arg) { + if (arg.value.kind === 'Variable') { + variablesToRemove.push({ + name: arg.value.name.value, + }); + } + }); + } + if (node.selectionSet) { + getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { + fragmentSpreadsToRemove.push({ + name: frag.name.value, + }); + }); + } + return null; + } + } + }, + }, + FragmentSpread: { + enter: function (node) { + fragmentSpreadsInUse[node.name.value] = true; + }, + }, + Directive: { + enter: function (node) { + if (getDirectiveMatcher(directives)(node)) { + return null; + } + }, + }, + })); + if (modifiedDoc && + filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) { + modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); + } + if (modifiedDoc && + filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; }) + .length) { + modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); + } + return modifiedDoc; +} +var addTypenameToDocument = Object.assign(function (doc) { + return graphql.visit(checkDocument(doc), { + SelectionSet: { + enter: function (node, _key, parent) { + if (parent && + parent.kind === 'OperationDefinition') { + return; + } + var selections = node.selections; + if (!selections) { + return; + } + var skip = selections.some(function (selection) { + return (isField(selection) && + (selection.name.value === '__typename' || + selection.name.value.lastIndexOf('__', 0) === 0)); + }); + if (skip) { + return; + } + var field = parent; + if (isField(field) && + field.directives && + field.directives.some(function (d) { return d.name.value === 'export'; })) { + return; + } + return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections), [TYPENAME_FIELD]) }); + }, + }, + }); +}, { + added: function (field) { + return field === TYPENAME_FIELD; + }, +}); +var connectionRemoveConfig = { + test: function (directive) { + var willRemove = directive.name.value === 'connection'; + if (willRemove) { + if (!directive.arguments || + !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { + __DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' + + 'You may want to use the key parameter to specify a store key.'); + } + } + return willRemove; + }, +}; +function removeConnectionDirectiveFromDocument(doc) { + return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); +} +function getArgumentMatcher(config) { + return function argumentMatcher(argument) { + return config.some(function (aConfig) { + return argument.value && + argument.value.kind === 'Variable' && + argument.value.name && + (aConfig.name === argument.value.name.value || + (aConfig.test && aConfig.test(argument))); + }); + }; +} +function removeArgumentsFromDocument(config, doc) { + var argMatcher = getArgumentMatcher(config); + return nullIfDocIsEmpty(graphql.visit(doc, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) { + return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); + }) : [] }); + }, + }, + Field: { + enter: function (node) { + var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); + if (shouldRemoveField) { + var argMatchCount_1 = 0; + if (node.arguments) { + node.arguments.forEach(function (arg) { + if (argMatcher(arg)) { + argMatchCount_1 += 1; + } + }); + } + if (argMatchCount_1 === 1) { + return null; + } + } + }, + }, + Argument: { + enter: function (node) { + if (argMatcher(node)) { + return null; + } + }, + }, + })); +} +function removeFragmentSpreadFromDocument(config, doc) { + function enter(node) { + if (config.some(function (def) { return def.name === node.name.value; })) { + return null; + } + } + return nullIfDocIsEmpty(graphql.visit(doc, { + FragmentSpread: { enter: enter }, + FragmentDefinition: { enter: enter }, + })); +} +function getAllFragmentSpreadsFromSelectionSet(selectionSet) { + var allFragments = []; + selectionSet.selections.forEach(function (selection) { + if ((isField(selection) || isInlineFragment(selection)) && + selection.selectionSet) { + getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); + } + else if (selection.kind === 'FragmentSpread') { + allFragments.push(selection); + } + }); + return allFragments; +} +function buildQueryFromSelectionSet(document) { + var definition = getMainDefinition(document); + var definitionOperation = definition.operation; + if (definitionOperation === 'query') { + return document; + } + var modifiedDoc = graphql.visit(document, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { operation: 'query' }); + }, + }, + }); + return modifiedDoc; +} +function removeClientSetsFromDocument(document) { + checkDocument(document); + var modifiedDoc = removeDirectivesFromDocument([ + { + test: function (directive) { return directive.name.value === 'client'; }, + remove: true, + }, + ], document); + if (modifiedDoc) { + modifiedDoc = graphql.visit(modifiedDoc, { + FragmentDefinition: { + enter: function (node) { + if (node.selectionSet) { + var isTypenameOnly = node.selectionSet.selections.every(function (selection) { + return isField(selection) && selection.name.value === '__typename'; + }); + if (isTypenameOnly) { + return null; + } + } + }, + }, + }); + } + return modifiedDoc; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function mergeDeep() { + var sources = []; + for (var _i = 0; _i < arguments.length; _i++) { + sources[_i] = arguments[_i]; + } + return mergeDeepArray(sources); +} +function mergeDeepArray(sources) { + var target = sources[0] || {}; + var count = sources.length; + if (count > 1) { + var merger = new DeepMerger(); + for (var i = 1; i < count; ++i) { + target = merger.merge(target, sources[i]); + } + } + return target; +} +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value) && !this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + return value; + }; + return DeepMerger; +}()); + +function concatPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming) { + return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing), incoming) : incoming; + }, + }; +} +function offsetLimitPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming, _a) { + var args = _a.args; + var merged = existing ? existing.slice(0) : []; + if (args) { + var _b = args.offset, offset = _b === void 0 ? 0 : _b; + for (var i = 0; i < incoming.length; ++i) { + merged[offset + i] = incoming[i]; + } + } + else { + merged.push.apply(merged, incoming); + } + return merged; + }, + }; +} +function relayStylePagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + read: function (existing, _a) { + var canRead = _a.canRead, readField = _a.readField; + if (!existing) + return; + var edges = []; + var firstEdgeCursor = ""; + var lastEdgeCursor = ""; + existing.edges.forEach(function (edge) { + if (canRead(readField("node", edge))) { + edges.push(edge); + if (edge.cursor) { + firstEdgeCursor = firstEdgeCursor || edge.cursor || ""; + lastEdgeCursor = edge.cursor || lastEdgeCursor; + } + } + }); + var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor; + return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) }); + }, + merge: function (existing, incoming, _a) { + if (existing === void 0) { existing = makeEmptyData(); } + var args = _a.args, isReference = _a.isReference, readField = _a.readField; + var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) { + if (isReference(edge = tslib.__assign({}, edge))) { + edge.cursor = readField("cursor", edge); + } + return edge; + }) : []; + if (incoming.pageInfo) { + var pageInfo_1 = incoming.pageInfo; + var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor; + var firstEdge = incomingEdges[0]; + var lastEdge = incomingEdges[incomingEdges.length - 1]; + if (firstEdge && startCursor) { + firstEdge.cursor = startCursor; + } + if (lastEdge && endCursor) { + lastEdge.cursor = endCursor; + } + var firstCursor = firstEdge && firstEdge.cursor; + if (firstCursor && !startCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + startCursor: firstCursor, + }, + }); + } + var lastCursor = lastEdge && lastEdge.cursor; + if (lastCursor && !endCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + endCursor: lastCursor, + }, + }); + } + } + var prefix = existing.edges; + var suffix = []; + if (args && args.after) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; }); + if (index >= 0) { + prefix = prefix.slice(0, index + 1); + } + } + else if (args && args.before) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; }); + suffix = index < 0 ? prefix : prefix.slice(index); + prefix = []; + } + else if (incoming.edges) { + prefix = []; + } + var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix), incomingEdges), suffix); + var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo); + if (incoming.pageInfo) { + var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]); + Object.assign(pageInfo, extras); + if (!prefix.length) { + if (void 0 !== hasPreviousPage) + pageInfo.hasPreviousPage = hasPreviousPage; + if (void 0 !== startCursor) + pageInfo.startCursor = startCursor; + } + if (!suffix.length) { + if (void 0 !== hasNextPage) + pageInfo.hasNextPage = hasNextPage; + if (void 0 !== endCursor) + pageInfo.endCursor = endCursor; + } + } + return tslib.__assign(tslib.__assign(tslib.__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo }); + }, + }; +} +var getExtras = function (obj) { return tslib.__rest(obj, notExtras); }; +var notExtras = ["edges", "pageInfo"]; +function makeEmptyData() { + return { + edges: [], + pageInfo: { + hasPreviousPage: false, + hasNextPage: true, + startCursor: "", + endCursor: "", + }, + }; +} + +var toString = Object.prototype.toString; +function cloneDeep(value) { + return cloneDeepHelper(value); +} +function cloneDeepHelper(val, seen) { + switch (toString.call(val)) { + case "[object Array]": { + seen = seen || new Map; + if (seen.has(val)) + return seen.get(val); + var copy_1 = val.slice(0); + seen.set(val, copy_1); + copy_1.forEach(function (child, i) { + copy_1[i] = cloneDeepHelper(child, seen); + }); + return copy_1; + } + case "[object Object]": { + seen = seen || new Map; + if (seen.has(val)) + return seen.get(val); + var copy_2 = Object.create(Object.getPrototypeOf(val)); + seen.set(val, copy_2); + Object.keys(val).forEach(function (key) { + copy_2[key] = cloneDeepHelper(val[key], seen); + }); + return copy_2; + } + default: + return val; + } +} + +function deepFreeze(value) { + var workSet = new Set([value]); + workSet.forEach(function (obj) { + if (isNonNullObject(obj)) { + if (!Object.isFrozen(obj)) + Object.freeze(obj); + Object.getOwnPropertyNames(obj).forEach(function (name) { + if (isNonNullObject(obj[name])) + workSet.add(obj[name]); + }); + } + }); + return value; +} +function maybeDeepFreeze(obj) { + if (__DEV__) { + deepFreeze(obj); + } + return obj; +} + +function iterateObserversSafely(observers, method, argument) { + var observersWithMethod = []; + observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); + observersWithMethod.forEach(function (obs) { return obs[method](argument); }); +} + +function asyncMap(observable, mapFn, catchFn) { + return new zenObservableTs.Observable(function (observer) { + var next = observer.next, error = observer.error, complete = observer.complete; + var activeCallbackCount = 0; + var completed = false; + var promiseQueue = { + then: function (callback) { + return new Promise(function (resolve) { return resolve(callback()); }); + }, + }; + function makeCallback(examiner, delegate) { + if (examiner) { + return function (arg) { + ++activeCallbackCount; + var both = function () { return examiner(arg); }; + promiseQueue = promiseQueue.then(both, both).then(function (result) { + --activeCallbackCount; + next && next.call(observer, result); + if (completed) { + handler.complete(); + } + }, function (error) { + --activeCallbackCount; + throw error; + }).catch(function (caught) { + error && error.call(observer, caught); + }); + }; + } + else { + return function (arg) { return delegate && delegate.call(observer, arg); }; + } + } + var handler = { + next: makeCallback(mapFn, next), + error: makeCallback(catchFn, error), + complete: function () { + completed = true; + if (!activeCallbackCount) { + complete && complete.call(observer); + } + }, + }; + var sub = observable.subscribe(handler); + return function () { return sub.unsubscribe(); }; + }); +} + +function fixObservableSubclass(subclass) { + function set(key) { + Object.defineProperty(subclass, key, { value: zenObservableTs.Observable }); + } + if (typeof Symbol === "function" && Symbol.species) { + set(Symbol.species); + } + set("@@species"); + return subclass; +} + +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +var Concast = (function (_super) { + tslib.__extends(Concast, _super); + function Concast(sources) { + var _this = _super.call(this, function (observer) { + _this.addObserver(observer); + return function () { return _this.removeObserver(observer); }; + }) || this; + _this.observers = new Set(); + _this.addCount = 0; + _this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + _this.handlers = { + next: function (result) { + if (_this.sub !== null) { + _this.latest = ["next", result]; + iterateObserversSafely(_this.observers, "next", result); + } + }, + error: function (error) { + var sub = _this.sub; + if (sub !== null) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + _this.latest = ["error", error]; + _this.reject(error); + iterateObserversSafely(_this.observers, "error", error); + } + }, + complete: function () { + if (_this.sub !== null) { + var value = _this.sources.shift(); + if (!value) { + _this.sub = null; + if (_this.latest && + _this.latest[0] === "next") { + _this.resolve(_this.latest[1]); + } + else { + _this.resolve(); + } + iterateObserversSafely(_this.observers, "complete"); + } + else if (isPromiseLike(value)) { + value.then(function (obs) { return _this.sub = obs.subscribe(_this.handlers); }); + } + else { + _this.sub = value.subscribe(_this.handlers); + } + } + }, + }; + _this.cancel = function (reason) { + _this.reject(reason); + _this.sources = []; + _this.handlers.complete(); + }; + _this.promise.catch(function (_) { }); + if (typeof sources === "function") { + sources = [new zenObservableTs.Observable(sources)]; + } + if (isPromiseLike(sources)) { + sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); + } + else { + _this.start(sources); + } + return _this; + } + Concast.prototype.start = function (sources) { + if (this.sub !== void 0) + return; + this.sources = Array.from(sources); + this.handlers.complete(); + }; + Concast.prototype.deliverLastMessage = function (observer) { + if (this.latest) { + var nextOrError = this.latest[0]; + var method = observer[nextOrError]; + if (method) { + method.call(observer, this.latest[1]); + } + if (this.sub === null && + nextOrError === "next" && + observer.complete) { + observer.complete(); + } + } + }; + Concast.prototype.addObserver = function (observer) { + if (!this.observers.has(observer)) { + this.deliverLastMessage(observer); + this.observers.add(observer); + ++this.addCount; + } + }; + Concast.prototype.removeObserver = function (observer, quietly) { + if (this.observers.delete(observer) && + --this.addCount < 1 && + !quietly) { + this.handlers.error(new Error("Observable cancelled prematurely")); + } + }; + Concast.prototype.cleanup = function (callback) { + var _this = this; + var called = false; + var once = function () { + if (!called) { + called = true; + _this.observers.delete(observer); + callback(); + } + }; + var observer = { + next: once, + error: once, + complete: once, + }; + var count = this.addCount; + this.addObserver(observer); + this.addCount = count; + }; + return Concast; +}(zenObservableTs.Observable)); +fixObservableSubclass(Concast); + +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +function graphQLResultHasError(result) { + return (result.errors && result.errors.length > 0) || false; +} + +var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && + navigator.product === 'ReactNative'); +var canUseWeakSet = typeof WeakSet === 'function'; + +function compact() { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var result = Object.create(null); + objects.forEach(function (obj) { + if (!obj) + return; + Object.keys(obj).forEach(function (key) { + var value = obj[key]; + if (value !== void 0) { + result[key] = value; + } + }); + }); + return result; +} + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return prefix + ":" + count + ":" + Math.random().toString(36).slice(2); +} + +function stringifyForDisplay(value) { + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }).split(JSON.stringify(undefId)).join(""); +} + +exports.DEV = globals.DEV; +exports.maybe = globals.maybe; +exports.Observable = zenObservableTs.Observable; +exports.Concast = Concast; +exports.DeepMerger = DeepMerger; +exports.addTypenameToDocument = addTypenameToDocument; +exports.argumentsObjectFromField = argumentsObjectFromField; +exports.asyncMap = asyncMap; +exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; +exports.canUseWeakMap = canUseWeakMap; +exports.canUseWeakSet = canUseWeakSet; +exports.checkDocument = checkDocument; +exports.cloneDeep = cloneDeep; +exports.compact = compact; +exports.concatPagination = concatPagination; +exports.createFragmentMap = createFragmentMap; +exports.fixObservableSubclass = fixObservableSubclass; +exports.getDefaultValues = getDefaultValues; +exports.getDirectiveNames = getDirectiveNames; +exports.getFragmentDefinition = getFragmentDefinition; +exports.getFragmentDefinitions = getFragmentDefinitions; +exports.getFragmentFromSelection = getFragmentFromSelection; +exports.getFragmentQueryDocument = getFragmentQueryDocument; +exports.getInclusionDirectives = getInclusionDirectives; +exports.getMainDefinition = getMainDefinition; +exports.getOperationDefinition = getOperationDefinition; +exports.getOperationName = getOperationName; +exports.getQueryDefinition = getQueryDefinition; +exports.getStoreKeyName = getStoreKeyName; +exports.getTypenameFromResult = getTypenameFromResult; +exports.graphQLResultHasError = graphQLResultHasError; +exports.hasClientExports = hasClientExports; +exports.hasDirectives = hasDirectives; +exports.isDocumentNode = isDocumentNode; +exports.isField = isField; +exports.isInlineFragment = isInlineFragment; +exports.isNonEmptyArray = isNonEmptyArray; +exports.isNonNullObject = isNonNullObject; +exports.isReference = isReference; +exports.iterateObserversSafely = iterateObserversSafely; +exports.makeReference = makeReference; +exports.makeUniqueId = makeUniqueId; +exports.maybeDeepFreeze = maybeDeepFreeze; +exports.mergeDeep = mergeDeep; +exports.mergeDeepArray = mergeDeepArray; +exports.offsetLimitPagination = offsetLimitPagination; +exports.relayStylePagination = relayStylePagination; +exports.removeArgumentsFromDocument = removeArgumentsFromDocument; +exports.removeClientSetsFromDocument = removeClientSetsFromDocument; +exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; +exports.removeDirectivesFromDocument = removeDirectivesFromDocument; +exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; +exports.resultKeyNameFromField = resultKeyNameFromField; +exports.shouldInclude = shouldInclude; +exports.storeKeyNameFromField = storeKeyNameFromField; +exports.stringifyForDisplay = stringifyForDisplay; +exports.valueToObjectRepresentation = valueToObjectRepresentation; +//# sourceMappingURL=utilities.cjs.js.map + + +/***/ }), + +/***/ 16538: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/* + Decode functions adapted from: + Version 1.0 12/25/99 Copyright (C) 1999 Masanao Izumo + http://www.onicos.com/staff/iz/amuse/javascript/expert/base64.txt +*/ + +const Stream = __nccwpck_require__(92413); + + +const internals = { + decodeChars: [ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 + ] +}; + + +exports.decode = function (buffer) { + + const decodeChars = internals.decodeChars; + const len = buffer.length; + const allocated = Math.ceil(len / 4) * 3; + const result = Buffer.alloc(allocated); + + let c1; + let c2; + let c3; + let c4; + let j = 0; + + for (let i = 0; i < len; ) { + do { + c1 = decodeChars[buffer[i++] & 0xff]; + } + while (i < len && c1 === -1); + + if (c1 === -1) { + break; + } + + do { + c2 = decodeChars[buffer[i++] & 0xff]; + } + while (i < len && c2 === -1); + + if (c2 === -1) { + break; + } + + result[j++] = (c1 << 2) | ((c2 & 0x30) >> 4); + + do { + c3 = buffer[i++] & 0xff; + if (c3 === 61) { // = + return result.slice(0, j); + } + + c3 = decodeChars[c3]; + } + while (i < len && c3 === -1); + + if (c3 === -1) { + break; + } + + result[j++] = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2); + + do { + c4 = buffer[i++] & 0xff; + if (c4 === 61) { // = + return result.slice(0, j); + } + + c4 = decodeChars[c4]; + } + while (i < len && c4 === -1); + + if (c4 !== -1) { + result[j++] = ((c3 & 0x03) << 6) | c4; + } + } + + return (j === allocated ? result : result.slice(0, j)); +}; + + +exports.Decoder = class Decoder extends Stream.Transform { + constructor() { + + super(); + this._reminder = null; + } + + _transform(chunk, encoding, callback) { + + let part = this._reminder ? Buffer.concat([this._reminder, chunk]) : chunk; + const remaining = part.length % 4; + if (remaining) { + this._reminder = part.slice(part.length - remaining); + part = part.slice(0, part.length - remaining); + } + else { + this._reminder = null; + } + + this.push(exports.decode(part)); + return callback(); + } + + _flush(callback) { + + if (this._reminder) { + this.push(exports.decode(this._reminder)); + } + + return callback(); + } +}; + + +/***/ }), + +/***/ 77763: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/* + Encode functions adapted from: + Version 1.0 12/25/99 Copyright (C) 1999 Masanao Izumo + http://www.onicos.com/staff/iz/amuse/javascript/expert/base64.txt +*/ + +const Stream = __nccwpck_require__(92413); + + +const internals = {}; + + +exports.encode = function (buffer) { + + return Buffer.from(buffer.toString('base64')); +}; + + +exports.Encoder = class Encoder extends Stream.Transform { + constructor() { + + super(); + this._reminder = null; + } + + _transform(chunk, encoding, callback) { + + let part = this._reminder ? Buffer.concat([this._reminder, chunk]) : chunk; + const remaining = part.length % 3; + if (remaining) { + this._reminder = part.slice(part.length - remaining); + part = part.slice(0, part.length - remaining); + } + else { + this._reminder = null; + } + + this.push(exports.encode(part)); + return callback(); + } + + _flush(callback) { + + if (this._reminder) { + this.push(exports.encode(this._reminder)); + } + + return callback(); + } +}; + + +/***/ }), + +/***/ 73828: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const Hoek = __nccwpck_require__(10904); + +const Decoder = __nccwpck_require__(16538); +const Encoder = __nccwpck_require__(77763); + + +exports.decode = Decoder.decode; + +exports.encode = Encoder.encode; + +exports.Decoder = Decoder.Decoder; + +exports.Encoder = Encoder.Encoder; + + +// Base64url (RFC 4648) encode + +exports.base64urlEncode = function (value, encoding) { + + Hoek.assert(typeof value === 'string' || Buffer.isBuffer(value), 'value must be string or buffer'); + const buf = (Buffer.isBuffer(value) ? value : Buffer.from(value, encoding || 'binary')); + return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); +}; + + +// Base64url (RFC 4648) decode + +exports.base64urlDecode = function (value, encoding) { + + if (typeof value !== 'string') { + + throw new Error('Value not a string'); + } + + if (!/^[\w\-]*$/.test(value)) { + + throw new Error('Invalid character'); + } + + const buf = Buffer.from(value, 'base64'); + return (encoding === 'buffer' ? buf : buf.toString(encoding || 'binary')); +}; + + +/***/ }), + +/***/ 88474: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const Hoek = __nccwpck_require__(10904); + + +const internals = { + codes: new Map([ + [100, 'Continue'], + [101, 'Switching Protocols'], + [102, 'Processing'], + [200, 'OK'], + [201, 'Created'], + [202, 'Accepted'], + [203, 'Non-Authoritative Information'], + [204, 'No Content'], + [205, 'Reset Content'], + [206, 'Partial Content'], + [207, 'Multi-Status'], + [300, 'Multiple Choices'], + [301, 'Moved Permanently'], + [302, 'Moved Temporarily'], + [303, 'See Other'], + [304, 'Not Modified'], + [305, 'Use Proxy'], + [307, 'Temporary Redirect'], + [400, 'Bad Request'], + [401, 'Unauthorized'], + [402, 'Payment Required'], + [403, 'Forbidden'], + [404, 'Not Found'], + [405, 'Method Not Allowed'], + [406, 'Not Acceptable'], + [407, 'Proxy Authentication Required'], + [408, 'Request Time-out'], + [409, 'Conflict'], + [410, 'Gone'], + [411, 'Length Required'], + [412, 'Precondition Failed'], + [413, 'Request Entity Too Large'], + [414, 'Request-URI Too Large'], + [415, 'Unsupported Media Type'], + [416, 'Requested Range Not Satisfiable'], + [417, 'Expectation Failed'], + [418, 'I\'m a teapot'], + [422, 'Unprocessable Entity'], + [423, 'Locked'], + [424, 'Failed Dependency'], + [425, 'Too Early'], + [426, 'Upgrade Required'], + [428, 'Precondition Required'], + [429, 'Too Many Requests'], + [431, 'Request Header Fields Too Large'], + [451, 'Unavailable For Legal Reasons'], + [500, 'Internal Server Error'], + [501, 'Not Implemented'], + [502, 'Bad Gateway'], + [503, 'Service Unavailable'], + [504, 'Gateway Time-out'], + [505, 'HTTP Version Not Supported'], + [506, 'Variant Also Negotiates'], + [507, 'Insufficient Storage'], + [509, 'Bandwidth Limit Exceeded'], + [510, 'Not Extended'], + [511, 'Network Authentication Required'] + ]) +}; + + +exports.Boom = class extends Error { + + constructor(message, options = {}) { + + if (message instanceof Error) { + return exports.boomify(Hoek.clone(message), options); + } + + const { statusCode = 500, data = null, ctor = exports.Boom } = options; + const error = new Error(message ? message : undefined); // Avoids settings null message + Error.captureStackTrace(error, ctor); // Filter the stack to our external API + error.data = data; + const boom = internals.initialize(error, statusCode); + + Object.defineProperty(boom, 'typeof', { value: ctor }); + + if (options.decorate) { + Object.assign(boom, options.decorate); + } + + return boom; + } + + static [Symbol.hasInstance](instance) { + + if (this === exports.Boom) { + return exports.isBoom(instance); + } + + // Cannot use 'instanceof' as it creates infinite recursion + + return this.prototype.isPrototypeOf(instance); + } +}; + + +exports.isBoom = function (err, statusCode) { + + return err instanceof Error && !!err.isBoom && (!statusCode || err.output.statusCode === statusCode); +}; + + +exports.boomify = function (err, options) { + + Hoek.assert(err instanceof Error, 'Cannot wrap non-Error object'); + + options = options || {}; + + if (options.data !== undefined) { + err.data = options.data; + } + + if (options.decorate) { + Object.assign(err, options.decorate); + } + + if (!err.isBoom) { + return internals.initialize(err, options.statusCode || 500, options.message); + } + + if (options.override === false || // Defaults to true + !options.statusCode && !options.message) { + + return err; + } + + return internals.initialize(err, options.statusCode || err.output.statusCode, options.message); +}; + + +// 4xx Client Errors + +exports.badRequest = function (message, data) { + + return new exports.Boom(message, { statusCode: 400, data, ctor: exports.badRequest }); +}; + + +exports.unauthorized = function (message, scheme, attributes) { // Or (message, wwwAuthenticate[]) + + const err = new exports.Boom(message, { statusCode: 401, ctor: exports.unauthorized }); + + // function (message) + + if (!scheme) { + return err; + } + + // function (message, wwwAuthenticate[]) + + if (typeof scheme !== 'string') { + err.output.headers['WWW-Authenticate'] = scheme.join(', '); + return err; + } + + // function (message, scheme, attributes) + + let wwwAuthenticate = `${scheme}`; + + if (attributes || + message) { + + err.output.payload.attributes = {}; + } + + if (attributes) { + if (typeof attributes === 'string') { + wwwAuthenticate += ' ' + Hoek.escapeHeaderAttribute(attributes); + err.output.payload.attributes = attributes; + } + else { + wwwAuthenticate += ' ' + Object.keys(attributes).map((name) => { + + let value = attributes[name]; + if (value === null || + value === undefined) { + + value = ''; + } + + err.output.payload.attributes[name] = value; + return `${name}="${Hoek.escapeHeaderAttribute(value.toString())}"`; + }) + .join(', '); + } + } + + if (message) { + if (attributes) { + wwwAuthenticate += ','; + } + + wwwAuthenticate += ` error="${Hoek.escapeHeaderAttribute(message)}"`; + err.output.payload.attributes.error = message; + } + else { + err.isMissing = true; + } + + err.output.headers['WWW-Authenticate'] = wwwAuthenticate; + return err; +}; + + +exports.paymentRequired = function (message, data) { + + return new exports.Boom(message, { statusCode: 402, data, ctor: exports.paymentRequired }); +}; + + +exports.forbidden = function (message, data) { + + return new exports.Boom(message, { statusCode: 403, data, ctor: exports.forbidden }); +}; + + +exports.notFound = function (message, data) { + + return new exports.Boom(message, { statusCode: 404, data, ctor: exports.notFound }); +}; + + +exports.methodNotAllowed = function (message, data, allow) { + + const err = new exports.Boom(message, { statusCode: 405, data, ctor: exports.methodNotAllowed }); + + if (typeof allow === 'string') { + allow = [allow]; + } + + if (Array.isArray(allow)) { + err.output.headers.Allow = allow.join(', '); + } + + return err; +}; + + +exports.notAcceptable = function (message, data) { + + return new exports.Boom(message, { statusCode: 406, data, ctor: exports.notAcceptable }); +}; + + +exports.proxyAuthRequired = function (message, data) { + + return new exports.Boom(message, { statusCode: 407, data, ctor: exports.proxyAuthRequired }); +}; + + +exports.clientTimeout = function (message, data) { + + return new exports.Boom(message, { statusCode: 408, data, ctor: exports.clientTimeout }); +}; + + +exports.conflict = function (message, data) { + + return new exports.Boom(message, { statusCode: 409, data, ctor: exports.conflict }); +}; + + +exports.resourceGone = function (message, data) { + + return new exports.Boom(message, { statusCode: 410, data, ctor: exports.resourceGone }); +}; + + +exports.lengthRequired = function (message, data) { + + return new exports.Boom(message, { statusCode: 411, data, ctor: exports.lengthRequired }); +}; + + +exports.preconditionFailed = function (message, data) { + + return new exports.Boom(message, { statusCode: 412, data, ctor: exports.preconditionFailed }); +}; + + +exports.entityTooLarge = function (message, data) { + + return new exports.Boom(message, { statusCode: 413, data, ctor: exports.entityTooLarge }); +}; + + +exports.uriTooLong = function (message, data) { + + return new exports.Boom(message, { statusCode: 414, data, ctor: exports.uriTooLong }); +}; + + +exports.unsupportedMediaType = function (message, data) { + + return new exports.Boom(message, { statusCode: 415, data, ctor: exports.unsupportedMediaType }); +}; + + +exports.rangeNotSatisfiable = function (message, data) { + + return new exports.Boom(message, { statusCode: 416, data, ctor: exports.rangeNotSatisfiable }); +}; + + +exports.expectationFailed = function (message, data) { + + return new exports.Boom(message, { statusCode: 417, data, ctor: exports.expectationFailed }); +}; + + +exports.teapot = function (message, data) { + + return new exports.Boom(message, { statusCode: 418, data, ctor: exports.teapot }); +}; + + +exports.badData = function (message, data) { + + return new exports.Boom(message, { statusCode: 422, data, ctor: exports.badData }); +}; + + +exports.locked = function (message, data) { + + return new exports.Boom(message, { statusCode: 423, data, ctor: exports.locked }); +}; + + +exports.failedDependency = function (message, data) { + + return new exports.Boom(message, { statusCode: 424, data, ctor: exports.failedDependency }); +}; + +exports.tooEarly = function (message, data) { + + return new exports.Boom(message, { statusCode: 425, data, ctor: exports.tooEarly }); +}; + + +exports.preconditionRequired = function (message, data) { + + return new exports.Boom(message, { statusCode: 428, data, ctor: exports.preconditionRequired }); +}; + + +exports.tooManyRequests = function (message, data) { + + return new exports.Boom(message, { statusCode: 429, data, ctor: exports.tooManyRequests }); +}; + + +exports.illegal = function (message, data) { + + return new exports.Boom(message, { statusCode: 451, data, ctor: exports.illegal }); +}; + + +// 5xx Server Errors + +exports.internal = function (message, data, statusCode = 500) { + + return internals.serverError(message, data, statusCode, exports.internal); +}; + + +exports.notImplemented = function (message, data) { + + return internals.serverError(message, data, 501, exports.notImplemented); +}; + + +exports.badGateway = function (message, data) { + + return internals.serverError(message, data, 502, exports.badGateway); +}; + + +exports.serverUnavailable = function (message, data) { + + return internals.serverError(message, data, 503, exports.serverUnavailable); +}; + + +exports.gatewayTimeout = function (message, data) { + + return internals.serverError(message, data, 504, exports.gatewayTimeout); +}; + + +exports.badImplementation = function (message, data) { + + const err = internals.serverError(message, data, 500, exports.badImplementation); + err.isDeveloperError = true; + return err; +}; + + +internals.initialize = function (err, statusCode, message) { + + const numberCode = parseInt(statusCode, 10); + Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode); + + err.isBoom = true; + err.isServer = numberCode >= 500; + + if (!err.hasOwnProperty('data')) { + err.data = null; + } + + err.output = { + statusCode: numberCode, + payload: {}, + headers: {} + }; + + Object.defineProperty(err, 'reformat', { value: internals.reformat, configurable: true }); + + if (!message && + !err.message) { + + err.reformat(); + message = err.output.payload.error; + } + + if (message) { + const props = Object.getOwnPropertyDescriptor(err, 'message') || Object.getOwnPropertyDescriptor(Object.getPrototypeOf(err), 'message'); + Hoek.assert(!props || props.configurable && !props.get, 'The error is not compatible with boom'); + + err.message = message + (err.message ? ': ' + err.message : ''); + err.output.payload.message = err.message; + } + + err.reformat(); + return err; +}; + + +internals.reformat = function (debug = false) { + + this.output.payload.statusCode = this.output.statusCode; + this.output.payload.error = internals.codes.get(this.output.statusCode) || 'Unknown'; + + if (this.output.statusCode === 500 && debug !== true) { + this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user + } + else if (this.message) { + this.output.payload.message = this.message; + } +}; + + +internals.serverError = function (message, data, statusCode, ctor) { + + if (data instanceof Error && + !data.isBoom) { + + return exports.boomify(data, { statusCode, message }); + } + + return new exports.Boom(message, { statusCode, data, ctor }); +}; + + +/***/ }), + +/***/ 97174: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + + +const internals = { + suspectRx: /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/ +}; + + +exports.parse = function (text, ...args) { + + // Normalize arguments + + const firstOptions = typeof args[0] === 'object' && args[0]; + const reviver = args.length > 1 || !firstOptions ? args[0] : undefined; + const options = (args.length > 1 && args[1]) || firstOptions || {}; + + // Parse normally, allowing exceptions + + const obj = JSON.parse(text, reviver); + + // options.protoAction: 'error' (default) / 'remove' / 'ignore' + + if (options.protoAction === 'ignore') { + return obj; + } + + // Ignore null and non-objects + + if (!obj || + typeof obj !== 'object') { + + return obj; + } + + // Check original string for potential exploit + + if (!text.match(internals.suspectRx)) { + return obj; + } + + // Scan result for proto keys + + exports.scan(obj, options); + + return obj; +}; + + +exports.scan = function (obj, options = {}) { + + let next = [obj]; + + while (next.length) { + const nodes = next; + next = []; + + for (const node of nodes) { + if (Object.prototype.hasOwnProperty.call(node, '__proto__')) { // Avoid calling node.hasOwnProperty directly + if (options.protoAction !== 'remove') { + throw new SyntaxError('Object contains forbidden prototype property'); + } + + delete node.__proto__; + } + + for (const key in node) { + const value = node[key]; + if (value && + typeof value === 'object') { + + next.push(node[key]); + } + } + } + } +}; + + +exports.safeParse = function (text, reviver) { + + try { + return exports.parse(text, reviver); + } + catch (ignoreError) { + return null; + } +}; + + +/***/ }), + +/***/ 55367: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const Crypto = __nccwpck_require__(76417); + +const Boom = __nccwpck_require__(88474); + + +const internals = {}; + + +// Generate a cryptographically strong pseudo-random data + +exports.randomString = function (size) { + + const buffer = exports.randomBits((size + 1) * 6); + const string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + return string.slice(0, size); +}; + + +// Generate a cryptographically strong pseudo-random alphanum data + +exports.randomAlphanumString = function (size) { + + let result = ''; + + while (result.length < size) { + const buffer = exports.randomBits((size + 1) * 6); + result += buffer.toString('base64').replace(/[^a-zA-Z0-9]/g, ''); + } + + return result.slice(0, size); +}; + + +// Return a random string of digits + +exports.randomDigits = function (size) { + + const digits = []; + + let buffer = internals.random(size * 2); // Provision twice the amount of bytes needed to increase chance of single pass + let pos = 0; + + while (digits.length < size) { + if (pos >= buffer.length) { + buffer = internals.random(size * 2); + pos = 0; + } + + if (buffer[pos] < 250) { + digits.push(buffer[pos] % 10); + } + + ++pos; + } + + return digits.join(''); +}; + + +// Generate a buffer of random bits + +exports.randomBits = function (bits) { + + if (!bits || + bits < 0) { + + throw Boom.internal('Invalid random bits count'); + } + + const bytes = Math.ceil(bits / 8); + return internals.random(bytes); +}; + + +exports.fixedTimeComparison = function (a, b) { + + try { + return Crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b)); + } + catch (err) { + return false; + } +}; + + +internals.random = function (bytes) { + + try { + return Crypto.randomBytes(bytes); + } + catch (err) { + throw Boom.internal('Failed generating random bits: ' + err.message); + } +}; + + +/***/ }), + +/***/ 85545: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Assert = __nccwpck_require__(32718); +const Clone = __nccwpck_require__(85578); +const Merge = __nccwpck_require__(60445); +const Reach = __nccwpck_require__(18891); + + +const internals = {}; + + +module.exports = function (defaults, source, options = {}) { + + Assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object'); + Assert(!source || source === true || typeof source === 'object', 'Invalid source value: must be true, falsy or an object'); + Assert(typeof options === 'object', 'Invalid options: must be an object'); + + if (!source) { // If no source, return null + return null; + } + + if (options.shallow) { + return internals.applyToDefaultsWithShallow(defaults, source, options); + } + + const copy = Clone(defaults); + + if (source === true) { // If source is set to true, use defaults + return copy; + } + + const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false; + return Merge(copy, source, { nullOverride, mergeArrays: false }); +}; + + +internals.applyToDefaultsWithShallow = function (defaults, source, options) { + + const keys = options.shallow; + Assert(Array.isArray(keys), 'Invalid keys'); + + const seen = new Map(); + const merge = source === true ? null : new Set(); + + for (let key of keys) { + key = Array.isArray(key) ? key : key.split('.'); // Pre-split optimization + + const ref = Reach(defaults, key); + if (ref && + typeof ref === 'object') { + + seen.set(ref, merge && Reach(source, key) || ref); + } + else if (merge) { + merge.add(key); + } + } + + const copy = Clone(defaults, {}, seen); + + if (!merge) { + return copy; + } + + for (const key of merge) { + internals.reachCopy(copy, source, key); + } + + const nullOverride = options.nullOverride !== undefined ? options.nullOverride : false; + return Merge(copy, source, { nullOverride, mergeArrays: false }); +}; + + +internals.reachCopy = function (dst, src, path) { + + for (const segment of path) { + if (!(segment in src)) { + return; + } + + const val = src[segment]; + + if (typeof val !== 'object' || val === null) { + return; + } + + src = val; + } + + const value = src; + let ref = dst; + for (let i = 0; i < path.length - 1; ++i) { + const segment = path[i]; + if (typeof ref[segment] !== 'object') { + ref[segment] = {}; + } + + ref = ref[segment]; + } + + ref[path[path.length - 1]] = value; +}; + + +/***/ }), + +/***/ 32718: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const AssertError = __nccwpck_require__(35563); + +const internals = {}; + + +module.exports = function (condition, ...args) { + + if (condition) { + return; + } + + if (args.length === 1 && + args[0] instanceof Error) { + + throw args[0]; + } + + throw new AssertError(args); +}; + + +/***/ }), + +/***/ 86999: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = internals.Bench = class { + + constructor() { + + this.ts = 0; + this.reset(); + } + + reset() { + + this.ts = internals.Bench.now(); + } + + elapsed() { + + return internals.Bench.now() - this.ts; + } + + static now() { + + const ts = process.hrtime(); + return (ts[0] * 1e3) + (ts[1] / 1e6); + } +}; + + +/***/ }), + +/***/ 77820: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Ignore = __nccwpck_require__(12887); + + +const internals = {}; + + +module.exports = function () { + + return new Promise(Ignore); +}; + + +/***/ }), + +/***/ 85578: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Reach = __nccwpck_require__(18891); +const Types = __nccwpck_require__(26657); +const Utils = __nccwpck_require__(30417); + + +const internals = { + needsProtoHack: new Set([Types.set, Types.map, Types.weakSet, Types.weakMap]) +}; + + +module.exports = internals.clone = function (obj, options = {}, _seen = null) { + + if (typeof obj !== 'object' || + obj === null) { + + return obj; + } + + let clone = internals.clone; + let seen = _seen; + + if (options.shallow) { + if (options.shallow !== true) { + return internals.cloneWithShallow(obj, options); + } + + clone = (value) => value; + } + else if (seen) { + const lookup = seen.get(obj); + if (lookup) { + return lookup; + } + } + else { + seen = new Map(); + } + + // Built-in object types + + const baseProto = Types.getInternalProto(obj); + if (baseProto === Types.buffer) { + return Buffer && Buffer.from(obj); // $lab:coverage:ignore$ + } + + if (baseProto === Types.date) { + return new Date(obj.getTime()); + } + + if (baseProto === Types.regex) { + return new RegExp(obj); + } + + // Generic objects + + const newObj = internals.base(obj, baseProto, options); + if (newObj === obj) { + return obj; + } + + if (seen) { + seen.set(obj, newObj); // Set seen, since obj could recurse + } + + if (baseProto === Types.set) { + for (const value of obj) { + newObj.add(clone(value, options, seen)); + } + } + else if (baseProto === Types.map) { + for (const [key, value] of obj) { + newObj.set(key, clone(value, options, seen)); + } + } + + const keys = Utils.keys(obj, options); + for (const key of keys) { + if (key === '__proto__') { + continue; + } + + if (baseProto === Types.array && + key === 'length') { + + newObj.length = obj.length; + continue; + } + + const descriptor = Object.getOwnPropertyDescriptor(obj, key); + if (descriptor) { + if (descriptor.get || + descriptor.set) { + + Object.defineProperty(newObj, key, descriptor); + } + else if (descriptor.enumerable) { + newObj[key] = clone(obj[key], options, seen); + } + else { + Object.defineProperty(newObj, key, { enumerable: false, writable: true, configurable: true, value: clone(obj[key], options, seen) }); + } + } + else { + Object.defineProperty(newObj, key, { + enumerable: true, + writable: true, + configurable: true, + value: clone(obj[key], options, seen) + }); + } + } + + return newObj; +}; + + +internals.cloneWithShallow = function (source, options) { + + const keys = options.shallow; + options = Object.assign({}, options); + options.shallow = false; + + const seen = new Map(); + + for (const key of keys) { + const ref = Reach(source, key); + if (typeof ref === 'object' || + typeof ref === 'function') { + + seen.set(ref, ref); + } + } + + return internals.clone(source, options, seen); +}; + + +internals.base = function (obj, baseProto, options) { + + if (options.prototype === false) { // Defaults to true + if (internals.needsProtoHack.has(baseProto)) { + return new baseProto.constructor(); + } + + return baseProto === Types.array ? [] : {}; + } + + const proto = Object.getPrototypeOf(obj); + if (proto && + proto.isImmutable) { + + return obj; + } + + if (baseProto === Types.array) { + const newObj = []; + if (proto !== baseProto) { + Object.setPrototypeOf(newObj, proto); + } + + return newObj; + } + + if (internals.needsProtoHack.has(baseProto)) { + const newObj = new proto.constructor(); + if (proto !== baseProto) { + Object.setPrototypeOf(newObj, proto); + } + + return newObj; + } + + return Object.create(proto); +}; + + +/***/ }), + +/***/ 39157: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Assert = __nccwpck_require__(32718); +const DeepEqual = __nccwpck_require__(55801); +const EscapeRegex = __nccwpck_require__(91965); +const Utils = __nccwpck_require__(30417); + + +const internals = {}; + + +module.exports = function (ref, values, options = {}) { // options: { deep, once, only, part, symbols } + + /* + string -> string(s) + array -> item(s) + object -> key(s) + object -> object (key:value) + */ + + if (typeof values !== 'object') { + values = [values]; + } + + Assert(!Array.isArray(values) || values.length, 'Values array cannot be empty'); + + // String + + if (typeof ref === 'string') { + return internals.string(ref, values, options); + } + + // Array + + if (Array.isArray(ref)) { + return internals.array(ref, values, options); + } + + // Object + + Assert(typeof ref === 'object', 'Reference must be string or an object'); + return internals.object(ref, values, options); +}; + + +internals.array = function (ref, values, options) { + + if (!Array.isArray(values)) { + values = [values]; + } + + if (!ref.length) { + return false; + } + + if (options.only && + options.once && + ref.length !== values.length) { + + return false; + } + + let compare; + + // Map values + + const map = new Map(); + for (const value of values) { + if (!options.deep || + !value || + typeof value !== 'object') { + + const existing = map.get(value); + if (existing) { + ++existing.allowed; + } + else { + map.set(value, { allowed: 1, hits: 0 }); + } + } + else { + compare = compare || internals.compare(options); + + let found = false; + for (const [key, existing] of map.entries()) { + if (compare(key, value)) { + ++existing.allowed; + found = true; + break; + } + } + + if (!found) { + map.set(value, { allowed: 1, hits: 0 }); + } + } + } + + // Lookup values + + let hits = 0; + for (const item of ref) { + let match; + if (!options.deep || + !item || + typeof item !== 'object') { + + match = map.get(item); + } + else { + compare = compare || internals.compare(options); + + for (const [key, existing] of map.entries()) { + if (compare(key, item)) { + match = existing; + break; + } + } + } + + if (match) { + ++match.hits; + ++hits; + + if (options.once && + match.hits > match.allowed) { + + return false; + } + } + } + + // Validate results + + if (options.only && + hits !== ref.length) { + + return false; + } + + for (const match of map.values()) { + if (match.hits === match.allowed) { + continue; + } + + if (match.hits < match.allowed && + !options.part) { + + return false; + } + } + + return !!hits; +}; + + +internals.object = function (ref, values, options) { + + Assert(options.once === undefined, 'Cannot use option once with object'); + + const keys = Utils.keys(ref, options); + if (!keys.length) { + return false; + } + + // Keys list + + if (Array.isArray(values)) { + return internals.array(keys, values, options); + } + + // Key value pairs + + const symbols = Object.getOwnPropertySymbols(values).filter((sym) => values.propertyIsEnumerable(sym)); + const targets = [...Object.keys(values), ...symbols]; + + const compare = internals.compare(options); + const set = new Set(targets); + + for (const key of keys) { + if (!set.has(key)) { + if (options.only) { + return false; + } + + continue; + } + + if (!compare(values[key], ref[key])) { + return false; + } + + set.delete(key); + } + + if (set.size) { + return options.part ? set.size < targets.length : false; + } + + return true; +}; + + +internals.string = function (ref, values, options) { + + // Empty string + + if (ref === '') { + return values.length === 1 && values[0] === '' || // '' contains '' + !options.once && !values.some((v) => v !== ''); // '' contains multiple '' if !once + } + + // Map values + + const map = new Map(); + const patterns = []; + + for (const value of values) { + Assert(typeof value === 'string', 'Cannot compare string reference to non-string value'); + + if (value) { + const existing = map.get(value); + if (existing) { + ++existing.allowed; + } + else { + map.set(value, { allowed: 1, hits: 0 }); + patterns.push(EscapeRegex(value)); + } + } + else if (options.once || + options.only) { + + return false; + } + } + + if (!patterns.length) { // Non-empty string contains unlimited empty string + return true; + } + + // Match patterns + + const regex = new RegExp(`(${patterns.join('|')})`, 'g'); + const leftovers = ref.replace(regex, ($0, $1) => { + + ++map.get($1).hits; + return ''; // Remove from string + }); + + // Validate results + + if (options.only && + leftovers) { + + return false; + } + + let any = false; + for (const match of map.values()) { + if (match.hits) { + any = true; + } + + if (match.hits === match.allowed) { + continue; + } + + if (match.hits < match.allowed && + !options.part) { + + return false; + } + + // match.hits > match.allowed + + if (options.once) { + return false; + } + } + + return !!any; +}; + + +internals.compare = function (options) { + + if (!options.deep) { + return internals.shallow; + } + + const hasOnly = options.only !== undefined; + const hasPart = options.part !== undefined; + + const flags = { + prototype: hasOnly ? options.only : hasPart ? !options.part : false, + part: hasOnly ? !options.only : hasPart ? options.part : false + }; + + return (a, b) => DeepEqual(a, b, flags); +}; + + +internals.shallow = function (a, b) { + + return a === b; +}; + + +/***/ }), + +/***/ 55801: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Types = __nccwpck_require__(26657); + + +const internals = { + mismatched: null +}; + + +module.exports = function (obj, ref, options) { + + options = Object.assign({ prototype: true }, options); + + return !!internals.isDeepEqual(obj, ref, options, []); +}; + + +internals.isDeepEqual = function (obj, ref, options, seen) { + + if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql + return obj !== 0 || 1 / obj === 1 / ref; + } + + const type = typeof obj; + + if (type !== typeof ref) { + return false; + } + + if (obj === null || + ref === null) { + + return false; + } + + if (type === 'function') { + if (!options.deepFunction || + obj.toString() !== ref.toString()) { + + return false; + } + + // Continue as object + } + else if (type !== 'object') { + return obj !== obj && ref !== ref; // NaN + } + + const instanceType = internals.getSharedType(obj, ref, !!options.prototype); + switch (instanceType) { + case Types.buffer: + return Buffer && Buffer.prototype.equals.call(obj, ref); // $lab:coverage:ignore$ + case Types.promise: + return obj === ref; + case Types.regex: + return obj.toString() === ref.toString(); + case internals.mismatched: + return false; + } + + for (let i = seen.length - 1; i >= 0; --i) { + if (seen[i].isSame(obj, ref)) { + return true; // If previous comparison failed, it would have stopped execution + } + } + + seen.push(new internals.SeenEntry(obj, ref)); + + try { + return !!internals.isDeepEqualObj(instanceType, obj, ref, options, seen); + } + finally { + seen.pop(); + } +}; + + +internals.getSharedType = function (obj, ref, checkPrototype) { + + if (checkPrototype) { + if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) { + return internals.mismatched; + } + + return Types.getInternalProto(obj); + } + + const type = Types.getInternalProto(obj); + if (type !== Types.getInternalProto(ref)) { + return internals.mismatched; + } + + return type; +}; + + +internals.valueOf = function (obj) { + + const objValueOf = obj.valueOf; + if (objValueOf === undefined) { + return obj; + } + + try { + return objValueOf.call(obj); + } + catch (err) { + return err; + } +}; + + +internals.hasOwnEnumerableProperty = function (obj, key) { + + return Object.prototype.propertyIsEnumerable.call(obj, key); +}; + + +internals.isSetSimpleEqual = function (obj, ref) { + + for (const entry of Set.prototype.values.call(obj)) { + if (!Set.prototype.has.call(ref, entry)) { + return false; + } + } + + return true; +}; + + +internals.isDeepEqualObj = function (instanceType, obj, ref, options, seen) { + + const { isDeepEqual, valueOf, hasOwnEnumerableProperty } = internals; + const { keys, getOwnPropertySymbols } = Object; + + if (instanceType === Types.array) { + if (options.part) { + + // Check if any index match any other index + + for (const objValue of obj) { + for (const refValue of ref) { + if (isDeepEqual(objValue, refValue, options, seen)) { + return true; + } + } + } + } + else { + if (obj.length !== ref.length) { + return false; + } + + for (let i = 0; i < obj.length; ++i) { + if (!isDeepEqual(obj[i], ref[i], options, seen)) { + return false; + } + } + + return true; + } + } + else if (instanceType === Types.set) { + if (obj.size !== ref.size) { + return false; + } + + if (!internals.isSetSimpleEqual(obj, ref)) { + + // Check for deep equality + + const ref2 = new Set(Set.prototype.values.call(ref)); + for (const objEntry of Set.prototype.values.call(obj)) { + if (ref2.delete(objEntry)) { + continue; + } + + let found = false; + for (const refEntry of ref2) { + if (isDeepEqual(objEntry, refEntry, options, seen)) { + ref2.delete(refEntry); + found = true; + break; + } + } + + if (!found) { + return false; + } + } + } + } + else if (instanceType === Types.map) { + if (obj.size !== ref.size) { + return false; + } + + for (const [key, value] of Map.prototype.entries.call(obj)) { + if (value === undefined && !Map.prototype.has.call(ref, key)) { + return false; + } + + if (!isDeepEqual(value, Map.prototype.get.call(ref, key), options, seen)) { + return false; + } + } + } + else if (instanceType === Types.error) { + + // Always check name and message + + if (obj.name !== ref.name || + obj.message !== ref.message) { + + return false; + } + } + + // Check .valueOf() + + const valueOfObj = valueOf(obj); + const valueOfRef = valueOf(ref); + if ((obj !== valueOfObj || ref !== valueOfRef) && + !isDeepEqual(valueOfObj, valueOfRef, options, seen)) { + + return false; + } + + // Check properties + + const objKeys = keys(obj); + if (!options.part && + objKeys.length !== keys(ref).length && + !options.skip) { + + return false; + } + + let skipped = 0; + for (const key of objKeys) { + if (options.skip && + options.skip.includes(key)) { + + if (ref[key] === undefined) { + ++skipped; + } + + continue; + } + + if (!hasOwnEnumerableProperty(ref, key)) { + return false; + } + + if (!isDeepEqual(obj[key], ref[key], options, seen)) { + return false; + } + } + + if (!options.part && + objKeys.length - skipped !== keys(ref).length) { + + return false; + } + + // Check symbols + + if (options.symbols !== false) { // Defaults to true + const objSymbols = getOwnPropertySymbols(obj); + const refSymbols = new Set(getOwnPropertySymbols(ref)); + + for (const key of objSymbols) { + if (!options.skip || + !options.skip.includes(key)) { + + if (hasOwnEnumerableProperty(obj, key)) { + if (!hasOwnEnumerableProperty(ref, key)) { + return false; + } + + if (!isDeepEqual(obj[key], ref[key], options, seen)) { + return false; + } + } + else if (hasOwnEnumerableProperty(ref, key)) { + return false; + } + } + + refSymbols.delete(key); + } + + for (const key of refSymbols) { + if (hasOwnEnumerableProperty(ref, key)) { + return false; + } + } + } + + return true; +}; + + +internals.SeenEntry = class { + + constructor(obj, ref) { + + this.obj = obj; + this.ref = ref; + } + + isSame(obj, ref) { + + return this.obj === obj && this.ref === ref; + } +}; + + +/***/ }), + +/***/ 35563: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + + +const Stringify = __nccwpck_require__(37577); + + +const internals = {}; + + +module.exports = class extends Error { + + constructor(args) { + + const msgs = args + .filter((arg) => arg !== '') + .map((arg) => { + + return typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : Stringify(arg); + }); + + super(msgs.join(' ') || 'Unknown error'); + + if (typeof Error.captureStackTrace === 'function') { // $lab:coverage:ignore$ + Error.captureStackTrace(this, exports.assert); + } + } +}; + + +/***/ }), + +/***/ 199: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Assert = __nccwpck_require__(32718); + + +const internals = {}; + + +module.exports = function (attribute) { + + // Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, " + + Assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')'); + + return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash +}; + + +/***/ }), + +/***/ 24752: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (input) { + + if (!input) { + return ''; + } + + let escaped = ''; + + for (let i = 0; i < input.length; ++i) { + + const charCode = input.charCodeAt(i); + + if (internals.isSafe(charCode)) { + escaped += input[i]; + } + else { + escaped += internals.escapeHtmlChar(charCode); + } + } + + return escaped; +}; + + +internals.escapeHtmlChar = function (charCode) { + + const namedEscape = internals.namedHtml[charCode]; + if (typeof namedEscape !== 'undefined') { + return namedEscape; + } + + if (charCode >= 256) { + return '&#' + charCode + ';'; + } + + const hexValue = charCode.toString(16).padStart(2, '0'); + return `&#x${hexValue};`; +}; + + +internals.isSafe = function (charCode) { + + return (typeof internals.safeCharCodes[charCode] !== 'undefined'); +}; + + +internals.namedHtml = { + '38': '&', + '60': '<', + '62': '>', + '34': '"', + '160': ' ', + '162': '¢', + '163': '£', + '164': '¤', + '169': '©', + '174': '®' +}; + + +internals.safeCharCodes = (function () { + + const safe = {}; + + for (let i = 32; i < 123; ++i) { + + if ((i >= 97) || // a-z + (i >= 65 && i <= 90) || // A-Z + (i >= 48 && i <= 57) || // 0-9 + i === 32 || // space + i === 46 || // . + i === 44 || // , + i === 45 || // - + i === 58 || // : + i === 95) { // _ + + safe[i] = null; + } + } + + return safe; +}()); + + +/***/ }), + +/***/ 30112: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (input) { + + if (!input) { + return ''; + } + + const lessThan = 0x3C; + const greaterThan = 0x3E; + const andSymbol = 0x26; + const lineSeperator = 0x2028; + + // replace method + let charCode; + return input.replace(/[<>&\u2028\u2029]/g, (match) => { + + charCode = match.charCodeAt(0); + + if (charCode === lessThan) { + return '\\u003c'; + } + + if (charCode === greaterThan) { + return '\\u003e'; + } + + if (charCode === andSymbol) { + return '\\u0026'; + } + + if (charCode === lineSeperator) { + return '\\u2028'; + } + + return '\\u2029'; + }); +}; + + +/***/ }), + +/***/ 91965: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (string) { + + // Escape ^$.*+-?=!:|\/()[]{}, + + return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&'); +}; + + +/***/ }), + +/***/ 69666: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = internals.flatten = function (array, target) { + + const result = target || []; + + for (let i = 0; i < array.length; ++i) { + if (Array.isArray(array[i])) { + internals.flatten(array[i], result); + } + else { + result.push(array[i]); + } + } + + return result; +}; + + +/***/ }), + +/***/ 12887: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function () { }; + + +/***/ }), + +/***/ 10904: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +exports.applyToDefaults = __nccwpck_require__(85545); + +exports.assert = __nccwpck_require__(32718); + +exports.Bench = __nccwpck_require__(86999); + +exports.block = __nccwpck_require__(77820); + +exports.clone = __nccwpck_require__(85578); + +exports.contain = __nccwpck_require__(39157); + +exports.deepEqual = __nccwpck_require__(55801); + +exports.Error = __nccwpck_require__(35563); + +exports.escapeHeaderAttribute = __nccwpck_require__(199); + +exports.escapeHtml = __nccwpck_require__(24752); + +exports.escapeJson = __nccwpck_require__(30112); + +exports.escapeRegex = __nccwpck_require__(91965); + +exports.flatten = __nccwpck_require__(69666); + +exports.ignore = __nccwpck_require__(12887); + +exports.intersect = __nccwpck_require__(43221); + +exports.isPromise = __nccwpck_require__(56755); + +exports.merge = __nccwpck_require__(60445); + +exports.once = __nccwpck_require__(98926); + +exports.reach = __nccwpck_require__(18891); + +exports.reachTemplate = __nccwpck_require__(23225); + +exports.stringify = __nccwpck_require__(37577); + +exports.wait = __nccwpck_require__(69497); + + +/***/ }), + +/***/ 43221: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (array1, array2, options = {}) { + + if (!array1 || + !array2) { + + return (options.first ? null : []); + } + + const common = []; + const hash = (Array.isArray(array1) ? new Set(array1) : array1); + const found = new Set(); + for (const value of array2) { + if (internals.has(hash, value) && + !found.has(value)) { + + if (options.first) { + return value; + } + + common.push(value); + found.add(value); + } + } + + return (options.first ? null : common); +}; + + +internals.has = function (ref, key) { + + if (typeof ref.has === 'function') { + return ref.has(key); + } + + return ref[key] !== undefined; +}; + + +/***/ }), + +/***/ 56755: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (promise) { + + return !!promise && typeof promise.then === 'function'; +}; + + +/***/ }), + +/***/ 60445: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Assert = __nccwpck_require__(32718); +const Clone = __nccwpck_require__(85578); +const Utils = __nccwpck_require__(30417); + + +const internals = {}; + + +module.exports = internals.merge = function (target, source, options) { + + Assert(target && typeof target === 'object', 'Invalid target value: must be an object'); + Assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object'); + + if (!source) { + return target; + } + + options = Object.assign({ nullOverride: true, mergeArrays: true }, options); + + if (Array.isArray(source)) { + Assert(Array.isArray(target), 'Cannot merge array onto an object'); + if (!options.mergeArrays) { + target.length = 0; // Must not change target assignment + } + + for (let i = 0; i < source.length; ++i) { + target.push(Clone(source[i], { symbols: options.symbols })); + } + + return target; + } + + const keys = Utils.keys(source, options); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (key === '__proto__' || + !Object.prototype.propertyIsEnumerable.call(source, key)) { + + continue; + } + + const value = source[key]; + if (value && + typeof value === 'object') { + + if (target[key] === value) { + continue; // Can occur for shallow merges + } + + if (!target[key] || + typeof target[key] !== 'object' || + (Array.isArray(target[key]) !== Array.isArray(value)) || + value instanceof Date || + (Buffer && Buffer.isBuffer(value)) || // $lab:coverage:ignore$ + value instanceof RegExp) { + + target[key] = Clone(value, { symbols: options.symbols }); + } + else { + internals.merge(target[key], value, options); + } + } + else { + if (value !== null && + value !== undefined) { // Explicit to preserve empty strings + + target[key] = value; + } + else if (options.nullOverride) { + target[key] = value; + } + } + } + + return target; +}; + + +/***/ }), + +/***/ 98926: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (method) { + + if (method._hoekOnce) { + return method; + } + + let once = false; + const wrapped = function (...args) { + + if (!once) { + once = true; + method(...args); + } + }; + + wrapped._hoekOnce = true; + return wrapped; +}; + + +/***/ }), + +/***/ 18891: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Assert = __nccwpck_require__(32718); + + +const internals = {}; + + +module.exports = function (obj, chain, options) { + + if (chain === false || + chain === null || + chain === undefined) { + + return obj; + } + + options = options || {}; + if (typeof options === 'string') { + options = { separator: options }; + } + + const isChainArray = Array.isArray(chain); + + Assert(!isChainArray || !options.separator, 'Separator option no valid for array-based chain'); + + const path = isChainArray ? chain : chain.split(options.separator || '.'); + let ref = obj; + for (let i = 0; i < path.length; ++i) { + let key = path[i]; + const type = options.iterables && internals.iterables(ref); + + if (Array.isArray(ref) || + type === 'set') { + + const number = Number(key); + if (Number.isInteger(number)) { + key = number < 0 ? ref.length + number : number; + } + } + + if (!ref || + typeof ref === 'function' && options.functions === false || // Defaults to true + !type && ref[key] === undefined) { + + Assert(!options.strict || i + 1 === path.length, 'Missing segment', key, 'in reach path ', chain); + Assert(typeof ref === 'object' || options.functions === true || typeof ref !== 'function', 'Invalid segment', key, 'in reach path ', chain); + ref = options.default; + break; + } + + if (!type) { + ref = ref[key]; + } + else if (type === 'set') { + ref = [...ref][key]; + } + else { // type === 'map' + ref = ref.get(key); + } + } + + return ref; +}; + + +internals.iterables = function (ref) { + + if (ref instanceof Set) { + return 'set'; + } + + if (ref instanceof Map) { + return 'map'; + } +}; + + +/***/ }), + +/***/ 23225: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const Reach = __nccwpck_require__(18891); + + +const internals = {}; + + +module.exports = function (obj, template, options) { + + return template.replace(/{([^}]+)}/g, ($0, chain) => { + + const value = Reach(obj, chain, options); + return (value === undefined || value === null ? '' : value); + }); +}; + + +/***/ }), + +/***/ 37577: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (...args) { + + try { + return JSON.stringify.apply(null, args); + } + catch (err) { + return '[Cannot display object: ' + err.message + ']'; + } +}; + + +/***/ }), + +/***/ 26657: +/***/ ((module, exports) => { + +"use strict"; + + +const internals = {}; + + +exports = module.exports = { + array: Array.prototype, + buffer: Buffer && Buffer.prototype, // $lab:coverage:ignore$ + date: Date.prototype, + error: Error.prototype, + generic: Object.prototype, + map: Map.prototype, + promise: Promise.prototype, + regex: RegExp.prototype, + set: Set.prototype, + weakMap: WeakMap.prototype, + weakSet: WeakSet.prototype +}; + + +internals.typeMap = new Map([ + ['[object Error]', exports.error], + ['[object Map]', exports.map], + ['[object Promise]', exports.promise], + ['[object Set]', exports.set], + ['[object WeakMap]', exports.weakMap], + ['[object WeakSet]', exports.weakSet] +]); + + +exports.getInternalProto = function (obj) { + + if (Array.isArray(obj)) { + return exports.array; + } + + if (Buffer && obj instanceof Buffer) { // $lab:coverage:ignore$ + return exports.buffer; + } + + if (obj instanceof Date) { + return exports.date; + } + + if (obj instanceof RegExp) { + return exports.regex; + } + + if (obj instanceof Error) { + return exports.error; + } + + const objName = Object.prototype.toString.call(obj); + return internals.typeMap.get(objName) || exports.generic; +}; + + +/***/ }), + +/***/ 30417: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +const internals = {}; + + +exports.keys = function (obj, options = {}) { + + return options.symbols !== false ? Reflect.ownKeys(obj) : Object.getOwnPropertyNames(obj); // Defaults to true +}; + + +/***/ }), + +/***/ 69497: +/***/ ((module) => { + +"use strict"; + + +const internals = {}; + + +module.exports = function (timeout, returnValue) { + + if (typeof timeout !== 'number' && timeout !== undefined) { + throw new TypeError('Timeout must be a number'); + } + + return new Promise((resolve) => setTimeout(resolve, timeout, returnValue)); +}; + + +/***/ }), + +/***/ 51890: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const Crypto = __nccwpck_require__(76417); + +const B64 = __nccwpck_require__(73828); +const Boom = __nccwpck_require__(88474); +const Bourne = __nccwpck_require__(97174); +const Cryptiles = __nccwpck_require__(55367); +const Hoek = __nccwpck_require__(10904); + + +const internals = {}; + + +exports.defaults = { + encryption: { + saltBits: 256, + algorithm: 'aes-256-cbc', + iterations: 1, + minPasswordlength: 32 + }, + + integrity: { + saltBits: 256, + algorithm: 'sha256', + iterations: 1, + minPasswordlength: 32 + }, + + ttl: 0, // Milliseconds, 0 means forever + timestampSkewSec: 60, // Seconds of permitted clock skew for incoming expirations + localtimeOffsetMsec: 0 // Local clock time offset express in a number of milliseconds (positive or negative) +}; + + +// Algorithm configuration + +exports.algorithms = { + 'aes-128-ctr': { keyBits: 128, ivBits: 128 }, + 'aes-256-cbc': { keyBits: 256, ivBits: 128 }, + 'sha256': { keyBits: 256 } +}; + + +// MAC normalization format version + +exports.macFormatVersion = '2'; // Prevent comparison of mac values generated with different normalized string formats + +exports.macPrefix = 'Fe26.' + exports.macFormatVersion; + + +// Generate a unique encryption key + +/* + const options = { + saltBits: 256, // Ignored if salt is set + salt: '4d8nr9q384nr9q384nr93q8nruq9348run', + algorithm: 'aes-128-ctr', + iterations: 10000, + iv: 'sdfsdfsdfsdfscdrgercgesrcgsercg', // Optional + minPasswordlength: 32 + }; +*/ + +exports.generateKey = async function (password, options) { + + if (!password) { + throw new Boom.Boom('Empty password'); + } + + if (!options || + typeof options !== 'object') { + + throw new Boom.Boom('Bad options'); + } + + const algorithm = exports.algorithms[options.algorithm]; + if (!algorithm) { + throw new Boom.Boom('Unknown algorithm: ' + options.algorithm); + } + + const result = {}; + + if (Buffer.isBuffer(password)) { + if (password.length < algorithm.keyBits / 8) { + throw new Boom.Boom('Key buffer (password) too small'); + } + + result.key = password; + result.salt = ''; + } + else { + if (password.length < options.minPasswordlength) { + throw new Boom.Boom('Password string too short (min ' + options.minPasswordlength + ' characters required)'); + } + + let salt = options.salt; + if (!salt) { + if (!options.saltBits) { + throw new Boom.Boom('Missing salt and saltBits options'); + } + + const randomSalt = Cryptiles.randomBits(options.saltBits); + salt = randomSalt.toString('hex'); + } + + const derivedKey = await internals.pbkdf2(password, salt, options.iterations, algorithm.keyBits / 8, 'sha1'); + + result.key = derivedKey; + result.salt = salt; + } + + if (options.iv) { + result.iv = options.iv; + } + else if (algorithm.ivBits) { + result.iv = Cryptiles.randomBits(algorithm.ivBits); + } + + return result; +}; + + +// Encrypt data +// options: see exports.generateKey() + +exports.encrypt = async function (password, options, data) { + + const key = await exports.generateKey(password, options); + const cipher = Crypto.createCipheriv(options.algorithm, key.key, key.iv); + const encrypted = Buffer.concat([cipher.update(data, 'utf8'), cipher.final()]); + + return { encrypted, key }; +}; + + +// Decrypt data +// options: see exports.generateKey() + +exports.decrypt = async function (password, options, data) { + + const key = await exports.generateKey(password, options); + const decipher = Crypto.createDecipheriv(options.algorithm, key.key, key.iv); + let dec = decipher.update(data, null, 'utf8'); + dec = dec + decipher.final('utf8'); + + return dec; +}; + + +// HMAC using a password +// options: see exports.generateKey() + +exports.hmacWithPassword = async function (password, options, data) { + + const key = await exports.generateKey(password, options); + const hmac = Crypto.createHmac(options.algorithm, key.key).update(data); + const digest = hmac.digest('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + + return { + digest, + salt: key.salt + }; +}; + + +// Normalizes a password parameter into a { id, encryption, integrity } object +// password: string, buffer or object with { id, secret } or { id, encryption, integrity } + +internals.normalizePassword = function (password) { + + if (password && + typeof password === 'object' && + !Buffer.isBuffer(password)) { + + return { + id: password.id, + encryption: password.secret || password.encryption, + integrity: password.secret || password.integrity + }; + } + + return { + encryption: password, + integrity: password + }; +}; + + +// Encrypt and HMAC an object +// password: string, buffer or object with { id, secret } or { id, encryption, integrity } +// options: see exports.defaults + +exports.seal = async function (object, password, options) { + + options = Object.assign({}, options); // Shallow cloned to prevent changes during async operations + + const now = Date.now() + (options.localtimeOffsetMsec || 0); // Measure now before any other processing + + // Serialize object + + const objectString = internals.stringify(object); + + // Obtain password + + let passwordId = ''; + password = internals.normalizePassword(password); + if (password.id) { + if (!/^\w+$/.test(password.id)) { + throw new Boom.Boom('Invalid password id'); + } + + passwordId = password.id; + } + + // Encrypt object string + + const { encrypted, key } = await exports.encrypt(password.encryption, options.encryption, objectString); + + // Base64url the encrypted value + + const encryptedB64 = B64.base64urlEncode(encrypted); + const iv = B64.base64urlEncode(key.iv); + const expiration = (options.ttl ? now + options.ttl : ''); + const macBaseString = exports.macPrefix + '*' + passwordId + '*' + key.salt + '*' + iv + '*' + encryptedB64 + '*' + expiration; + + // Mac the combined values + + const mac = await exports.hmacWithPassword(password.integrity, options.integrity, macBaseString); + + // Put it all together + + // prefix*[password-id]*encryption-salt*encryption-iv*encrypted*[expiration]*hmac-salt*hmac + // Allowed URI query name/value characters: *-. \d \w + + const sealed = macBaseString + '*' + mac.salt + '*' + mac.digest; + return sealed; +}; + + +// Decrypt and validate sealed string +// password: string, buffer or object with { id: secret } or { id: { encryption, integrity } } +// options: see exports.defaults + +exports.unseal = async function (sealed, password, options) { + + options = Object.assign({}, options); // Shallow cloned to prevent changes during async operations + + const now = Date.now() + (options.localtimeOffsetMsec || 0); // Measure now before any other processing + + // Break string into components + + const parts = sealed.split('*'); + if (parts.length !== 8) { + throw new Boom.Boom('Incorrect number of sealed components'); + } + + const macPrefix = parts[0]; + const passwordId = parts[1]; + const encryptionSalt = parts[2]; + const encryptionIv = parts[3]; + const encryptedB64 = parts[4]; + const expiration = parts[5]; + const hmacSalt = parts[6]; + const hmac = parts[7]; + const macBaseString = macPrefix + '*' + passwordId + '*' + encryptionSalt + '*' + encryptionIv + '*' + encryptedB64 + '*' + expiration; + + // Check prefix + + if (macPrefix !== exports.macPrefix) { + throw new Boom.Boom('Wrong mac prefix'); + } + + // Check expiration + + if (expiration) { + if (!expiration.match(/^\d+$/)) { + throw new Boom.Boom('Invalid expiration'); + } + + const exp = parseInt(expiration, 10); + if (exp <= (now - (options.timestampSkewSec * 1000))) { + throw new Boom.Boom('Expired seal'); + } + } + + // Obtain password + + if (!password) { + throw new Boom.Boom('Empty password'); + } + + if (typeof password === 'object' && + !Buffer.isBuffer(password)) { + + password = password[passwordId || 'default']; + if (!password) { + throw new Boom.Boom('Cannot find password: ' + passwordId); + } + } + + password = internals.normalizePassword(password); + + // Check hmac + + const macOptions = Hoek.clone(options.integrity); + macOptions.salt = hmacSalt; + const mac = await exports.hmacWithPassword(password.integrity, macOptions, macBaseString); + + if (!Cryptiles.fixedTimeComparison(mac.digest, hmac)) { + throw new Boom.Boom('Bad hmac value'); + } + + // Decrypt + + try { + var encrypted = B64.base64urlDecode(encryptedB64, 'buffer'); + } + catch (err) { + throw Boom.boomify(err); + } + + const decryptOptions = Hoek.clone(options.encryption); + decryptOptions.salt = encryptionSalt; + + try { + decryptOptions.iv = B64.base64urlDecode(encryptionIv, 'buffer'); + } + catch (err) { + throw Boom.boomify(err); + } + + const decrypted = await exports.decrypt(password.encryption, decryptOptions, encrypted); + + // Parse JSON + + try { + return Bourne.parse(decrypted); + } + catch (err) { + throw new Boom.Boom('Failed parsing sealed object JSON: ' + err.message); + } +}; + + +internals.stringify = function (object) { + + try { + return JSON.stringify(object); + } + catch (err) { + throw new Boom.Boom('Failed to stringify object: ' + err.message); + } +}; + + +internals.pbkdf2 = function (...args) { + + return new Promise((resolve, reject) => { + + const next = (err, result) => { + + if (err) { + return reject(Boom.boomify(err)); + } + + resolve(result); + }; + + args.push(next); + Crypto.pbkdf2(...args); + }); +}; + + +/***/ }), + +/***/ 2459: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=0)}([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]}),o=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}),o(r(1),t),o(r(4),t)},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.runCallbacks=void 0;const o=r(2),u=n(r(3)).default("vulcan:callback");t.runCallbacks=function({iterator:e,args:t,callbacks:r,hookName:n="unkown hook"}){let i=!1;if(void 0!==r&&r.length>0){const a=(e,r)=>{u(`Running callback ${r.name} on hook ${n}`);const o=[e].concat(t);try{const t=r.apply(this,o);return void 0===t?e:t}catch(t){if(console.error(`Error at callback ${r.name} on hook ${n}`,t),t.break||t.data&&t.data.break)throw t;return e}};return r.reduce((function(e,t,c){return o.isPromise(e)?(i||(u(`Started async context in hook ${n}] by ${r[c-1]&&r[c-1].name}`),i=!0),new Promise((r,n)=>{e.then(e=>{try{r(a(e,t))}catch(e){n(e)}}).catch(n)})):a(e,t)}),e)}return e}},function(e,t){e.exports=__nccwpck_require__(35001)},function(e,t){e.exports=__nccwpck_require__(81072)},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.getErrors=t.parseErrorMessage=void 0;const o=n(r(5));t.parseErrorMessage=e=>{if(!e)return null;let t=e.split("\n");return t=t.map(e=>{const t=(e=>{const t=/"([^"]*)"/.exec(e);return null===t?null:t[1]})(e);return e.includes("found null")?{id:"errors.required",path:t,properties:{name:t}}:{message:e}}),t};t.getErrors=e=>{const t=e.graphQLErrors,r=o.default(t,"0.extensions.exception.data.errors"),n=o.default(t,"0.extensions.exception.errors");return r||n||t||[]}},function(e,t){e.exports=__nccwpck_require__(56908)}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vaW5kZXgudHMiLCJ3ZWJwYWNrOi8vLy4vY2FsbGJhY2tzLnRzIiwid2VicGFjazovLy9leHRlcm5hbCBcIkB2dWxjYW5qcy91dGlsc1wiIiwid2VicGFjazovLy9leHRlcm5hbCBcImRlYnVnXCIiLC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0IGl0ZXJhdGlvbiBvZiB0aGUgbG9vcFxuICAgICAgICByZXR1cm4gYWNjdW11bGF0b3I7XG4gICAgICB9XG4gICAgfTtcblxuICAgIHJldHVybiBjYWxsYmFja3MucmVkdWNlKGZ1bmN0aW9uIChhY2N1bXVsYXRvciwgY2FsbGJhY2ssIGluZGV4KSB7XG4gICAgICBpZiAoaXNQcm9taXNlKGFjY3VtdWxhdG9yKSkge1xuICAgICAgICBpZiAoIWFzeW5jQ29udGV4dCkge1xuICAgICAgICAgIGRlYnVnQ2IoXG4gICAgICAgICAgICBgU3RhcnRlZCBhc3luYyBjb250ZXh0IGluIGhvb2sgJHtob29rTmFtZX1dIGJ5ICR7XG4gICAgICAgICAgICAgIGNhbGxiYWNrc1tpbmRleCAtIDFdICYmIGNhbGxiYWNrc1tpbmRleCAtIDFdLm5hbWVcbiAgICAgICAgICAgIH1gXG4gICAgICAgICAgKTtcbiAgICAgICAgICBhc3luY0NvbnRleHQgPSB0cnVlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgYWNjdW11bGF0b3JcbiAgICAgICAgICAgIC50aGVuKChyZXN1bHQpID0+IHtcbiAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAvLyBydW4gdGhpcyBjYWxsYmFjayBvbmNlIHdlIGhhdmUgdGhlIHByZXZpb3VzIHZhbHVlXG4gICAgICAgICAgICAgICAgcmVzb2x2ZShydW5DYWxsYmFjayhyZXN1bHQsIGNhbGxiYWNrKSk7XG4gICAgICAgICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgLy8gZXJyb3Igd2lsbCBiZSB0aHJvd24gb25seSBmb3IgYnJlYWtpbmcgZXJyb3JzLCBzbyB0aHJvdyBpdCB1cCBpbiB0aGUgcHJvbWlzZSBjaGFpblxuICAgICAgICAgICAgICAgIHJlamVjdChlcn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RpdGNoaW5nKVxuICBjb25zdCByZWd1bGFyRXJyb3JzID0gZ2V0KGdyYXBoUUxFcnJvcnMsIFwiMC5leHRlbnNpb25zLmV4Y2VwdGlvbi5lcnJvcnNcIik7XG5cbiAgcmV0dXJuIGFwb2xsb0Vycm9ycyB8fCByZWd1bGFyRXJyb3JzIHx8IGdyYXBoUUxFcnJvcnMgfHwgW107XG59O1xuIiwibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwibG9kYXNoL2dldFwiKTsiXSwic291cmNlUm9vdCI6IiJ9 + +/***/ }), + +/***/ 86980: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(96422)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 96422: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(80900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 81072: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(86980); +} else { + module.exports = __nccwpck_require__(87406); +} + + +/***/ }), + +/***/ 87406: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(33867); +const util = __nccwpck_require__(31669); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(96422)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 97255: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){e.exports=__nccwpck_require__(35001)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getModel=t.getModelConnector=void 0;t.getModelConnector=(e,t)=>{if(!e[t.graphql.typeName])throw new Error(`Model of typeName ${t.graphql.typeName} not found in Graphql context`);if(!e[t.graphql.typeName].connector)throw new Error(`Model ${t.graphql.typeName} found in Graphql context but connector is not defined`);return e[t.graphql.typeName].connector};t.getModel=(e,t)=>{var n;if(!e[t])throw new Error("No model found in the GraphQL context for typeName "+t);if(!(null===(n=e[t])||void 0===n?void 0:n.model))throw new Error(`TypeName ${t} found in the GraphQL context but it doesn't contain a "model" field.`);return e[t].model}},function(e,t){e.exports=__nccwpck_require__(24778)},function(e,t){e.exports=__nccwpck_require__(31032)},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(5),t),r(n(13),t),r(n(14),t),r(n(6),t),r(n(15),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mainTypeTemplate=t.fieldTemplate=t.getArguments=t.arrayToGraphQL=t.convertToGraphQL=void 0;t.convertToGraphQL=(e,n)=>e.length>0?e.map(e=>t.fieldTemplate(e,n)).join("\n"):"";t.arrayToGraphQL=e=>e.map(e=>`${e.name}: ${e.type}`).join(", ");t.getArguments=e=>Array.isArray(e)&&e.length>0?`(${t.arrayToGraphQL(e)})`:"string"==typeof e?`(${e})`:"";t.fieldTemplate=({name:e,type:n,args:a,directive:r,description:i,required:o},l="")=>`${i?`${l}# ${i}\n`:""}${l}${e}${t.getArguments(a)}: ${n} ${r||""}`;t.mainTypeTemplate=({typeName:e,description:n,interfaces:a,fields:r})=>`${n?"# "+n:""}\ntype ${e} ${a.length?`implements ${a.join(", ")} `:""}{\n${t.convertToGraphQL(r," ")}\n}\n`},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.customSortTemplate=t.customSortType=t.customFilterTemplate=t.customFilterType=t.fieldSortInputTemplate=t.sortInputType=t.fieldFilterInputTemplate=t.filterInputType=t.selectorUniqueInputTemplate=t.selectorUniqueInputType=t.selectorInputTemplate=t.selectorInputType=void 0;const a=n(5),r=n(0),i=["String","Int","Float","Boolean","Date"];t.selectorInputType=e=>e+"SelectorInput";t.selectorInputTemplate=({typeName:e,fields:n})=>`input ${t.selectorInputType(e)} {\n _and: [${t.selectorInputType(e)}]\n _or: [${t.selectorInputType(e)}]\n${a.convertToGraphQL(n," ")}\n}`;t.selectorUniqueInputType=e=>e+"SelectorUniqueInput";t.selectorUniqueInputTemplate=({typeName:e,fields:n})=>`input ${t.selectorUniqueInputType(e)} {\n _id: String\n documentId: String # OpenCRUD backwards compatibility\n slug: String\n${a.convertToGraphQL(n," ")}\n}`;const o=e=>r.capitalize(e.replace("_",""));t.filterInputType=e=>e+"FilterInput";t.fieldFilterInputTemplate=({typeName:e,fields:n,customFilters:a=[],customSorts:r=[]})=>`input ${t.filterInputType(e)} {\n _and: [${t.filterInputType(e)}]\n _not: ${t.filterInputType(e)}\n _or: [${t.filterInputType(e)}]\n${a.map(n=>` ${n.name}: ${t.customFilterType(e,n)}`)}\n${r.map(n=>` ${n.name}: ${t.customSortType(e,n)}`)}\n${n.map(e=>{const{name:t,type:n}=e,a=(e=>e.replace("[","").replace("]","").replace("!",""))(n);if((e=>i.includes(e))(a)){return` ${t}: ${a}_${"["===n[0]?"Array_":""}Selector`}return""}).join("\n")}\n}`;t.sortInputType=e=>e+"SortInput";t.fieldSortInputTemplate=({typeName:e,fields:n})=>`input ${t.sortInputType(e)} {\n${n.map(({name:e})=>` ${e}: SortOptions`).join("\n")}\n}`;t.customFilterType=(e,t)=>`${e}${o(t.name)}FilterInput`;t.customFilterTemplate=({typeName:e,filter:n})=>`input ${t.customFilterType(e,n)}{\n ${n.arguments}\n}`;t.customSortType=(e,t)=>`${e}${o(t.name)}SortInput`;t.customSortTemplate=({typeName:e,sort:n})=>`input ${t.customSortType(e,n)}{\n ${n.arguments}\n}`},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultFragmentText=t.getDefaultFragmentName=t.getFieldFragment=void 0;const a=n(3),r=({schema:e,fragmentName:n,options:i})=>{const o=a.getFragmentFieldNames({schema:e,options:i}).map(n=>t.getFieldFragment({schema:e,fieldName:n,options:i,getObjectFragment:r})).filter(e=>!!e);return o.length?`${n} { ${o.join("\n")} }`:null};t.getFieldFragment=({schema:e,fieldName:t,options:n,getObjectFragment:i=r})=>{if("_intl"===t.slice(-5))return t+"{ locale value }";if("_id"===t)return t;const o=e[t];switch(a.getFieldTypeName(o)){case"Object":return a.hasNestedSchema(o)?i({fragmentName:t,schema:a.getNestedSchema(o),options:n})||null:t;case"Array":const r=e[t+".$"];if(r){a.getFieldTypeName(r);if(a.hasNestedSchema(r))return i({fragmentName:t,schema:a.getNestedSchema(r),options:n})||null}return t;default:return t}};t.getDefaultFragmentName=e=>e.graphql.typeName+"DefaultFragment";t.getDefaultFragmentText=(e,n={onlyViewable:!0})=>{const a=e.schema;return r({schema:a,fragmentName:`fragment ${t.getDefaultFragmentName(e)} on ${e.graphql.typeName}`,options:n})||void 0},t.default=t.getDefaultFragmentText},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.mergeResolvers=void 0;const r=a(n(31));t.mergeResolvers=e=>e.reduce((e,t)=>r.default(e,t),{})},function(e,t){e.exports=__nccwpck_require__(53912)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;t.throwError=(...e)=>{throw console.error(...e),new Error(JSON.stringify(e))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{u(a.next(e))}catch(e){i(e)}}function l(e){try{u(a.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteMutator=t.updateMutator=t.createMutator=t.performMutationCheck=void 0;const i=n(42),o=n(45),l=n(10),u=n(2),s=n(1),p=n(0),c=r(n(46)),d=r(n(9)),m=n(2),f=({model:e,data:t,originalDocument:n,mutatorName:r,context:u,properties:s})=>a(void 0,void 0,void 0,(function*(){var a,p,c;const{typeName:d}=e.graphql,m=[...i.validateData({document:t,originalDocument:n,model:e,context:u,mutatorName:r}),...yield o.runCallbacks({hookName:`${d}.${r}.validate`,iterator:[],callbacks:(null===(c=null===(p=null===(a=null==e?void 0:e.graphql)||void 0===a?void 0:a.callbacks)||void 0===p?void 0:p[r])||void 0===c?void 0:c.validate)||[],args:[s]})];m.length&&l.throwError({id:"app.validation_error",data:{break:!0,errors:m}})})),y={create:"canCreate",update:"canUpdate",delete:"canDelete"};function h({dataId:e,selector:t,input:n,context:r,model:i}){return a(this,void 0,void 0,(function*(){if(e)t={_id:e};else if(t)p.deprecate("0.2.3","'selector' attribute of mutators is deprecated, use 'input' instead"),t=t;else if(n){const e=s.getModelConnector(r,i),a=yield e._filter(n,r);t=a.selector}return t}))}t.performMutationCheck=e=>{var t;const{user:n,document:a,model:r,operationName:i,asAdmin:o=!1}=e,{typeName:s}=r.graphql,p=null===(t=r.permissions)||void 0===t?void 0:t[y[i]];let c=!1;const d=`${s}:${i}`,m={documentId:null==a?void 0:a._id,operationName:d};p||l.throwError({id:"app.no_permissions_defined",data:m}),a||l.throwError({id:"app.document_not_found",data:m}),o||"function"!=typeof p?!o&&Array.isArray(p)&&(c=u.isMemberOf(n,p,a)):c=p(e),o||c||l.throwError({id:"app.operation_not_allowed",data:m})};t.createMutator=({model:e,data:n,currentUser:r,validate:i,asAdmin:l,context:u={}})=>a(void 0,void 0,void 0,(function*(){var a,p,d,y,h,g,v,T,$;let _=c.default(n);const{schema:N}=e;!r&&u.currentUser&&(r=u.currentUser);const b={data:_,originalData:n,currentUser:r,model:e,context:u,schema:N},{typeName:I}=e.graphql;t.performMutationCheck({user:r,document:_,model:e,operationName:"create",asAdmin:l}),i&&(yield f({model:e,data:_,mutatorName:"create",context:u,properties:b})),!_.userId&&N.hasOwnProperty("userId")&&r&&(_.userId=r._id);for(let e of Object.keys(N))try{let t;N[e].onCreate&&(t=yield N[e].onCreate(b)),void 0!==t&&(_[e]=t)}catch(t){console.log("// Autovalue error on field "+e),console.log(t)}_=yield o.runCallbacks({hookName:I+".create.before",callbacks:(null===(d=null===(p=null===(a=e.graphql)||void 0===a?void 0:a.callbacks)||void 0===p?void 0:p.create)||void 0===d?void 0:d.before)||[],iterator:_,args:[b]});const M=s.getModelConnector(u,e);let O=yield M.create(_);return O=yield o.runCallbacks({hookName:I+".create.after",callbacks:(null===(g=null===(h=null===(y=e.graphql)||void 0===y?void 0:y.callbacks)||void 0===h?void 0:h.create)||void 0===g?void 0:g.after)||[],iterator:O,args:[b]}),o.runCallbacks({hookName:I+".create.async",callbacks:(null===($=null===(T=null===(v=e.graphql)||void 0===v?void 0:v.callbacks)||void 0===T?void 0:T.create)||void 0===$?void 0:$.async)||[],args:[b]}),l||(O=m.restrictViewableFields(r,e,O)),{data:O}}));t.updateMutator=({model:e,dataId:n,selector:r,input:l,data:u,set:p={},unset:y={},currentUser:g,validate:v,asAdmin:T,context:$={}})=>a(void 0,void 0,void 0,(function*(){var a,_,N,b,I,M,O,q,S;const{typeName:D}=e.graphql,{schema:w}=e;let j;l?j=c.default(l.data):(j=c.default(u),j||(j=i.modifierToData({$set:p,$unset:y}))),!g&&$.currentUser&&(g=$.currentUser);const x=n||(null==l?void 0:l.id)||(null==j?void 0:j._id),F=yield h({dataId:x,selector:r,input:l,context:$,model:e});if(d.default(F))throw new Error("Selector cannot be empty, please give an id or a proper input");const C=s.getModelConnector($,e),k=yield C.findOne(F);t.performMutationCheck({user:g,document:k,model:e,operationName:"update",asAdmin:T});let P=k;const Q={data:j,originalData:c.default(j),originalDocument:P,currentUser:g,model:e,context:$,schema:w};v&&(yield f({model:e,data:j,originalDocument:P,mutatorName:"update",context:$,properties:Q}));for(let e of Object.keys(w)){let t;w[e].onUpdate&&(t=yield w[e].onUpdate(Q)),void 0!==t&&(j[e]=t)}j=yield o.runCallbacks({hookName:D+".update.before",callbacks:(null===(N=null===(_=null===(a=e.graphql)||void 0===a?void 0:a.callbacks)||void 0===_?void 0:_.update)||void 0===N?void 0:N.before)||[],iterator:j,args:[Q]});const A=i.dataToModifier(j);let U;return d.default(A.$set)&&delete A.$set,d.default(A.$unset)&&delete A.$unset,d.default(A)||(U=yield C.update(F,A,{removeEmptyStrings:!1})),U=yield o.runCallbacks({hookName:D+".update.after",callbacks:(null===(M=null===(I=null===(b=e.graphql)||void 0===b?void 0:b.callbacks)||void 0===I?void 0:I.update)||void 0===M?void 0:M.after)||[],iterator:U,args:[Q]}),o.runCallbacks({hookName:e.graphql.typeName.toLowerCase()+".update.async",callbacks:(null===(S=null===(q=null===(O=e.graphql)||void 0===O?void 0:O.callbacks)||void 0===q?void 0:q.update)||void 0===S?void 0:S.async)||[],args:[Q]}),T||(U=m.restrictViewableFields(g,e,U)),{data:U}}));t.deleteMutator=({model:e,dataId:n,selector:r,input:i,currentUser:l,validate:u,asAdmin:p,context:c={}})=>a(void 0,void 0,void 0,(function*(){var a,y,g,v,T,$,_,N,b;const{typeName:I}=e.graphql,{schema:M}=e;!l&&c.currentUser&&(l=c.currentUser);const O=n||(null==i?void 0:i.id),q=yield h({dataId:O,selector:r,input:i,context:c,model:e});if(d.default(q))throw new Error("Selector cannot be empty, please give an id or a proper input");const S=s.getModelConnector(c,e);let D=yield S.findOne(q);t.performMutationCheck({user:l,document:D,model:e,operationName:"delete",asAdmin:p});let w=D;const j={document:w,currentUser:l,model:e,context:c,schema:M};u&&(yield f({model:e,mutatorName:"delete",context:c,properties:j}));for(let e of Object.keys(M))M[e].onDelete&&(yield M[e].onDelete(j));return w=yield o.runCallbacks({hookName:I+".delete.before",callbacks:(null===(g=null===(y=null===(a=e.graphql)||void 0===a?void 0:a.callbacks)||void 0===y?void 0:y.delete)||void 0===g?void 0:g.before)||[],iterator:w,args:[j]}),yield S.delete(q),w=yield o.runCallbacks({hookName:I+".delete.after",callbacks:(null===($=null===(T=null===(v=e.graphql)||void 0===v?void 0:v.callbacks)||void 0===T?void 0:T.delete)||void 0===$?void 0:$.after)||[],iterator:w,args:[j]}),o.runCallbacks({hookName:e.graphql.typeName.toLowerCase()+".delete.async",callbacks:(null===(b=null===(N=null===(_=e.graphql)||void 0===_?void 0:_.callbacks)||void 0===N?void 0:N.delete)||void 0===b?void 0:b.async)||[],args:[j]}),p||(w=m.restrictViewableFields(l,e,w)),{data:w}}))},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(4),t),r(n(16),t),r(n(17),t),r(n(7),t),r(n(19),t),r(n(20),t),r(n(21),t),r(n(37),t),r(n(38),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiClientTemplate=t.singleClientTemplate=t.multiOutputTemplate=t.multiOutputType=t.singleOutputTemplate=t.singleOutputType=t.multiInputTemplate=t.multiInputType=t.singleInputTemplate=t.singleInputType=t.multiQueryTemplate=t.multiQueryType=t.singleQueryTemplate=t.singleOperationName=t.singleQueryType=void 0;const a=n(6),r=n(0);t.singleQueryType=e=>r.camelCaseify(e);t.singleOperationName=e=>t.singleQueryType(e.graphql.typeName);t.singleQueryTemplate=({typeName:e})=>`${t.singleQueryType(e)}(input: ${t.singleInputType(e,!0)}): ${t.singleOutputType(e)}`;t.multiQueryType=e=>r.camelCaseify(e);t.multiQueryTemplate=({typeName:e,multiTypeName:n})=>`${t.multiQueryType(n)}(input: ${t.multiInputType(e,!1)}): ${t.multiOutputType(e)}`;t.singleInputType=(e,t=!1)=>`Single${e}Input${t?"!":""}`;t.singleInputTemplate=({typeName:e})=>`input ${t.singleInputType(e)} {\n # filtering\n filter: ${a.filterInputType(e)}\n sort: ${a.sortInputType(e)}\n search: String\n id: String\n\n # backwards-compatibility\n # Deprecated (use 'filter/id' fields instead).\n selector: ${a.selectorUniqueInputType(e)}\n\n # options (backwards-compatibility)\n # Whether to enable caching for this query\n enableCache: Boolean\n # Return null instead of throwing MissingDocumentError\n allowNull: Boolean\n # An identifier to name the query's execution context\n contextName: String\n}`;t.multiInputType=(e,t=!1)=>`Multi${e}Input${t?"!":""}`;t.multiInputTemplate=({typeName:e})=>`input ${t.multiInputType(e)} {\n\n # filtering\n filter: ${a.filterInputType(e)}\n sort: ${a.sortInputType(e)}\n search: String\n offset: Int\n limit: Int\n\n # backwards-compatibility\n # A JSON object that contains the query terms used to fetch data\n # Deprecated (use 'filter/id' fields instead).\n terms: JSON\n\n # options (backwards-compatibility)\n # Whether to enable caching for this query\n enableCache: Boolean\n # Whether to calculate totalCount for this query\n enableTotal: Boolean\n # An identifier to name the query's execution context\n contextName: String\n\n}`;t.singleOutputType=e=>`Single${e}Output`;t.singleOutputTemplate=({typeName:e})=>`type ${t.singleOutputType(e)}{\n result: ${e}\n}`;t.multiOutputType=e=>` Multi${e}Output`;t.multiOutputTemplate=({typeName:e})=>`type ${t.multiOutputType(e)}{\n results: [${e}]\n totalCount: Int\n}`;t.singleClientTemplate=({typeName:e,fragmentName:n,extraQueries:a})=>`query ${t.singleQueryType(e)}($input: ${t.singleInputType(e,!0)}) {\n ${t.singleQueryType(e)}(input: $input) {\n result {\n ...${n}\n }\n # __typename\n }\n ${a||""}\n}`;t.multiClientTemplate=({typeName:e,multiTypeName:n,fragmentName:a,extraQueries:r})=>`query ${t.multiQueryType(n)}($input: ${t.multiInputType(e,!1)}) {\n ${t.multiQueryType(n)}(input: $input) {\n results {\n ...${a}\n }\n totalCount\n # __typename\n }\n ${r||""}\n}`},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deleteClientTemplate=t.upsertClientTemplate=t.updateClientTemplate=t.createClientTemplate=t.mutationOutputTemplate=t.mutationOutputType=t.updateDataInputTemplate=t.updateDataInputType=t.createDataInputTemplate=t.createDataInputType=t.deleteInputTemplate=t.deleteInputType=t.upsertInputTemplate=t.upsertInputType=t.updateInputTemplate=t.updateInputType=t.createInputTemplate=t.createInputType=t.deleteMutationTemplate=t.deleteMutationType=t.upsertMutationTemplate=t.upsertMutationType=t.updateMutationTemplate=t.updateOperationName=t.updateMutationType=t.createMutationTemplate=t.createOperationName=t.createMutationType=void 0;const a=n(5),r=n(6),i="# Deprecated (use 'input' field instead).";t.createMutationType=e=>"create"+e;t.createOperationName=e=>t.createMutationType(e.graphql.typeName);t.createMutationTemplate=({typeName:e})=>`${t.createMutationType(e)}(\n input: ${t.createInputType(e)},\n ${i}\n data: ${t.createDataInputType(e,!1)}\n) : ${t.mutationOutputType(e)}`;t.updateMutationType=e=>"update"+e;t.updateOperationName=e=>t.updateMutationType(e.graphql.typeName);t.updateMutationTemplate=({typeName:e})=>`${t.updateMutationType(e)}(\n input: ${t.updateInputType(e)},\n ${i}\n selector: ${r.selectorUniqueInputType(e)},\n ${i}\n data: ${t.updateDataInputType(e)}\n) : ${t.mutationOutputType(e)}`;t.upsertMutationType=e=>"upsert"+e;t.upsertMutationTemplate=({typeName:e})=>`${t.upsertMutationType(e)}(\n input: ${t.upsertInputType(e)},\n ${i}\n selector: ${r.selectorUniqueInputType(e)},\n ${i}\n data: ${t.updateDataInputType(e,!1)}\n) : ${t.mutationOutputType(e)}`;t.deleteMutationType=e=>"delete"+e;t.deleteMutationTemplate=({typeName:e})=>`${t.deleteMutationType(e)}(\n input: ${t.deleteInputType(e)},\n ${i}\n selector: ${r.selectorUniqueInputType(e)}\n) : ${t.mutationOutputType(e)}`;t.createInputType=e=>`Create${e}Input`;t.createInputTemplate=({typeName:e})=>`input ${t.createInputType(e)} {\n data: ${t.createDataInputType(e,!0)}\n # An identifier to name the mutation's execution context\n contextName: String\n}`;t.updateInputType=e=>`Update${e}Input`;t.updateInputTemplate=({typeName:e})=>`input ${t.updateInputType(e)}{\n filter: ${r.filterInputType(e)}\n id: String\n data: ${t.updateDataInputType(e,!0)}\n # An identifier to name the mutation's execution context\n contextName: String\n}`;t.upsertInputType=e=>`Upsert${e}Input`;t.upsertInputTemplate=({typeName:e})=>`input ${t.upsertInputType(e)}{\n filter: ${r.filterInputType(e)}\n id: String\n data: ${t.updateDataInputType(e,!0)}\n # An identifier to name the mutation's execution context\n contextName: String\n}`;t.deleteInputType=e=>`Delete${e}Input`;t.deleteInputTemplate=({typeName:e})=>`input ${t.deleteInputType(e)}{\n filter: ${r.filterInputType(e)}\n id: String\n}`;t.createDataInputType=(e,t=!1)=>`Create${e}DataInput${t?"!":""}`;t.createDataInputTemplate=({typeName:e,fields:n})=>`input ${t.createDataInputType(e)} {\n${a.convertToGraphQL(n," ")}\n}`;t.updateDataInputType=(e,t=!1)=>`Update${e}DataInput${t?"!":""}`;t.updateDataInputTemplate=({typeName:e,fields:n})=>`input ${t.updateDataInputType(e)} {\n${a.convertToGraphQL(n," ")}\n}`;t.mutationOutputType=e=>e+"MutationOutput";t.mutationOutputTemplate=({typeName:e})=>`type ${t.mutationOutputType(e)}{\n data: ${e}\n}`;t.createClientTemplate=({typeName:e,fragmentName:n})=>`mutation ${t.createMutationType(e)}($input: ${t.createInputType(e)}, $data: ${t.createDataInputType(e)}) {\n ${t.createMutationType(e)}(input: $input, data: $data) {\n data {\n ...${n}\n }\n }\n}`;t.updateClientTemplate=({typeName:e,fragmentName:n})=>`mutation ${t.updateMutationType(e)}($input: ${t.updateInputType(e)}, $selector: ${r.selectorUniqueInputType(e)}, $data: ${t.updateDataInputType(e,!1)}) {\n ${t.updateMutationType(e)}(input: $input, selector: $selector, data: $data) {\n data {\n ...${n}\n }\n }\n}`;t.upsertClientTemplate=({typeName:e,fragmentName:n})=>`mutation ${t.upsertMutationType(e)}($input: ${t.upsertInputType(e)}, $selector: ${r.selectorUniqueInputType(e)}, $data: ${t.updateDataInputType(e,!1)}) {\n ${t.upsertMutationType(e)}(input: $input, selector: $selector, data: $data) {\n data {\n ...${n}\n }\n }\n}`;t.deleteClientTemplate=({typeName:e,fragmentName:n})=>`mutation ${t.deleteMutationType(e)}($input: ${t.deleteInputType(e)}, $selector: ${r.selectorUniqueInputType(e)}) {\n ${t.deleteMutationType(e)}(input: $input, selector: $selector) {\n data {\n ...${n}\n }\n }\n}`},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.autocompleteQueryTemplate=t.fieldStaticQueryTemplate=t.fieldDynamicQueryTemplate=void 0;const a=n(0);t.fieldDynamicQueryTemplate=({queryResolverName:e,autocompletePropertyName:t})=>`query FormComponent${a.capitalize(e)}Query($value: [String!]) {\n ${e}(input: { \n filter: { _id: { _in: $value } },\n sort: { ${t}: asc }\n }){\n results{\n _id\n ${t}\n }\n }\n }\n`;t.fieldStaticQueryTemplate=({queryResolverName:e,autocompletePropertyName:t})=>`query FormComponent${a.capitalize(e)}Query {\n ${e}(input: { \n \n sort: { ${t}: asc }\n }){\n results{\n _id\n ${t}\n }\n }\n}\n`;t.autocompleteQueryTemplate=({queryResolverName:e,autocompletePropertyName:t})=>`\n query Autocomplete${a.capitalize(e)}Query($queryString: String) {\n ${e}(\n input: {\n filter: {\n ${t}: { _like: $queryString }\n },\n limit: 20\n }\n ){\n results{\n _id\n ${t}\n }\n }\n }\n`},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);rt=>{const n=t.name,{typeName:a=n,multiTypeName:r,queryResolvers:l,mutationResolvers:u}=e,s=o.camelCaseify(a),p=o.camelCaseify(r),c=Object.assign({singleResolverName:s,multiResolverName:p},e),d=Object.assign(Object.assign({},t),{graphql:c}),m=i.getDefaultFragmentText(d),f=i.getDefaultFragmentName(d);m||console.warn(`Could not generate a default fragment for type ${c.typeName}.\n Please make at least one field of the model ${t.name} readable, using canRead.`);const y=Object.assign(Object.assign({},c),{defaultFragment:m,defaultFragmentName:f,queryResolvers:l,mutationResolvers:u});return Object.assign(Object.assign({},t),{graphql:y})};t.createGraphqlModel=e=>{const{graphql:t}=e,n=a(e,["graphql"]);return r.createModel(Object.assign(Object.assign({},n),{extensions:[l(e.graphql)]}))},t.default=l},function(e,t){e.exports=__nccwpck_require__(32969)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getModelFragment=void 0;t.getModelFragment=({model:e,fragment:t,fragmentName:n})=>{const{defaultFragment:a,defaultFragmentName:r}=e.graphql,i=t||a,o=n||r;if(!i)throw new Error(`Model ${e.name} has no default fragment, maybe it is empty or have only nested fields?\n Please pass a fragment explicitely.`);if(!o)throw new Error(`Model ${e.name} has no default fragment name, maybe it is empty or have only nested fields?\n Please pass a fragmentName explicitely.`);return{finalFragment:i,finalFragmentName:o}}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildApolloSchema=void 0;const r=n(22),i=n(34),o=n(8),l=a(n(9));t.buildApolloSchema=e=>{if(!e.length)throw new Error("You need at least one Vulcan model when calling buildApolloSchema");const{resolvers:t,typeDefs:n}=r.parseAllModels(e),a=`${i.defaultTypeDefs}\n${n}`,u=o.mergeResolvers([i.defaultResolvers,t]);return l.default(u.Query)&&delete u.Query,l.default(u.Mutation)&&delete u.Mutation,{resolvers:u,typeDefs:a}}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseAllModels=void 0;const r=n(23),i=a(n(24)),o=n(8),l=a(n(32)),u=n(33);r.disableFragmentWarnings();t.parseAllModels=e=>{const t=e.map(i.default),n=l.default(t.map(e=>e.queries).filter(e=>!!e)),a=l.default(t.map(e=>e.mutations).filter(e=>!!e)),r=`${t.map(e=>e.typeDefs).join()}\n\n${u.generateQueryTypeDefs(n)}\n\n${u.generateMutationTypeDefs(a)}`,s=t.map(e=>e.resolvers).filter(e=>!!e),p=t.map(e=>e.schemaResolvers).filter(e=>!!e).map(e=>o.mergeResolvers(e));return{typeDefs:r,resolvers:o.mergeResolvers([...s,...p])}}},function(e,t){e.exports=__nccwpck_require__(86790)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseModel=void 0;const a=n(25),r=n(4),i=n(30),o=({model:e,typeName:t,description:n,interfaces:a=[],fields:i,isNested:o=!1})=>{const l=[],{mainType:u,create:s,update:p,selector:c,selectorUnique:d,readable:m,filterable:f}=i;if(!(null==e?void 0:e.graphql.typeName)&&!t)throw new Error("model.graphql.typeName is undefined, please provide typeName as arguments in generateTypeDefs");const y=e?e.graphql.typeName:t;if(!u||0===u.length)throw new Error(`GraphQL type ${y} has no readable fields. Please add readable fields or remove the type.`);if(l.push(r.mainTypeTemplate({typeName:y,description:n,interfaces:a,fields:u})),o)return s.length&&(l.push(r.createInputTemplate({typeName:y})),l.push(r.createDataInputTemplate({typeName:y,fields:s}))),p.length&&(l.push(r.updateInputTemplate({typeName:y})),l.push(r.upsertInputTemplate({typeName:y})),l.push(r.updateDataInputTemplate({typeName:y,fields:p}))),f.length&&(l.push(r.fieldFilterInputTemplate({typeName:y,fields:f})),l.push(r.fieldSortInputTemplate({typeName:y,fields:f}))),l;if(l.push(r.singleInputTemplate({typeName:y})),l.push(r.multiInputTemplate({typeName:y})),l.push(r.singleOutputTemplate({typeName:y})),l.push(r.multiOutputTemplate({typeName:y})),l.push(r.mutationOutputTemplate({typeName:y})),l.push(r.deleteInputTemplate({typeName:y})),s.length&&(l.push(r.createInputTemplate({typeName:y})),l.push(r.createDataInputTemplate({typeName:y,fields:s}))),p.length&&(l.push(r.updateInputTemplate({typeName:y})),l.push(r.upsertInputTemplate({typeName:y})),l.push(r.updateDataInputTemplate({typeName:y,fields:p}))),f.length){const e=[];l.push(r.fieldFilterInputTemplate({typeName:y,fields:f,customFilters:e})),(null==e?void 0:e.length)&&e.forEach(e=>{l.push(r.customFilterTemplate({typeName:y,filter:e}))});l.push(r.fieldSortInputTemplate({typeName:y,fields:f}))}return l.push(r.selectorInputTemplate({typeName:y,fields:c})),l.push(r.selectorUniqueInputTemplate({typeName:y,fields:d})),l};t.parseModel=e=>{const t=[],{schema:n,name:r}=e,{typeName:l,multiTypeName:u}=e.graphql,{nestedFieldsList:s,fields:p,resolvers:c}=a.parseSchema(n,l),{mainType:d}=p;if(!d.length)return console.warn(`// Warning: model ${e.name} doesn't have any GraphQL-enabled fields, so no corresponding type can be generated. Pass generateGraphQLSchema = false to createCollection() to disable this warning`),{typeDefs:""};if(t.push(...o({model:e,fields:p,isNested:!1})),s)for(const e of s)t.push(...o({typeName:e.typeName,fields:e.fields,isNested:!0}));const m={};let f,y;const h=e.graphql.queryResolvers,g=e.graphql.mutationResolvers;if(h){const e=i.parseQueryResolvers({queryResolverDefinitions:h,typeName:l,multiTypeName:u});f=e.queries,m.Query=e.queryResolvers}if(g){const e=i.parseMutationResolvers({mutationDefinitions:g,typeName:l,modelName:r,fields:p});y=e.mutations,m.Mutation=e.mutationResolvers}return{typeDefs:t.join("\n\n")+"\n\n\n",queries:f,mutations:y,schemaResolvers:c,resolvers:m}},t.default=t.parseModel},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.parseSchema=t.parseQueriable=t.parseMutable=t.parseFieldResolvers=t.getNestedGraphQLType=void 0;const o=n(3),l=n(26),u=n(27),s=n(0),p=i(n(28)),c=n(29);t.getNestedGraphQLType=(e,t,n)=>`${e}${s.capitalize(o.unarrayfyFieldName(t))}${n?"Input":""}`;const d=e=>!!e.typeName;t.parseFieldResolvers=({typeName:e,field:t,fieldName:n,fieldType:a,fieldDescription:r,fieldDirective:i,fieldArguments:l})=>{const u={mainType:[]},s=[],d=t.relation,m=t.resolveAs?Array.isArray(t.resolveAs)?t.resolveAs:[t.resolveAs]:[];if(!m.length&&!d)throw new Error(`Neither resolver nor relation is defined for field ${n} of model ${e}.`);if(m.length&&d)throw new Error(`Defined both a custom resolver and a relation for field ${n} of model ${e}.`);if(d){const o=p[d.kind]({fieldName:n,relation:d}),m=c.withFieldPermissionCheckResolver(t,o),f=d.fieldName,y={[e]:{[f]:m}};s.push(y),a&&u.mainType.push({description:r,name:n,args:l,type:a,directive:i}),u.mainType.push({name:f,type:d.typeName})}else if(m){o.shouldAddOriginalField(n,t)&&a&&u.mainType.push({description:r,name:n,args:l,type:a,directive:i}),m.forEach(r=>{const i=r.fieldName||n,o=r.resolver,l=r.typeName||r.type||a;l&&u.mainType.push({description:r.description,name:i,args:r.arguments,type:l});const p=o&&c.withFieldPermissionCheckResolver(t,o),d={[e]:{[i]:p}};s.push(d)})}return{fields:u,resolvers:s}};const m=(e,t)=>t&&t.length?"["===t[0]?`[${e}${t.slice(1,-1)}]`:e+t:t,f=(e,t)=>e&&e.length?"["===e[0]?`[${e.slice(1,-1)}${t}]`:e+t:e;t.parseMutable=({field:e,fieldName:t,fieldType:n,inputFieldType:a,hasNesting:r=!1})=>{const i={create:[],update:[]},{canRead:o,canCreate:l,canUpdate:u,selectable:s,unique:p,apiOnly:c}=e,d=r?f(m("Create",n),"DataInput"):a,y=r?f(m("Update",n),"DataInput"):a;return l&&i.create.push({name:t,type:d,required:!e.optional}),u&&i.update.push({name:t,type:y}),i};t.parseQueriable=({field:e,fieldName:t,fieldType:n,inputFieldType:a,hasNesting:r=!1})=>{const i={selector:[],selectorUnique:[],sort:[],readable:[],filterable:[]},{canRead:o,canCreate:l,canUpdate:u,selectable:s,unique:p,apiOnly:c}=e;r&&f(m("Create",n),"DataInput"),r&&f(m("Update",n),"DataInput");return o&&(i.readable.push({name:t,type:n}),c||i.filterable.push({name:t,type:n})),s&&i.selector.push({name:t,type:a}),s&&p&&i.selectorUnique.push({name:t,type:a}),i};t.parseSchema=(e,n)=>{if(!e)throw new Error("No schema for typeName "+n);const a={mainType:[],selector:[],selectorUnique:[],sort:[],readable:[],create:[],update:[],filterable:[]},r=[],i=[];return Object.keys(e).forEach(s=>{const p=e[s],c=l.getGraphQLType({schema:e,fieldName:s,typeName:n});if(!c)return;const m=l.getGraphQLType({schema:e,fieldName:s,typeName:n,isInput:!0}),f=o.hasNestedSchema(p),y=o.hasArrayNestedChild(s,e)&&o.hasNestedSchema(o.getArrayChild(s,e))&&!u.isIntlField(p)&&!u.isIntlDataField(p),h=d(p),g=o.getArrayChild(s,e),v=g&&d(g),T=!o.isBlackbox(p)&&(y||f||h||v);if(((e=>e.canRead||e.canCreate||e.canUpdate)(p)||(e=>{const t=e.viewableBy||e.insertableBy||e.editableBy;return t&&console.warn("Some field is using legacy permission fields viewableBy, insertableBy and editableBy. Please replace those fields with canRead, canCreate and canUpdate."),t})(p))&&!o.isArrayChildField(s)){const l=p.description,d=u.isIntlField(p)?"@intl":"",h=u.isIntlField(p)?[{name:"locale",type:"String"}]:[];if(p.resolveAs||p.relation){const{fields:e,resolvers:r}=t.parseFieldResolvers({typeName:n,field:p,fieldName:s,fieldType:c,fieldDescription:l,fieldDirective:d,fieldArguments:h});i.push(...r),a.mainType.push(...e.mainType)}else a.mainType.push({description:l,name:s,args:h,type:c,directive:d});const g=t.parseMutable({field:p,fieldName:s,fieldType:c,inputFieldType:m,hasNesting:T}),v=t.parseQueriable({field:p,fieldName:s,fieldType:c,inputFieldType:m,hasNesting:T});if(a.create.push(...g.create),a.update.push(...g.update),a.selector.push(...v.selector),a.selectorUnique.push(...v.selectorUnique),a.sort.push(...v.sort),a.readable.push(...v.readable),a.filterable.push(...v.filterable),!p.typeName&&f){const e=o.getNestedSchema(p),a=t.getNestedGraphQLType(n,s),i=t.parseSchema(e,a);i.typeName=a,r.push(i)}if(y&&!o.getArrayChild(s,e).typeName){const a=o.getArrayChildSchema(s,e),i=t.getNestedGraphQLType(n,s),l=t.parseSchema(a,i);l.typeName=i,r.push(l)}}}),{fields:a,nestedFieldsList:r,resolvers:i}},t.default=t.parseSchema},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNestedGraphQLType=t.getGraphQLType=void 0;const a=n(0),r=n(3);t.getGraphQLType=({fieldSchema:e,schema:n,fieldName:a,typeName:i,isInput:o=!1,isParentBlackbox:l=!1})=>{const u=e||n[a];if(u.typeName)return u.typeName;const s=r.getFieldTypeName(u);if(u.isIntlData)return o?"[IntlValueInput]":"[IntlValue]";switch(s){case"String":return"String";case"Boolean":return"Boolean";case"Number":return"Float";case"SimpleSchema.Integer":return"Int";case"Array":const e=a+".$";if(n[e]){const a=t.getGraphQLType({schema:n,fieldName:e,typeName:i,isInput:o,isParentBlackbox:l||r.isBlackbox(u)});return a?`[${a}]`:null}return null;case"Object":return l?"JSON":r.isBlackbox(u)?u.typeName&&"JSON"!==u.typeName?o?u.typeName+"Input":u.typeName:"JSON":t.getNestedGraphQLType(i,a,o);case"Date":return"Date";default:return null}};t.getNestedGraphQLType=(e,t,n)=>`${e}${a.capitalize(r.unarrayfyFieldName(t))}${n?"Input":""}`},function(e,t){e.exports=__nccwpck_require__(81084)},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{u(a.next(e))}catch(e){i(e)}}function l(e){try{u(a.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.hasMany=t.hasOne=void 0;const r=n(1),i=n(2);t.hasOne=({fieldName:e,relation:t})=>(n,o,l)=>a(void 0,void 0,void 0,(function*(){if(!n[e])return null;const a=n[e],o=r.getModel(l,t.typeName),u=yield r.getModelConnector(l,o).findOneById(a);return u?i.restrictViewableFields(l.currentUser,o,u):null}));t.hasMany=({fieldName:e,relation:t})=>(n,o,l)=>a(void 0,void 0,void 0,(function*(){const a=n[e];if(!a)return null;if(!a.length)return[];const o=r.getModel(l,t.typeName),u=r.getModelConnector(l,o),s={filter:{_id:{_in:a}}};let{selector:p}=yield u._filter(s,l);const c=yield u.find(p);return i.restrictViewableFields(l.currentUser,o,c)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withFieldPermissionCheckResolver=void 0;const a=n(2);t.withFieldPermissionCheckResolver=(e,t)=>(n,r,i,o)=>{const{currentUser:l}=i;return a.canReadField(l,e,n)?t(n,r,i,o):Promise.resolve(null)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseMutationResolvers=t.parseQueryResolvers=void 0;const a=n(4),r=n(0);t.parseQueryResolvers=({queryResolverDefinitions:e,typeName:t,multiTypeName:n})=>{const i={},o=[];if(!e)return{queries:o,queryResolvers:i};if(null==e?void 0:e.single){const{single:n}=e;o.push({query:a.singleQueryTemplate({typeName:t}),description:n.description}),i[r.camelCaseify(t)]=n.resolver.bind(n)}if(null==e?void 0:e.multi){const{multi:l}=e;o.push({query:a.multiQueryTemplate({typeName:t,multiTypeName:n}),description:l.description}),i[r.camelCaseify(n)]=l.resolver.bind(l)}return{queries:o,queryResolvers:i}};t.parseMutationResolvers=({mutationDefinitions:e,typeName:t,modelName:n,fields:r})=>{const i={},o=[];if(!e)return{mutationResolvers:i,mutations:o};if(e.create){const{create:l}=e;0===r.create.length?console.log(`// Warning: you defined a "create" mutation for model ${n}, but it doesn't have any mutable fields, so no corresponding mutation types can be generated. Remove the "create" mutation or define a "canCreate" property on a field to disable this warning`):(o.push({mutation:a.createMutationTemplate({typeName:t}),description:l.description}),i["create"+t]=l.mutation.bind(l))}if(e.update){const{update:l}=e;0===r.update.length?console.log(`// Warning: you defined an "update" mutation for model ${n}, but it doesn't have any mutable fields, so no corresponding mutation types can be generated. Remove the "update" mutation or define a "canUpdate" property on a field to disable this warning`):(o.push({mutation:a.updateMutationTemplate({typeName:t}),description:l.description}),i["update"+t]=l.mutation.bind(l))}return e.delete&&(o.push({mutation:a.deleteMutationTemplate({typeName:t}),description:e.delete.description}),i["delete"+t]=e.delete.mutation.bind(e.delete)),{mutationResolvers:i,mutations:o}}},function(e,t){e.exports=__nccwpck_require__(56323)},function(e,t){e.exports=__nccwpck_require__(42394)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateMutationTypeDefs=t.generateQueryTypeDefs=void 0;t.generateQueryTypeDefs=(e=[])=>0===e.length?"":`type Query {\n${e.map(e=>`${e.description?` # ${e.description}\n`:""} ${e.query}\n `).join("\n")}\n}\n `;t.generateMutationTypeDefs=(e=[])=>0===e.length?"":`type Mutation {\n${e.map(e=>`${e.description?` # ${e.description}\n`:""} ${e.mutation}\n`).join("\n")}\n}\n`},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defaultTypeDefs=t.defaultResolvers=void 0;const r=a(n(35)),i=a(n(36));t.defaultResolvers={JSON:r.default,Date:i.default},t.defaultTypeDefs="\nscalar JSON\nscalar Date\n\n# see https://docs.hasura.io/1.0/graphql/manual/queries/query-filters.html\n\ninput String_Selector {\n _eq: String\n #_gt: String\n #_gte: String\n #_ilike: String\n _in: [String!]\n _is_null: Boolean\n _like: String\n #_lt: String\n #_lte: String\n _neq: String\n #_nilike: String\n #_nin: [String!]\n #_nlike: String\n #_nsimilar: String\n #_similar: String\n}\n\ninput String_Array_Selector {\n _in: [String!]\n _contains: String\n # _contains_all: [String_Selector]\n}\n\ninput Int_Selector {\n _eq: Int\n _gt: Int\n _gte: Int\n _in: [Int!]\n #_is_null: Boolean\n _lt: Int\n _lte: Int\n _neq: Int\n #_nin: [Int!]\n}\n\ninput Int_Array_Selector {\n contains: Int_Selector\n # contains_all: [Int_Selector]\n}\n\ninput Float_Selector {\n _eq: Float\n _gt: Float\n _gte: Float\n _in: [Float!]\n #_is_null: Boolean\n _lt: Float\n _lte: Float\n _neq: Float\n #_nin: [Float!]\n}\n\ninput Float_Array_Selector {\n contains: Float_Selector\n # contains_all: [Float_Selector]\n}\n\ninput Boolean_Selector {\n _eq: Boolean\n _neq: Boolean\n}\n\ninput Boolean_Array_Selector {\n contains: Boolean_Selector\n # contains_all: [Boolean_Selector]\n}\n\ninput Date_Selector {\n _eq: Date\n _gt: Date\n _gte: Date\n _in: [Date!]\n #_is_null: Boolean\n _lt: Date\n _lte: Date\n _neq: Date\n #_nin: [Date!]\n}\n\ninput Date_Array_Selector {\n contains: Date_Selector\n # contains_all: [Date_Selector]\n}\n\n# column ordering options\nenum SortOptions {\n asc\n desc\n}\n\ninput OptionsInput {\n # Whether to enable caching for this query\n enableCache: Boolean\n # For single document queries, return null instead of throwing MissingDocumentError\n allowNull: Boolean\n}"},function(e,t){e.exports=__nccwpck_require__(57636)},function(e,t){e.exports=__nccwpck_require__(57977)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(39),t),r(n(41),t),r(n(47),t),r(n(48),t),r(n(11),t),r(n(1),t)},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{u(a.next(e))}catch(e){i(e)}}function l(e){try{u(a.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.buildDefaultQueryResolvers=void 0;const i=n(2),o=n(1),l=r(n(40)),u=n(1),s=n(10),p=l.default("vulcan:graphql"),c={cacheMaxAge:300};t.buildDefaultQueryResolvers=function({typeName:e,options:t}){const n=Object.assign(Object.assign({},c),t||{});return{multi:{description:`A list of ${e} documents matching a set of query terms`,resolver(t,{input:r={}},l,{cacheControl:d}){return a(this,void 0,void 0,(function*(){const t=u.getModel(l,e),{enableCache:a=!1,enableTotal:m=!0}=r,f=e+".read.multi";if(d&&a){const e=n.cacheMaxAge||c.cacheMaxAge;d.setCacheHint({maxAge:e})}const y=o.getModelConnector(l,t),{currentUser:h}=l;let{selector:g,options:v}=yield y._filter(r,l);const T=Object.keys(g);i.checkFields(h,t,T),v.skip=r.offset,p({selector:g,options:v});const $=yield y.find(g,v);let _=[];const N=t.permissions.canRead;if(!N)return s.throwError(`No canRead permission is set for model ${t.name}, multi resolver can't work.`);"function"==typeof N?_=$.filter(e=>N({user:h,document:e,model:t,context:l,operationName:f})):Array.isArray(N)&&(_=N.includes("owners")?$.filter(e=>i.isMemberOf(h,N,e)):i.isMemberOf(h,N)?$:[]),T.length&&(_=_.filter(e=>i.canFilterDocument(h,t,T,e)));const b={results:i.restrictViewableFields(h,t,_)};return b.totalCount=m?yield y.count(g):null,b}))}},single:{description:`A single ${e} document fetched by ID or slug`,resolver(t,{input:r={},_id:l},s,{cacheControl:p}){var d;return a(this,void 0,void 0,(function*(){const{enableCache:t=!1,allowNull:a=!1}=r,m=e+".read.single";let f;if(p&&t){const e=n.cacheMaxAge||c.cacheMaxAge;p.setCacheHint({maxAge:e})}const{currentUser:y}=s,h=u.getModel(s,e),g=o.getModelConnector(s,h);if(l)f=yield g.findOneById(l);else{let{selector:e,options:t,filteredFields:n}=yield g._filter(r,s);i.checkFields(y,h,n),f=yield g.findOne(e,t),f&&n.length&&(f=i.canFilterDocument(y,h,n,f)?f:null)}if(!f){if(a)return{result:null};{const e={id:"app.missing_document",data:{documentId:l,input:r}},t=new Error(e.id);throw t.error=e,t}}let v;const T=null===(d=h.permissions)||void 0===d?void 0:d.canRead;if(T?"function"==typeof T?v=T:Array.isArray(T)&&(v=({user:e,document:t})=>i.isMemberOf(e,T,t)):v=()=>!0,!v({user:y,document:f,model:h,context:s,operationName:m})){const e={id:"app.operation_not_allowed",data:{documentId:f._id,operationName:m}},t=new Error(e.id);throw t.error=e,t}return{result:i.restrictViewableFields(y,h,f)}}))}}}}},function(e,t){e.exports=__nccwpck_require__(39576)},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{u(a.next(e))}catch(e){i(e)}}function l(e){try{u(a.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.buildDefaultMutationResolvers=void 0;const r=n(11),i=n(1),o={create:!0,update:!0,upsert:!0,delete:!0},l=e=>"create"+e,u=e=>"update"+e,s=e=>"delete"+e;t.buildDefaultMutationResolvers=function({typeName:e,options:t}){const n=Object.assign(Object.assign({},o),t||{}),p={};return n.create&&(p.create={description:`Mutation for creating new ${e} documents`,name:l(e),mutation(t,{input:{data:n}},o){return a(this,void 0,void 0,(function*(){const t=i.getModel(o,e);return yield r.createMutator({model:t,data:n,currentUser:o.currentUser,validate:!0,context:o})}))}}),n.update&&(p.update={description:`Mutation for updating a ${e} document`,name:u(e),mutation(t,{input:n},o){return a(this,void 0,void 0,(function*(){const t=i.getModel(o,e);return yield r.updateMutator({model:t,input:n,currentUser:o.currentUser,validate:!0,context:o})}))}}),n.delete&&(p.delete={description:`Mutation for deleting a ${e} document`,name:s(e),mutation(t,{input:n},o){return a(this,void 0,void 0,(function*(){const t=i.getModel(o,e);return yield r.deleteMutator({model:t,input:n,currentUser:o.currentUser,validate:!0,context:o})}))}}),p}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.validateData=t.modifierToData=t.dataToModifier=void 0;const r=a(n(43)),i=a(n(44)),o=n(3),l=n(2),u=n(3);t.dataToModifier=e=>({$set:r.default(e,e=>null!==e),$unset:i.default(r.default(e,e=>null===e),()=>!0)});t.modifierToData=e=>Object.assign(Object.assign({},e.$set),i.default(e.$unset,()=>null));t.validateData=({originalDocument:e,document:n,model:a,context:r,mutatorName:i,validationContextName:s="defaultContext"})=>{const{schema:p}=a;let c=[];if("delete"===i)return c;c=c.concat(((e,t,n,a,r="create")=>{let i=[];const{currentUser:u}=a;return o.forEachDocumentField(t,n,({fieldName:t,fieldSchema:n,currentPath:a,isNested:o})=>{(!o||n&&("create"===r?n.canCreate:n.canUpdate))&&(n&&("create"===r?l.canCreateField(u,n):l.canUpdateField(u,n,e))||i.push({id:"errors.disallowed_property_detected",properties:{name:`${a}${t}`}}))}),i})(e||n,n,p,r,i));const d=u.toSimpleSchema(p).namedContext(s);if("create"===i&&d.validate(n),"update"===i){const e=t.dataToModifier(n),a=e.$set,r=e.$unset;d.validate({$set:a,$unset:r},{modifier:!0,extendedCustomContext:{documentId:n._id}})}if(!d.isValid()){d.validationErrors().forEach(e=>{if(e.type.includes("intlError")){const t=JSON.parse(e.type.replace("intlError|",""));c=c.concat(t)}else c.push({id:"errors."+e.type,path:e.name,properties:Object.assign({modelName:a.name},e)})})}return c}},function(e,t){e.exports=__nccwpck_require__(21864)},function(e,t){e.exports=__nccwpck_require__(20668)},function(e,t){e.exports=__nccwpck_require__(2459)},function(e,t){e.exports=__nccwpck_require__(72187)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwiQHZ1bGNhbmpzL3V0aWxzXCIiLCJ3ZWJwYWNrOi8vLy4vc2VydmVyL3Jlc29sdmVycy9jb250ZXh0LnRzIiwid2VicGFj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blJlYWQsIGRvY3VtZW50KTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gZGVmYXVsdCB0byBhbGxvd2luZyBhY2Nlc3MgdG8gYWxsIGRvY3VtZW50c1xuICAgICAgICBjYW5SZWFkRnVuY3Rpb24gPSAoKSA9PiB0cnVlO1xuICAgICAgfVxuXG4gICAgICBpZiAoXG4gICAgICAgICFjYW5SZWFkRnVuY3Rpb24oe1xuICAgICAgICAgIHVzZXI6IGN1cnJlbnRVc2VyLFxuICAgICAgICAgIGRvY3VtZW50OiBkb2MsXG4gICAgICAgICAgbW9kZWwsXG4gICAgICAgICAgY29udGV4dCxcbiAgICAgICAgICBvcGVyYXRpb25OYW1lLFxuICAgICAgICB9KVxuICAgICAgKSB7XG4gICAgICAgIGNvbnN0IGVycm9ySW5mbyA9IHtcbiAgICAgICAgICBpZDogXCJhcHAub3BlcmF0aW9uX25vdF9hbGxvd2VkXCIsXG4gICAgICAgICAgZGF0YTogeyBkb2N1bWVudElkOiBkb2MuX2lkLCBvcGVyYXRpb25OYW1lIH0sXG4gICAgICAgIH07XG4gICAgICAgIGNvbnN0IGVycm9yID0gbmV3IEVycm9yKGVycm9ySW5mby5pZCk7XG4gICAgICAgIChlcnJvciBhcyBhbnkpLmVycm9yID0gZXJyb3JJbmZvO1xuICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgIH1cblxuICAgICAgY29uc3QgcmVzdHJpY3RlZERvYyA9IHJlc3RyaWN0Vmlld2FibGVGaWVsZHMoXG4gICAgICAgIGN1cnJlbnRVc2VyLFxuICAgICAgICBtb2RlbCxcbiAgICAgICAgZG9jXG4gICAgICApIGFzIFRNb2RlbDtcblxuICAgICAgLy8gZmlsdGVyIG91dCBkaXNhbGxvd2VkIHByb3BlcnRpZXMgYW5kIHJldHVybiByZXN1bHRpbmcgZG9jdW1lbnRcbiAgICAgIHJldHVybiB7IHJlc3VsdDogcmVzdHJpY3RlZERvYyB9O1xuICAgIH0sXG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TmFtZSh0eXBlTmFtZSksXG4gICAgICBhc3luYyBtdXRhdGlvbihyb290LCB7IGlucHV0OiB7IGRhdGEgfSB9LCBjb250ZXh0OiBDb250ZXh0V2l0aFVzZXIpIHtcbiAgICAgICAgY29uc3QgbW9kZWwgPSBnZXRNb2RlbChjb250ZXh0LCB0eXBlTmFtZSk7XG5cbiAgICAgICAgcmV0dXJuIGF3YWl0IGNyZWF0ZU11dGF0b3Ioe1xuICAgICAgICAgIG1vZGVsLFxuICAgICAgICAgIGRhdGEsXG4gICAgICAgICAgY3VycmVudFVzZXI6IGNvbnRleHQuY3VycmVudFVzZXIsXG4gICAgICAgICAgdmFsaWRhdGU6IHRydWUsXG4gICAgICAgICAgY29udGV4dCxcbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH07XG4gIH1cblxuICBpZiAobXV0YXRpb25PcHRpb25zLnVwZGF0ZSkge1xuICAgIG11dGF0aW9ucy51cGRhdGUgPSB7XG4gICAgICBkZXNjcmlwdGlvbjogYE11dGF0aW9uIGZvciB1cGRhdGluZyBhICR7dHlwZU5hbWV9IGRvY3VtZW50YCxcbiAgICAgIG5hbWU6IGdldFVwZGF0ZU11dGF0aW9uTmFtZSh0eXBlTmFtZSksXG4gICAgICAvKipcbiAgICAgICAqIEV4YW1wbGUgY29uc3VtcHRpb24gZnJvbSBhIGhvb2s6XG4gICAgICAgKlxuICAgICAgICogY29uc3QgW3VwZGF0ZVVzZXJdID0gdXNlVXBkYXRlKHttb2RlbDogVXNlcn0pXG4gICAgICAgKiB1cGRhdGVVc2VyKHtpbnB1dDogeyBkYXRhOiB7wqBpZDogNDIsIG5ld0ZpZWxkOiBcImhlbGxvXCIgfX19KVxuICAgICAgICpcbiAgICAgICAqIEBwYXJhbSByb290XG4gICAgICAgKiBAcGFyYW0gcGFyYW0xXG4gICAgICAgKiBAcGFyYW0gY29udGV4dFxuICAgICAgICogQHJldHVybnNcbiAgICAgICAqL1xuICAgICAgYXN5bmMgbXV0YXRpb24ocm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gPSBKU09OLnBhcnNlKGVycm9yLnR5cGUucmVwbGFjZShcImludGxFcnJvcnxcIiwgXCJcIikpO1xuICAgICAgICB2YWxpZGF0aW9uRXJyb3JzID0gdmFsaWRhdGlvbkVycm9ycy5jb25jYXQoaW50bEVycm9yKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHZhbGlkYXRpb25FcnJvcnMucHVzaCh7XG4gICAgICAgICAgaWQ6IGBlcnJvcnMuJHtlcnJvci50eXBlfWAsXG4gICAgICAgICAgcGF0aDogZXJyb3IubmFtZSxcbiAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICBtb2RlbE5hbWU6IG1vZGVsLm5hbWUsXG4gICAgICAgICAgICAvLyB0eXBlTmFtZTogY29sbGVjdGlvbi5vcHRpb25zLnR5cGVOYW1lLFxuICAgICAgICAgICAgLi4uZXJyb3IsXG4gICAgICAgICAgfSxcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cblxuICByZXR1cm4gdmFsaWRhdGlvbkVycm9ycztcbn07XG4iLCJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJsb2Rhc2gvcGlja0J5XCIpOyIsIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImxvZGFzaC9tYXBWYWx1ZXNcIik7IiwibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwiQHZ1bGNhbmpzL2NvcmVcIik7IiwibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwibG9kYXNoL2Nsb25lRGVlcFwiKTsiXSwic291cmNlUm9vdCI6IiJ9 + +/***/ }), + +/***/ 78829: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(49173)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 49173: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(80900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 39576: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(78829); +} else { + module.exports = __nccwpck_require__(91056); +} + + +/***/ }), + +/***/ 91056: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(33867); +const util = __nccwpck_require__(31669); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(49173)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 81084: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},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=5)}([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.pluralFormatPropTypes=t.relativeFormatPropTypes=t.numberFormatPropTypes=t.dateTimeFormatPropTypes=t.messageDescriptorPropTypes=t.intlShape=t.intlFormatPropTypes=t.intlConfigPropTypes=void 0;const n=o(r(6)),{bool:a,number:i,string:s,func:l,object:u,oneOf:c,shape:f,any:d}=n.default,m=c(["best fit","lookup"]),p=c(["narrow","short","long"]),g=c(["numeric","2-digit"]),y=l.isRequired;t.intlConfigPropTypes={locale:s,formats:u,messages:u,textComponent:d,defaultLocale:s,defaultFormats:u},t.intlFormatPropTypes={formatDate:y,formatTime:y,formatRelative:y,formatNumber:y,formatPlural:y,formatMessage:y,formatHTMLMessage:y},t.intlShape=f(Object.assign(Object.assign(Object.assign({},t.intlConfigPropTypes),t.intlFormatPropTypes),{formatters:u,now:y})),t.messageDescriptorPropTypes={id:s.isRequired,description:s,defaultMessage:s},t.dateTimeFormatPropTypes={localeMatcher:m,formatMatcher:c(["basic","best fit"]),timeZone:s,hour12:a,weekday:p,era:p,year:g,month:c(["numeric","2-digit","narrow","short","long"]),day:g,hour:g,minute:g,second:g,timeZoneName:c(["short","long"])},t.numberFormatPropTypes={localeMatcher:m,style:c(["decimal","currency","percent"]),currency:s,currencyDisplay:c(["symbol","code","name"]),useGrouping:a,minimumIntegerDigits:i,minimumFractionDigits:i,maximumFractionDigits:i,minimumSignificantDigits:i,maximumSignificantDigits:i},t.relativeFormatPropTypes={style:c(["best fit","numeric"]),units:c(["second","minute","hour","day","month","year"])},t.pluralFormatPropTypes={style:c(["cardinal","ordinal"])}},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.formatLabel=t.getIntlLabel=t.getIntlKeys=t.validateIntlField=t.schemaHasIntlFields=t.getIntlString=t.schemaHasIntlField=t.isIntlDataField=t.isIntlField=t.registerLocale=t.Locales=t.registerDomain=t.getString=t.addStrings=t.Domains=t.Strings=t.defaultLocale=void 0;const n=r(2),a=o(r(7));t.defaultLocale="en",t.Strings={},t.Domains={};t.addStrings=(e,r)=>{void 0===t.Strings[e]&&(t.Strings[e]={}),t.Strings[e]=Object.assign(Object.assign({},t.Strings[e]),r)};t.getString=({id:e,values:r,defaultMessage:o,locale:n})=>{let a="";return t.Strings[n]&&t.Strings[n][e]?a=t.Strings[n][e]:t.Strings[t.defaultLocale]&&t.Strings[t.defaultLocale][e]?a=t.Strings[t.defaultLocale]&&t.Strings[t.defaultLocale][e]:o&&(a=o),r&&"object"==typeof r&&Object.keys(r).forEach(e=>{a=a.replaceAll(`{${e}}`,r[e])}),a};t.registerDomain=(e,r)=>{t.Domains[r]=e},t.Locales=[];t.registerLocale=e=>{t.Locales.push(e)};t.isIntlField=e=>!!e.intl;t.isIntlDataField=e=>!!e.isIntlData;t.schemaHasIntlField=(e,t)=>!!e[t+"_intl"];t.getIntlString=()=>{const e={locale:{type:String,optional:!0},value:{type:String,optional:!0}},t=new a.default(e);return t.name="IntlString",t};t.schemaHasIntlFields=e=>Object.keys(e).some(r=>t.isIntlField(e[r]));t.validateIntlField=function(){let e=[];if(t.Locales.filter(e=>e.required).forEach((t,r)=>{const o=this.value;if(!(o&&Array.isArray(o)&&o.some(e=>e&&e.locale===t.id&&e.value))){const o=this.key.replace("_intl","");e.push({id:"errors.required",path:`${this.key}.${r}`,properties:{name:o,locale:t.id}})}}),e.length>0)return"intlError|"+JSON.stringify(e)};t.getIntlKeys=({fieldName:e,collectionName:t,schema:r})=>{const o=r&&r[e]?r[e]:{},{intlId:n}=o,a=[];return n&&a.push(n),t&&a.push(`${t.toLowerCase()}.${e}`),a.push("global."+e),a.push(e),a};t.getIntlLabel=({intl:e,fieldName:t,collectionName:r,schema:o,isDescription:n},a)=>{const i=(null==o?void 0:o[t])?o[t]:{},{intlId:s}=i;if(!t)throw new Error("fieldName option passed to formatLabel cannot be empty or undefined");const l=n?".description":"",u=[];let c;s&&u.push(s),r&&u.push(`${r.toLowerCase()}.${t}`),u.push("global."+t),u.push(t);for(const t of u){const r=e.formatMessage({id:t+l},a);if(""!==r){c=r;break}}return c};t.formatLabel=(e,r)=>{const{fieldName:o,schema:a}=e,i=(null==a?void 0:a[o])?a[o]:{},{label:s}=i;return t.getIntlLabel(e,r)||s||n.camelToSpaces(o)}},function(e,t){e.exports=__nccwpck_require__(35001)},function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=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 n(t,e),t},i=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n({id:t,defaultMessage:r},o=null)=>u.getString({id:t,defaultMessage:r,values:o,locale:e}),d=e=>""+e,m=({locale:e})=>({formatDate:d,formatTime:d,formatRelative:d,formatNumber:d,formatPlural:d,formatMessage:f({locale:e}),formatHTMLMessage:d,now:null,locale:e});t.IntlProviderContext=l.default.createContext(m({locale:""}));t.IntlProvider=e=>{var{locale:r}=e,o=i(e,["locale"]);return l.default.createElement(t.IntlProviderContext.Provider,Object.assign({value:m({locale:r})},o))};t.useIntlContext=()=>l.useContext(t.IntlProviderContext);class p extends l.Component{constructor(){super(...arguments),this.formatMessage=({id:e,defaultMessage:t},r=null)=>{const{locale:o}=this.props;return u.getString({id:e,defaultMessage:t,values:r,locale:o})},this.formatStuff=e=>e}getChildContext(){return{intl:{formatDate:this.formatStuff,formatTime:this.formatStuff,formatRelative:this.formatStuff,formatNumber:this.formatStuff,formatPlural:this.formatStuff,formatMessage:this.formatMessage,formatHTMLMessage:this.formatStuff,now:this.formatStuff,locale:this.props.locale}}}render(){return s.deprecate("0.0.0","Please React's new context API in your class components: static contextType = IntlProviderContext;, or move to hooks"),this.props.children}}t.LegacyIntlProvider=p,p.childContextTypes={intl:c.intlShape},t.default=t.IntlProvider},function(e,t){e.exports=__nccwpck_require__(18444)},function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(0),t),n(r(1),t),n(r(3),t),n(r(8),t)},function(e,t){e.exports=__nccwpck_require__(62239)},function(e,t){e.exports=__nccwpck_require__(88969)},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.FormattedMessage=void 0;const n=o(r(4)),a=r(3),i=r(0);t.FormattedMessage=({id:e,values:t,defaultMessage:r="",html:o=!1,className:i=""})=>{let s=a.useIntlContext().formatMessage({id:e,defaultMessage:r},t);const l="i18n-message "+i;return""===s&&(s=`[${e}]`),o?n.default.createElement("span",{"data-key":e,className:l,dangerouslySetInnerHTML:{__html:s}}):n.default.createElement("span",{"data-key":e,className:l},s)},t.FormattedMessage.contextTypes={intl:i.intlShape},t.default=t.FormattedMessage}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vbGliL21vZHVsZXMvc2hhcGUudHMiLCJ3ZWJwYWNrOi8vLy4vaW50bC50cyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJAdnVsY2FuanMvdXRpbHNcIiIsIndlYnBhY2s6Ly8vLi9saWIvbW9kdWxlcy9Qcm92aWRlci50c3giLCJ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biAgKTtcbn07XG5cbkZvcm1hdHRlZE1lc3NhZ2UuY29udGV4dFR5cGVzID0ge1xuICBpbnRsOiBpbnRsU2hhcGUsXG59O1xuXG5leHBvcnQgZGVmYXVsdCBGb3JtYXR0ZWRNZXNzYWdlO1xuIl0sInNvdXJjZVJvb3QiOiIifQ== + +/***/ }), + +/***/ 32969: +/***/ ((module) => { + +module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=0)}([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]}),o=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}),o(r(1),t),o(r(2),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createModel=void 0;t.createModel=e=>{const{schema:t,name:r,extensions:n=[],permissions:o={}}=e,u={schema:t,name:r,permissions:o,options:e};return n.reduce((e,t)=>t(e),u)}}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vaW5kZXgudHMiLCJ3ZWJwYWNrOi8vLy4vY3JlYXRlTW9kZWwudHMiXSwibmFtZXMiOlsiaW5zdGFsbGVkTW9kdWxlcyIsIl9fd2VicGFja19yZXF1aXJlX18iLCJtb2R1bGVJZCIsImV4cG9ydHMiLCJtb2R1bGUiLCJpIiwibCIsIm1vZHVsZXMiLCJjYWxsIiwibSIsImMiLCJkIiwibmFtZSIsImdldHRlciIsIm8iLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImVudW1lcmFibGUiLCJnZXQiLCJyIiwiU3ltYm9sIiwidG9TdHJpbmdUYWciLCJ2YWx1ZSIsInQiLCJtb2RlIiwiX19lc01vZHVsZSIsIm5zIiwiY3JlYXRlIiwia2V5IiwiYmluZCIsIm4iLCJvYmplY3QiLCJwcm9wZXJ0eSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwicCIsInMiLCJjcmVhdGVNb2RlbCIsIm9wdGlvbnMiLCJzY2hlbWEiLCJleHRlbnNpb25zIiwicGVybWlzc2lvbnMiLCJtb2RlbCIsInJlZHVjZSIsImN1cnJlbnRFeHRlbmRlZE1vZGVsIiwiZXh0ZW5kRnVuY3Rpb24iXSwibWFwcGluZ3MiOiIyQkFDRSxJQUFJQSxFQUFtQixHQUd2QixTQUFTQyxFQUFvQkMsR0FHNUIsR0FBR0YsRUFBaUJFLEdBQ25CLE9BQU9GLEVBQWlCRSxHQUFVQyxRQUduQyxJQUFJQyxFQUFTSixFQUFpQkUsR0FBWSxDQUN6Q0csRUFBR0gsRUFDSEksR0FBRyxFQUNISCxRQUFTLElBVVYsT0FOQUksRUFBU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***/ 97387: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{u(o.next(e))}catch(e){r(e)}}function s(e){try{u(o.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.filterFunction=void 0;const r=i(n(2)),c=i(n(3)),s=i(n(4)),u=i(n(5)),a=n(6),d={_eq:"$eq",_gt:"$gt",_gte:"$gte",_in:"$in",_lt:"$lt",_lte:"$lte",_neq:"$ne",_nin:"$nin",_is_null:e=>({$exists:!e}),_is:e=>({$elemMatch:{$eq:e}}),_contains:e=>({$elemMatch:{$eq:e}}),asc:1,desc:-1,_like:e=>({$regex:e,$options:"i"})},l=e=>e.map(e=>{const[t]=Object.keys(e);return t});t.filterFunction=(e,t,n)=>o(void 0,void 0,void 0,(function*(){const{filter:o,limit:i,sort:f,search:p,offset:v,id:_}=t;let y={},h={sort:{}},b=[];const m=e.schema,O=e=>{const[t]=Object.keys(e),n=Object.keys(e[t]),o={};n.forEach(n=>{const i=e[t][n];if(a.isEmptyOrUndefined(i))throw new Error(`Detected empty filter value for field “${t}” with operator “${n}”`);const r=d[n];if(!r)throw new Error(`Operator ${n} is not valid. Possible operators are: ${Object.keys(d)}`);const c="function"==typeof r?r(i):{[r]:i};u.default(o,c)});return{[m[t].intl?t+"_intl.value":t]:o}};if(_&&(y={_id:_}),!c.default(o)&&o&&Object.keys(o).forEach(i=>{switch(i){case"_and":b=b.concat(l(o._and)),y.$and=o._and.map(O);break;case"_or":b=b.concat(l(o._or)),y.$or=o._or.map(O);break;case"_not":b=b.concat(l(o._not)),y.$not=o._not.map(O);break;case"search":break;default:const r=e.options.customFilters,c=r&&r.find(e=>e.name===i);if(c){const e=o[c.name],i=c.filter({input:t,context:n,filterArguments:e});y=u.default({},y,i.selector),h=u.default({},h,i.options)}else b.push(i),y=Object.assign(Object.assign({},y),O({[i]:o[i]}))}}),f&&!c.default(f)?h.sort=u.default({},h.sort,Object.keys(f).map(e=>{const t=f[e];if(!t)throw new Error(`Order not defined for key ${e}. Possible operators: asc, desc.`);return d[t]})):h.sort={createdAt:-1},p&&!c.default(p)){const t=s.default(p),n=Object.keys(m).filter(e=>!e.includes("_intl")&&m[e].searchable);n.length?y=Object.assign(Object.assign({},y),{$or:n.map(e=>({[m[e].intl?e+"_intl.value":e]:{$regex:t,$options:"i"}}))}):console.warn(`Warning: search argument is set but schema ${e.name} has no searchable field. Set "searchable: true" for at least one field to enable search.`)}return h.limit=i?Math.min(i,1e3):1e3,v&&(h.skip=v),{selector:y,options:h,filteredFields:r.default(b)}}))},function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(0),t),i(n(7),t)},function(e,t){e.exports=__nccwpck_require__(89482)},function(e,t){e.exports=__nccwpck_require__(53912)},function(e,t){e.exports=__nccwpck_require__(34141)},function(e,t){e.exports=__nccwpck_require__(80481)},function(e,t){e.exports=__nccwpck_require__(35001)},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{u(o.next(e))}catch(e){r(e)}}function s(e){try{u(o.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createMongooseConnector=void 0;const r=n(0),c=i(n(8));function s(e){return Array.isArray(e)?e.map(e=>Object.assign(Object.assign({},e.toJSON()),{_id:e._id.toString()})):Object.assign(Object.assign({},e.toJSON()),{_id:e._id.toString()})}t.createMongooseConnector=e=>{var t;let n=null===(t=c.default.models)||void 0===t?void 0:t[e.name];if(!n){const t=new c.default.Schema({},{strict:!1});n=c.default.model(e.name,t)}return{find:(e,t)=>o(void 0,void 0,void 0,(function*(){return s(yield n.find(e||{},null,t).exec())})),findOne:e=>o(void 0,void 0,void 0,(function*(){const t=yield n.findOne(e).exec();return t&&s(t)})),findOneById:e=>o(void 0,void 0,void 0,(function*(){const t=yield n.findById(e).exec();return t&&s(t)})),count:e=>o(void 0,void 0,void 0,(function*(){return yield n.countDocuments(e||{})})),create:e=>o(void 0,void 0,void 0,(function*(){const t=new n(e);return s(yield t.save())})),update:(e,t,i)=>o(void 0,void 0,void 0,(function*(){i&&console.warn("update do not implement options yet","selector:",e,"options:",i),yield n.updateOne(e,t);return s(yield n.findOne(e).exec())})),delete:e=>o(void 0,void 0,void 0,(function*(){const t=yield n.findOne(e).exec(),o=t&&s(t);return yield n.deleteMany(e),o})),_filter:(t,n)=>o(void 0,void 0,void 0,(function*(){return yield r.filterFunction(e,t,n)}))}}},function(e,t){e.exports=__nccwpck_require__(34740)}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vbW9uZ29QYXJhbXMudHMiLCJ3ZWJwYWNrOi8vLy4vaW5kZXgudHMiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwibG9kYXNoL3VuaXFcIiIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJsb2Rhc2gvaXNFbXB0eVwiIiwid2VicGFjazovLy9leHRlcm5hbCBcImVzY2FwZS1zdHJpbmctcmVnZXhwXCIiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwibG9kYXNoL21lcmdlXCIiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwiQHZ1bGNhbmpzL3V0aWxzXCIiLCJ3ZWJwYWNrOi8vLy4vY29ubmVjdG9yLnRzIiwid2VicGFjazovLy9leHRlcm5hbCBcIm1vbmdvb3NlXCIiXSwibmFtZXMiOlsiaW5zdGFsbGVkTW9kdWxlcyIsIl9fd2VicGFja19yZXF1aXJlX18iLCJtb2R1bGVJZCIsImV4cG9ydHMiLCJtb2R1bGUiLCJpIiwibCIsIm1vZHVsZXMiLCJjYWxsIiwibSIsImMiLCJkIiwibmFtZSIsImdldHRlciIsIm8iLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImVudW1lcmFibGUiLCJnZXQiLCJyIiwiU3ltYm9sIiwidG9TdHJpbmdUYWciLCJ2YWx1ZSIsInQiLCJtb2RlIiwiX19lc01vZHVsZSIsIm5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gICAgIH0pO1xuICAgICAgICAgICAgc2VsZWN0b3IgPSBtZXJnZSh7fSwgc2VsZWN0b3IsIGZpbHRlck9iamVjdC5zZWxlY3Rvcik7XG4gICAgICAgICAgICBvcHRpb25zID0gbWVyZ2Uoe30sIG9wdGlvbnMsIGZpbHRlck9iamVjdC5vcHRpb25zKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gcmVndWxhciBmaWVsZFxuICAgICAgICAgICAgZmlsdGVyZWRGaWVsZHMucHVzaChmaWVsZE5hbWUpO1xuICAgICAgICAgICAgc2VsZWN0b3IgPSB7XG4gICAgICAgICAgICAgIC4uLnNlbGVjdG9yLFxuICAgICAgICAgICAgICAuLi5jb252ZXJ0RXhwcmVzc2lvbih7IFtmaWVsZE5hbWVdOiBmaWx0ZXJbZmllbGROYW1lXSB9KSxcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgfVxuICAgICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG5cbiAgLy8gc29ydFxuICBpZiAoc29ydCAmJiAhaXNFbXB0eShzb3J0KSkge1xuICAgIG9wdGlvbnMuc29ydCA9IG1lcmdlKFxuICAgICAge30sXG4gICAgICBvcHRpb25zLnNvcnQsXG4gICAgICBPYmplY3Qua2V5cyhzb3J0KS5tYXAoKHNvcnRLZXkpID0+IHtcbiAgICAgICAgY29uc3Qgb3JkZXIgPSBzb3J0W3NvcnRLZXldO1xuICAgICAgICBpZiAoIW9yZGVyKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgYE9yZGVyIG5vdCBkZWZpbmVkIGZvciBrZXkgJHtzb3J0S2V5fS4gUG9zc2libGUgb3BlcmF0b3JzOiBhc2MsIGRlc2MuYFxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbW9uZ29PcmRlciA9IGNvbnZlcnNpb25UYWJsZVtvcmRlcl07XG4gICAgICAgIHJldHVybiBtb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50IGF0IGdlbmVyYXRpbmcgb3B0aW9ucyBmb3IgRmluZCBhbmQgc2VsZWN0XG4gICAgX2ZpbHRlcjogYXN5bmMgKGlucHV0LCBjb250ZXh0KSA9PiB7XG4gICAgICByZXR1cm4gYXdhaXQgZmlsdGVyRnVuY3Rpb24obW9kZWwsIGlucHV0LCBjb250ZXh0KTtcbiAgICAgIC8vcmV0dXJuIHsgc2VsZWN0b3I6IHt9LCBmaWx0ZXJlZEZpZWxkczogW10sIG9wdGlvbnM6IHt9IH07XG4gICAgfSxcbiAgfTtcbn07XG4iLCJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJtb25nb29zZVwiKTsiXSwic291cmNlUm9vdCI6IiJ9 + +/***/ }), + +/***/ 34141: +/***/ ((module) => { + +"use strict"; + + +module.exports = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + // Escape characters with special meaning either inside or outside character sets. + // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + return string + .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') + .replace(/-/g, '\\x2d'); +}; + + +/***/ }), + +/***/ 24778: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(r,i,function(n){return e[n]}.bind(null,i));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t),Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),i=this&&this.__exportStar||function(e,n){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(n,t)||r(n,e,t)};Object.defineProperty(n,"__esModule",{value:!0}),i(t(1),n)},function(e,n,t){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.canDeleteDocument=n.canUpdateDocument=n.canCreateDocument=n.canReadDocument=n.permissionCheck=n.canUpdateField=n.canCreateField=n.restrictDocuments=n.restrictViewableFields=n.restrictDocument=n.canFilterDocument=n.checkFields=n.getDocumentBasedPermissionFieldNames=n.isDocumentBasedPermissionField=n.getReadableFields=n.canReadField=n.isAdmin=n.owns=n.isMemberOf=n.getGroups=void 0;const i=r(t(2)),s=r(t(3)),o=r(t(4)),a=r(t(5)),c=r(t(6)),u=r(t(7)),d=r(t(8)),l=t(9),f=t(10);n.getGroups=(e,t)=>{let r=["anyone","guests"];return e&&(r.push("members"),t&&n.owns(e,t)&&r.push("owners"),e.groups&&(r=r.concat(e.groups)),n.isAdmin(e)&&r.push("admins")),r};n.isMemberOf=(e,t,r)=>{const s=Array.isArray(t)?t:[t];return i.default(n.getGroups(e,r),s).length>0};n.owns=function(e,n){if(!e)return!1;try{return n.userId?f.isEqual(e._id,n.userId):n.slug?e.slug===n.slug:e._id===n._id}catch(e){return!1}};n.isAdmin=function(e){return!!(null==e?void 0:e.isAdmin)};n.canReadField=function(e,t,r){const i=t.canRead;return!!i&&(!!n.isAdmin(e)||("function"==typeof i?i(e,r):"string"==typeof i?"guests"===i||n.isMemberOf(e,i,r):!!(Array.isArray(i)&&i.length>0)&&i.some(t=>n.canReadField(e,{canRead:t},r))))};n.getReadableFields=function(e,t,r){return s.default(o.default(t.schema,(t,i)=>i.indexOf(".$")>-1?null:n.canReadField(e,t,r)?i:null))};n.isDocumentBasedPermissionField=e=>{const t=e.canRead;if(t){if("function"==typeof t)return!0;if("owners"===t)return!0;if(Array.isArray(t)&&t.length>0)return t.some(e=>n.isDocumentBasedPermissionField({canRead:e}))}return!1};n.getDocumentBasedPermissionFieldNames=function(e){const t=e.schema;return Object.keys(t).filter(e=>{if(e.indexOf(".$")>-1)return!1;const r=t[e];return!!n.isDocumentBasedPermissionField(r)})};n.checkFields=(e,t,r)=>{const i=n.getReadableFields(e,t),s=n.getDocumentBasedPermissionFieldNames(t),o=a.default(r,s),c=a.default(o,i);if(c.length)throw new Error(`You don't have permission to filter model ${t.name} by the following fields: ${c.join(", ")}. Field is not readable or do not exist.`);return!0};n.canFilterDocument=(e,t,r,i)=>{const s=n.getReadableFields(e,t,i);return!a.default(r,s).length};n.restrictDocument=(e,t,r)=>{let i=d.default(e);return l.forEachDocumentField(e,t,({fieldName:t,fieldSchema:s,currentPath:o,isNested:a})=>{(!a||s&&s.canRead)&&(s&&n.canReadField(r,s,e)||u.default(i,`${o}${t}`))}),i};n.restrictViewableFields=(e,t,r)=>{if(!r)return{};const i=t.schema,s=t=>n.restrictDocument(t,i,e);return Array.isArray(r)?r.map(s):s(r)};n.restrictDocuments=function({user:e,model:t,documents:r}){let i=r;c.default(t,"permissions.canRead")&&(i=r.filter(r=>n.canReadDocument({model:t,document:r,user:e})));return n.restrictViewableFields(e,t,i)};n.canCreateField=function(e,t){const r=t.canCreate;if(r){if("function"==typeof r)return r(e);if("string"==typeof r)return"guests"===r||"anyone"===r||n.isMemberOf(e,r);if(Array.isArray(r)&&r.length>0)return r.some(t=>n.canCreateField(e,{canCreate:t}))}return!1};n.canUpdateField=function(e,t,r){const i=t.canUpdate;if(i){if("function"==typeof i)return i(e,r);if("string"==typeof i)return"guests"===i||"anyone"===i||n.isMemberOf(e,i,r);if(Array.isArray(i)&&i.length>0)return i.some(t=>n.canUpdateField(e,{canUpdate:t},r))}return!1};n.permissionCheck=e=>{const{check:t,user:r,document:i}=e;return!!n.isAdmin(r)||("function"==typeof t?t(e):Array.isArray(t)?n.isMemberOf(r,t,i):void 0)};n.canReadDocument=e=>{const{model:t}=e,r=c.default(t,"permissions.canRead");return r||console.warn(`Users.canReadDocument() was called but no [canRead] permission was defined for model [${t.name}]`),r&&n.permissionCheck(Object.assign(Object.assign({},e),{check:r}))};n.canCreateDocument=e=>{const{model:t}=e,r=c.default(t,"permissions.canCreate");return r||console.warn(`Users.canCreate() was called but no [canCreate] permission was defined for model [${t.name}]`),r&&n.permissionCheck(Object.assign(Object.assign({},e),{check:r}))};n.canUpdateDocument=e=>{const{model:t}=e,r=c.default(t,"permissions.canUpdate");return r||console.warn(`Users.canUpdate() was called but no [canUpdate] permission was defined for model [${t.name}]`),r&&n.permissionCheck(Object.assign(Object.assign({},e),{check:r}))};n.canDeleteDocument=e=>{const{model:t}=e,r=c.default(t,"permissions.canDelete");return r||console.warn(`Users.canDelete() was called but no [canDelete] permission was defined for model [${t.name}]`),r&&n.permissionCheck(Object.assign(Object.assign({},e),{check:r}))}},function(e,n){e.exports=__nccwpck_require__(21851)},function(e,n){e.exports=__nccwpck_require__(58266)},function(e,n){e.exports=__nccwpck_require__(78101)},function(e,n){e.exports=__nccwpck_require__(44031)},function(e,n){e.exports=__nccwpck_require__(56908)},function(e,n){e.exports=__nccwpck_require__(34019)},function(e,n){e.exports=__nccwpck_require__(72187)},function(e,n){e.exports=__nccwpck_require__(31032)},function(e,n){e.exports=__nccwpck_require__(90250)}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vaW5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ZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImxvZGFzaC91bnNldFwiKTsiLCJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJsb2Rhc2gvY2xvbmVEZWVwXCIpOyIsIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIkB2dWxjYW5qcy9zY2hlbWFcIik7IiwibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwibG9kYXNoXCIpOyJdLCJzb3VyY2VSb290IjoiIn0= + +/***/ }), + +/***/ 31032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},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=2)}([function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toSimpleSchema=t.hasArrayNestedChild=t.getArrayChildSchema=t.getNestedSchema=t.hasArrayChild=t.getArrayChild=t.hasNestedSchema=t.isArrayChildField=t.isBlackbox=t.getFieldTypeName=t.hasAllowedValues=t.getAllowedValues=t.unarrayfyFieldName=void 0;const a=i(r(1));t.unarrayfyFieldName=e=>e?e.split(".")[0]:e;t.getAllowedValues=e=>e.type.definitions[0].allowedValues;t.hasAllowedValues=e=>{const r=t.getAllowedValues(e);return r&&!r.length?(console.warn(`Field ${e} as empty allowed values`),!1):!!r};t.getFieldTypeName=e=>{const t=e.type;return t===Object?"JSON":"object"==typeof t?"Object":"function"==typeof t?t.name:t};t.isBlackbox=e=>!!e.blackbox;t.isArrayChildField=e=>-1!==e.indexOf("$");t.hasNestedSchema=e=>"Object"===t.getFieldTypeName(e)&&!(e=>"JSON"===e.typeName||"JSON"===t.getFieldTypeName(e)||"Object"===t.getFieldTypeName(e)&&!!e.blackbox)(e);t.getArrayChild=(e,t)=>t[e+".$"];t.hasArrayChild=(e,r)=>!!t.getArrayChild(e,r);t.getNestedSchema=e=>e.type;t.getArrayChildSchema=(e,r)=>t.getNestedSchema(t.getArrayChild(e,r));t.hasArrayNestedChild=(e,r)=>t.hasArrayChild(e,r)&&!!t.getArrayChildSchema(e,r);t.toSimpleSchema=e=>{let r={};return Object.keys(e).map(i=>{const l=e[i];t.hasNestedSchema(l)?r[i]=new a.default(l.type):r[i]=l}),new a.default(r)}},function(e,t){e.exports=__nccwpck_require__(88969)},function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(3),t),a(r(0),t),a(r(6),t),a(r(9),t),r(10)},function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.forEachDocumentField=t.getFragmentFieldNames=t.shouldAddOriginalField=t.getUpdateableFields=t.getCreateableFields=t.getReadableFields=t.getValidFields=t.formattedDateResolver=void 0;const a=r(0),l=i(r(4)),o=i(r(5));t.formattedDateResolver=e=>(t={},r={},i={})=>{const{format:a}=r,{timezone:l}=i;if(!t[e])return;let n=o.default(t[e]);return l&&(n=n.tz(l)),"ago"===a?n.fromNow():n.format(a)};t.getValidFields=e=>Object.keys(e).filter(e=>!e.includes("$")&&!e.includes("."));t.getReadableFields=e=>t.getValidFields(e).filter(t=>e[t].canRead||e[t].viewableBy);t.getCreateableFields=e=>t.getValidFields(e).filter(t=>e[t].canCreate||e[t].insertableBy);t.getUpdateableFields=e=>t.getValidFields(e).filter(t=>e[t].canUpdate||e[t].editableBy);t.shouldAddOriginalField=(e,t)=>{if(!t.resolveAs)return!0;return!(Array.isArray(t.resolveAs)?t.resolveAs:[t.resolveAs]).some(t=>!1===t.addOriginalField||t.fieldName===e||void 0===t.fieldName)};t.getFragmentFieldNames=({schema:e,options:r})=>Object.keys(e).filter(i=>{const a=e[i];return!(a.resolveAs&&!t.shouldAddOriginalField(i,a)||i.includes("$")||i.includes(".")||r.onlyViewable&&!a.canRead||a.typeName||e[i+".$"]&&e[i+".$"].typeName)});t.forEachDocumentField=(e,r,i,o="")=>{e&&Object.keys(e).forEach(n=>{const d=r[n];if(i({fieldName:n,fieldSchema:d,currentPath:o,document:e,schema:r,isNested:!!o}),!d)return;const s=e[n];if(s)if(l.default(s)){const e=a.getArrayChild(n,r);if(e){const r=a.getNestedSchema(e);r&&s.forEach((e,a)=>{t.forEachDocumentField(e,r,i,`${o}${n}[${a}].`)})}}else if("object"==typeof s&&!a.isBlackbox(d)){const e=a.getNestedSchema(d);e&&t.forEachDocumentField(s,e,i,`${o}${n}.`)}})}},function(e,t){e.exports=__nccwpck_require__(44869)},function(e,t){e.exports=__nccwpck_require__(97936)},function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(7),t),a(r(8),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});i(r(1)).default.extendOptions(["hidden","mustComplete","form","inputProperties","itemProperties","input","control","order","group","arrayItem","onCreate","onUpdate","onDelete","canRead","canCreate","canUpdate","typeName","resolveAs","searchable","description","beforeComponent","afterComponent","placeholder","options","query","autocompleteQuery","selectable","unique","orderable","sortable","apiOnly","relation","intl","isIntlData","intlId"])}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc2ltcGxlU2NoZW1hLXV0aWxzLnRzIiwid2VicGFjazovLy9leHRlcm5hbCBcInNpbXBsLXNjaGVtYVwiIiwid2VicGFjazovLy8uL2luZGV4LnRzIiwid2VicGFjazovLy8uL3NjaGVtYS11dGlscy50cyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJsb2Rhc2gvaXNBcnJheVwiIiwid2VicGFjazovLy9leHRlcm5hbCBcIm1vbWVudC10aW1lem9uZVwiIiwid2VicGFjazovLy8uL3R5cGluZ3MvaW5kZXgudHMiLCJ3ZWJwYWNrOi8vLy4vZXh0ZW5kU2ltcGxTY2hlbWEudHMiXSwibmFtZXMiOlsiaW5zdGFsbGVkTW9kdWxlcyIsIl9fd2VicGFja19yZXF1aXJlX18iLCJtb2R1bGVJZCIsImV4cG9ydHMiLCJtb2R1bGUiLCJpI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cmRlciByZXN1bHRzIHdoZW4gcXVlcnlpbmcgZm9yIGRhdGEgKGJhY2t3YXJkcy1jb21wYXRpYmlsaXR5KVxuICBcInNvcnRhYmxlXCIsIC8vIGZpZWxkIGNhbiBiZSB1c2VkIHRvIG9yZGVyIHJlc3VsdHMgd2hlbiBxdWVyeWluZyBmb3IgZGF0YVxuXG4gIFwiYXBpT25seVwiLCAvLyBmaWVsZCBzaG91bGQgbm90IGJlIGluc2VydGVkIGluIGRhdGFiYXNlXG4gIFwicmVsYXRpb25cIiwgLy8gZGVmaW5lIGEgcmVsYXRpb24gdG8gYW5vdGhlciBtb2RlbFxuXG4gIFwiaW50bFwiLCAvLyBzZXQgdG8gYHRydWVgIHRvIG1ha2UgYSBmaWVsZCBpbnRlcm5hdGlvbmFsXG4gIFwiaXNJbnRsRGF0YVwiLCAvLyBtYXJrZXIgZm9yIHRoZSBhY3R1YWwgc2NoZW1hIGZpZWxkcyB0aGF0IGhvbGQgaW50bCBzdHJpbmdzXG4gIFwiaW50bElkXCIsIC8vIHNldCBhbiBleHBsaWNpdCBpMThuIGtleSBmb3IgYSBmaWVsZFxuXSk7XG4iXSwic291cmNlUm9vdCI6IiJ9 + +/***/ }), + +/***/ 35001: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,r,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]}),o=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),o(t(1),r),o(t(5),r),o(t(6),r)},function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.isEmptyOrUndefined=r.getSchemaFieldAllowedValues=r.removeProperty=r.isPromise=r.defineName=r.findWhere=r.decodeIntlError=r.encodeIntlError=r.getComponentDisplayName=r.stripTelescopeNamespace=r.findIndex=r.getFieldLabel=r.checkNested=r.stripHTML=r.sanitize=r.cleanUp=r.nl2br=r.capitalize=r.trimHTML=r.trimWords=r.camelCaseify=r.dashToCamel=r.underscoreToDash=r.toTitleCase=r.camelToSpaces=r.camelToDash=void 0;const o=n(t(2)),i=n(t(3)),a=n(t(4));r.camelToDash=function(e){return e.replace(/\W+/g,"-").replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase()};r.camelToSpaces=function(e){return e.replace(/([A-Z])/g," $1").replace(/^./,(function(e){return e.toUpperCase()}))};r.toTitleCase=e=>e&&e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" ");r.underscoreToDash=function(e){return e.replace("_","-")};r.dashToCamel=function(e){return e.replace(/(\-[a-z])/g,(function(e){return e.toUpperCase().replace("-","")}))};r.camelCaseify=function(e){return e=(e=r.dashToCamel(e.replace(" ","-"))).slice(0,1).toLowerCase()+e.slice(1)};r.trimWords=function(e,r){if(!e)return e;var t=e.split(/\s+/,r);return t.length>=r?t.join(" ")+"…":e};r.trimHTML=function(e,t){var n=r.stripHTML(e);return r.trimWords(n,t)};r.capitalize=function(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)};r.nl2br=function(e){return(e+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1
$2")};r.cleanUp=function(e){return r.stripHTML(e)};r.sanitize=function(e){return e};r.stripHTML=function(e){return e&&e.replace(/<(?:.|\n)*?>/gm,"")};r.checkNested=function(e){var r=Array.prototype.slice.call(arguments);e=r.shift();for(var t=0;t{const n=t.schema[e].label,o=r.camelToSpaces(e);return n||o};r.findIndex=(e,r)=>{let t=-1,n=!0;return e.forEach((e,o)=>{n&&r(e)&&(t=o,n=!1)}),t};r.stripTelescopeNamespace=e=>Object.keys(e).filter(e=>"telescope"!==e.slice(0,9)).reduce((r,t)=>Object.assign(Object.assign({},r),{[t]:e[t]}),{});r.getComponentDisplayName=e=>e.displayName||e.name||"Component";r.encodeIntlError=e=>"object"!=typeof e?e:JSON.stringify(e);r.decodeIntlError=(e,r={stripped:!1})=>{try{let t="string"==typeof e?e:e.message;if(!r.stripped){const e=t.match(/GraphQL error: (.*)/);e&&(t=e[1]);const r=t.match(/(.*)\[(.*)\]/);r&&(t=r[1])}const n=JSON.parse(t);return n.id?n:(console.error("[Undecodable error]",e),{id:"app.something_bad_happened",value:"[undecodable error]"})}catch(r){return e}};r.findWhere=(e,r)=>e.find(e=>Object.keys(r).every(t=>e[t]===r[t]));r.defineName=(e,r)=>(Object.defineProperty(e,"name",{value:r}),e);r.isPromise=e=>i.default(o.default(e,"then"));r.removeProperty=(e,t)=>{for(const n in e)n===t?delete e[n]:"object"==typeof e[n]&&r.removeProperty(e[n],t)};r.getSchemaFieldAllowedValues=e=>{if(!Array.isArray(e))throw new Error("getAllowedValues: Expected Array");return e.map(e=>e.value)};r.isEmptyOrUndefined=e=>null==e||""===e||"object"==typeof e&&a.default(e)&&!(e instanceof Date)},function(e,r){e.exports=__nccwpck_require__(56908)},function(e,r){e.exports=__nccwpck_require__(17799)},function(e,r){e.exports=__nccwpck_require__(53912)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.debugVulcan=r.deprecate=void 0;r.deprecate=(e,r)=>{0};const o=n(t(7));r.debugVulcan=e=>o.default("vulcan:"+e)},function(e,r){e.exports=__nccwpck_require__(27565)}]); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vaW5kZXgudHMiLCJ3ZWJwYWNrOi8vLy4vc3RyaW5nLnRzIiwid2VicGFjazovLy9leHRlcm5hbCBcImxvZGFzaC9nZXRcIiIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJsb2Rhc2gvaXNGdW5jdGlvblwiIiwid2VicGFjazovLy9leHRlcm5hbCBcImxvZGFzaC9pc0VtcHR5XCIiLCJ3ZWJwYWNrOi8vLy4vZGVidWcudHMiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwiZGVidWdcIiJdLCJuYW1lcyI6WyJpbnN0YWxsZWRNb2R1bGVzIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsIm1vZHVsZUlkIiwiZXhwb3J0cyIsIm1vZHVsZSIsImkiLCJsIiwibW9kdWxlcyIsImNhbGwiLCJtIiwiYyIsImQiLCJuYW1lIiwiZ2V0dGVyIiwibyIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZW51bWVyYWJsZSIsImdldCIsInIiLCJTeW1ib2wiLCJ0b1N0cmluZ1RhZyIsInZhbHVlIiwidCIsIm1vZGUiLCJfX2VzTW9kdWxlIiwib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W50VnVsY2FuVmVyc2lvbiwgbWVzc2FnZSkgPT4ge1xuICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09IFwiZGV2ZWxvcG1lbnRcIikge1xuICAgIGNvbnNvbGUud2FybihgREVQUkVDQVRFRCAoJHtjdXJyZW50VnVsY2FuVmVyc2lvbn0pOmAsIG1lc3NhZ2UpO1xuICB9XG59O1xuXG5pbXBvcnQgZGVidWcgZnJvbSBcImRlYnVnXCI7XG4vKipcbiAqIEBleGFtcGxlIGNvbnN0IGRlYnVnRm9ybSA9IGRlYnVnVnVsY2FuKFwiZm9ybVwiKTtcbiAqIGRlYnVnRm9ybShcIkdvdCBzb21lIHZhbHVlcyBpbiBmb3JtXCIpXG4gKi9cbmV4cG9ydCBjb25zdCBkZWJ1Z1Z1bGNhbiA9IChzdWZmaXg6IHN0cmluZykgPT4gZGVidWcoYHZ1bGNhbjoke3N1ZmZpeH1gKTtcbiIsIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImRlYnVnXCIpOyJdLCJzb3VyY2VSb290IjoiIn0= + +/***/ }), + +/***/ 38655: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(97557)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 97557: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(80900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 27565: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(38655); +} else { + module.exports = __nccwpck_require__(73625); +} + + +/***/ }), + +/***/ 73625: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(33867); +const util = __nccwpck_require__(31669); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(97557)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 43792: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +// This currentContext variable will only be used if the makeSlotClass +// function is called, which happens only if this is the first copy of the +// @wry/context package to be imported. +var currentContext = null; +// This unique internal object is used to denote the absence of a value +// for a given Slot, and is never exposed to outside code. +var MISSING_VALUE = {}; +var idCounter = 1; +// Although we can't do anything about the cost of duplicated code from +// accidentally bundling multiple copies of the @wry/context package, we can +// avoid creating the Slot class more than once using makeSlotClass. +var makeSlotClass = function () { return /** @class */ (function () { + function Slot() { + // If you have a Slot object, you can find out its slot.id, but you cannot + // guess the slot.id of a Slot you don't have access to, thanks to the + // randomized suffix. + this.id = [ + "slot", + idCounter++, + Date.now(), + Math.random().toString(36).slice(2), + ].join(":"); + } + Slot.prototype.hasValue = function () { + for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { + // We use the Slot object iself as a key to its value, which means the + // value cannot be obtained without a reference to the Slot object. + if (this.id in context_1.slots) { + var value = context_1.slots[this.id]; + if (value === MISSING_VALUE) + break; + if (context_1 !== currentContext) { + // Cache the value in currentContext.slots so the next lookup will + // be faster. This caching is safe because the tree of contexts and + // the values of the slots are logically immutable. + currentContext.slots[this.id] = value; + } + return true; + } + } + if (currentContext) { + // If a value was not found for this Slot, it's never going to be found + // no matter how many times we look it up, so we might as well cache + // the absence of the value, too. + currentContext.slots[this.id] = MISSING_VALUE; + } + return false; + }; + Slot.prototype.getValue = function () { + if (this.hasValue()) { + return currentContext.slots[this.id]; + } + }; + Slot.prototype.withValue = function (value, callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + var _a; + var slots = (_a = { + __proto__: null + }, + _a[this.id] = value, + _a); + var parent = currentContext; + currentContext = { parent: parent, slots: slots }; + try { + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = parent; + } + }; + // Capture the current context and wrap a callback function so that it + // reestablishes the captured context when called. + Slot.bind = function (callback) { + var context = currentContext; + return function () { + var saved = currentContext; + try { + currentContext = context; + return callback.apply(this, arguments); + } + finally { + currentContext = saved; + } + }; + }; + // Immediately run a callback function without any captured context. + Slot.noContext = function (callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + if (currentContext) { + var saved = currentContext; + try { + currentContext = null; + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = saved; + } + } + else { + return callback.apply(thisArg, args); + } + }; + return Slot; +}()); }; +// We store a single global implementation of the Slot class as a permanent +// non-enumerable symbol property of the Array constructor. This obfuscation +// does nothing to prevent access to the Slot class, but at least it ensures +// the implementation (i.e. currentContext) cannot be tampered with, and all +// copies of the @wry/context package (hopefully just one) will share the +// same Slot implementation. Since the first copy of the @wry/context package +// to be imported wins, this technique imposes a very high cost for any +// future breaking changes to the Slot class. +var globalKey = "@wry/context:Slot"; +var host = Array; +var Slot = host[globalKey] || function () { + var Slot = makeSlotClass(); + try { + Object.defineProperty(host, globalKey, { + value: host[globalKey] = Slot, + enumerable: false, + writable: false, + configurable: false, + }); + } + finally { + return Slot; + } +}(); + +var bind = Slot.bind, noContext = Slot.noContext; +function setTimeoutWithContext(callback, delay) { + return setTimeout(bind(callback), delay); +} +// Turn any generator function into an async function (using yield instead +// of await), with context automatically preserved across yields. +function asyncFromGen(genFn) { + return function () { + var gen = genFn.apply(this, arguments); + var boundNext = bind(gen.next); + var boundThrow = bind(gen.throw); + return new Promise(function (resolve, reject) { + function invoke(method, argument) { + try { + var result = method.call(gen, argument); + } + catch (error) { + return reject(error); + } + var next = result.done ? resolve : invokeNext; + if (isPromiseLike(result.value)) { + result.value.then(next, result.done ? reject : invokeThrow); + } + else { + next(result.value); + } + } + var invokeNext = function (value) { return invoke(boundNext, value); }; + var invokeThrow = function (error) { return invoke(boundThrow, error); }; + invokeNext(); + }); + }; +} +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +// If you use the fibers npm package to implement coroutines in Node.js, +// you should call this function at least once to ensure context management +// remains coherent across any yields. +var wrappedFibers = []; +function wrapYieldingFiberMethods(Fiber) { + // There can be only one implementation of Fiber per process, so this array + // should never grow longer than one element. + if (wrappedFibers.indexOf(Fiber) < 0) { + var wrap = function (obj, method) { + var fn = obj[method]; + obj[method] = function () { + return noContext(fn, arguments, this); + }; + }; + // These methods can yield, according to + // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 + wrap(Fiber, "yield"); + wrap(Fiber.prototype, "run"); + wrap(Fiber.prototype, "throwInto"); + wrappedFibers.push(Fiber); + } + return Fiber; +} + +exports.Slot = Slot; +exports.asyncFromGen = asyncFromGen; +exports.bind = bind; +exports.noContext = noContext; +exports.setTimeout = setTimeoutWithContext; +exports.wrapYieldingFiberMethods = wrapYieldingFiberMethods; +//# sourceMappingURL=context.js.map + + +/***/ }), + +/***/ 9969: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; +var fnToStr = Function.prototype.toString; +var previousComparisons = new Map(); +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +function equal(a, b) { + try { + return check(a, b); + } + finally { + previousComparisons.clear(); + } +} +function check(a, b) { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + var aTag = toString.call(a); + var bTag = toString.call(b); + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) + return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) + return true; + var aKeys = definedKeys(a); + var bKeys = definedKeys(b); + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + var keyCount = aKeys.length; + if (keyCount !== bKeys.length) + return false; + // Now make sure they have the same keys. + for (var k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + // Finally, check deep equality of all child properties. + for (var k = 0; k < keyCount; ++k) { + var key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + return true; + } + case '[object Error]': + return a.name === b.name && a.message === b.message; + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) + return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + case '[object RegExp]': + case '[object String]': + return a == "" + b; + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) + return false; + if (previouslyCompared(a, b)) + return true; + var aIterator = a.entries(); + var isMap = aTag === '[object Map]'; + while (true) { + var info = aIterator.next(); + if (info.done) + break; + // If a instanceof Set, aValue === aKey. + var _a = info.value, aKey = _a[0], aValue = _a[1]; + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + return true; + } + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + var len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + var aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + // Otherwise the values are not equal. + return false; +} +function definedKeys(obj) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey(key) { + return this[key] !== void 0; +} +var nativeCodeSuffix = "{ [native code] }"; +function endsWith(full, suffix) { + var fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} +function previouslyCompared(a, b) { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + var bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) + return true; + } + else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} + +exports.default = equal; +exports.equal = equal; +//# sourceMappingURL=equality.js.map + + +/***/ }), + +/***/ 71653: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +var defaultMakeData = function () { return Object.create(null); }; +// Useful for processing arguments objects as well as arrays. +var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; +var Trie = /** @class */ (function () { + function Trie(weakness, makeData) { + if (weakness === void 0) { weakness = true; } + if (makeData === void 0) { makeData = defaultMakeData; } + this.weakness = weakness; + this.makeData = makeData; + } + Trie.prototype.lookup = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return this.lookupArray(array); + }; + Trie.prototype.lookupArray = function (array) { + var node = this; + forEach.call(array, function (key) { return node = node.getChildTrie(key); }); + return node.data || (node.data = this.makeData(slice.call(array))); + }; + Trie.prototype.getChildTrie = function (key) { + var map = this.weakness && isObjRef(key) + ? this.weak || (this.weak = new WeakMap()) + : this.strong || (this.strong = new Map()); + var child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + }; + return Trie; +}()); +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} + +exports.Trie = Trie; +//# sourceMappingURL=trie.js.map + + +/***/ }), + +/***/ 71623: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var assert = __nccwpck_require__(42357) + +var assign = __nccwpck_require__(17426) +var esc = __nccwpck_require__(98691) + +var fileRE = new RegExp('.*' + esc(__filename)) +var createErrWithProps = function (message, props) { + var err = new Error(message) + if (props) { + assign(err, props) + } + return err +} + +module.exports = assertErr + +function assertErr (value, Err/*, ...args */) { + assert(typeof Err === 'function', '"Error" must be a function') + if (Err === Error) Err = createErrWithProps + var args = Array.prototype.slice.call(arguments, 2) + assert(args.length <= 5, 'assertErr does not support more than five Error args') + if (!value) { + var err = createInstance(Err, args) + // remove `assertErr` and `createInstance` from stack + if (err.stack) { + var stackLines = err.stack + .split('\n') + .filter(notMatches(fileRE)) + err.stack = stackLines.join('\n') + } + // throw the error + throw err + } +} + +function createInstance (Class, args) { + return (args.length === 0) + ? new Class() + : (args.length === 1) + ? new Class(args[0]) + : (args.length === 2) + ? new Class(args[0], args[1]) + : (args.length === 3) + ? new Class(args[0], args[1], args[2]) + : (args.length === 4) + ? new Class(args[0], args[1], args[2], args[3]) + : new Class(args[0], args[1], args[2], args[3], args[4]) +} + +function notMatches (re) { + return function (str) { + return !re.test(str) + } +} + + +/***/ }), + +/***/ 16071: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +var aws4 = exports, + url = __nccwpck_require__(78835), + querystring = __nccwpck_require__(71191), + crypto = __nccwpck_require__(76417), + lru = __nccwpck_require__(74225), + credentialsCache = lru(1000) + +// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html + +function hmac(key, string, encoding) { + return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding) +} + +function hash(string, encoding) { + return crypto.createHash('sha256').update(string, 'utf8').digest(encoding) +} + +// This function assumes the string has already been percent encoded +function encodeRfc3986(urlEncodedString) { + return urlEncodedString.replace(/[!'()*]/g, function(c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +function encodeRfc3986Full(str) { + return encodeRfc3986(encodeURIComponent(str)) +} + +// A bit of a combination of: +// https://github.com/aws/aws-sdk-java-v2/blob/dc695de6ab49ad03934e1b02e7263abbd2354be0/core/auth/src/main/java/software/amazon/awssdk/auth/signer/internal/AbstractAws4Signer.java#L59 +// https://github.com/aws/aws-sdk-js/blob/18cb7e5b463b46239f9fdd4a65e2ff8c81831e8f/lib/signers/v4.js#L191-L199 +// https://github.com/mhart/aws4fetch/blob/b3aed16b6f17384cf36ea33bcba3c1e9f3bdfefd/src/main.js#L25-L34 +var HEADERS_TO_IGNORE = { + 'authorization': true, + 'connection': true, + 'x-amzn-trace-id': true, + 'user-agent': true, + 'expect': true, + 'presigned-expires': true, + 'range': true, +} + +// request: { path | body, [host], [method], [headers], [service], [region] } +// credentials: { accessKeyId, secretAccessKey, [sessionToken] } +function RequestSigner(request, credentials) { + + if (typeof request === 'string') request = url.parse(request) + + var headers = request.headers = (request.headers || {}), + hostParts = (!this.service || !this.region) && this.matchHost(request.hostname || request.host || headers.Host || headers.host) + + this.request = request + this.credentials = credentials || this.defaultCredentials() + + this.service = request.service || hostParts[0] || '' + this.region = request.region || hostParts[1] || 'us-east-1' + + // SES uses a different domain from the service name + if (this.service === 'email') this.service = 'ses' + + if (!request.method && request.body) + request.method = 'POST' + + if (!headers.Host && !headers.host) { + headers.Host = request.hostname || request.host || this.createHost() + + // If a port is specified explicitly, use it as is + if (request.port) + headers.Host += ':' + request.port + } + if (!request.hostname && !request.host) + request.hostname = headers.Host || headers.host + + this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT' +} + +RequestSigner.prototype.matchHost = function(host) { + var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(\.cn)?$/) + var hostParts = (match || []).slice(1, 3) + + // ES's hostParts are sometimes the other way round, if the value that is expected + // to be region equals ‘es’ switch them back + // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com + if (hostParts[1] === 'es') + hostParts = hostParts.reverse() + + if (hostParts[1] == 's3') { + hostParts[0] = 's3' + hostParts[1] = 'us-east-1' + } else { + for (var i = 0; i < 2; i++) { + if (/^s3-/.test(hostParts[i])) { + hostParts[1] = hostParts[i].slice(3) + hostParts[0] = 's3' + break + } + } + } + + return hostParts +} + +// http://docs.aws.amazon.com/general/latest/gr/rande.html +RequestSigner.prototype.isSingleRegion = function() { + // Special case for S3 and SimpleDB in us-east-1 + if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true + + return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts'] + .indexOf(this.service) >= 0 +} + +RequestSigner.prototype.createHost = function() { + var region = this.isSingleRegion() ? '' : '.' + this.region, + subdomain = this.service === 'ses' ? 'email' : this.service + return subdomain + region + '.amazonaws.com' +} + +RequestSigner.prototype.prepareRequest = function() { + this.parsePath() + + var request = this.request, headers = request.headers, query + + if (request.signQuery) { + + this.parsedPath.query = query = this.parsedPath.query || {} + + if (this.credentials.sessionToken) + query['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !query['X-Amz-Expires']) + query['X-Amz-Expires'] = 86400 + + if (query['X-Amz-Date']) + this.datetime = query['X-Amz-Date'] + else + query['X-Amz-Date'] = this.getDateTime() + + query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256' + query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString() + query['X-Amz-SignedHeaders'] = this.signedHeaders() + + } else { + + if (!request.doNotModifyHeaders && !this.isCodeCommitGit) { + if (request.body && !headers['Content-Type'] && !headers['content-type']) + headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' + + if (request.body && !headers['Content-Length'] && !headers['content-length']) + headers['Content-Length'] = Buffer.byteLength(request.body) + + if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token']) + headers['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256']) + headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') + + if (headers['X-Amz-Date'] || headers['x-amz-date']) + this.datetime = headers['X-Amz-Date'] || headers['x-amz-date'] + else + headers['X-Amz-Date'] = this.getDateTime() + } + + delete headers.Authorization + delete headers.authorization + } +} + +RequestSigner.prototype.sign = function() { + if (!this.parsedPath) this.prepareRequest() + + if (this.request.signQuery) { + this.parsedPath.query['X-Amz-Signature'] = this.signature() + } else { + this.request.headers.Authorization = this.authHeader() + } + + this.request.path = this.formatPath() + + return this.request +} + +RequestSigner.prototype.getDateTime = function() { + if (!this.datetime) { + var headers = this.request.headers, + date = new Date(headers.Date || headers.date || new Date) + + this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') + + // Remove the trailing 'Z' on the timestamp string for CodeCommit git access + if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1) + } + return this.datetime +} + +RequestSigner.prototype.getDate = function() { + return this.getDateTime().substr(0, 8) +} + +RequestSigner.prototype.authHeader = function() { + return [ + 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(), + 'SignedHeaders=' + this.signedHeaders(), + 'Signature=' + this.signature(), + ].join(', ') +} + +RequestSigner.prototype.signature = function() { + var date = this.getDate(), + cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(), + kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) + if (!kCredentials) { + kDate = hmac('AWS4' + this.credentials.secretAccessKey, date) + kRegion = hmac(kDate, this.region) + kService = hmac(kRegion, this.service) + kCredentials = hmac(kService, 'aws4_request') + credentialsCache.set(cacheKey, kCredentials) + } + return hmac(kCredentials, this.stringToSign(), 'hex') +} + +RequestSigner.prototype.stringToSign = function() { + return [ + 'AWS4-HMAC-SHA256', + this.getDateTime(), + this.credentialString(), + hash(this.canonicalString(), 'hex'), + ].join('\n') +} + +RequestSigner.prototype.canonicalString = function() { + if (!this.parsedPath) this.prepareRequest() + + var pathStr = this.parsedPath.path, + query = this.parsedPath.query, + headers = this.request.headers, + queryStr = '', + normalizePath = this.service !== 's3', + decodePath = this.service === 's3' || this.request.doNotEncodePath, + decodeSlashesInPath = this.service === 's3', + firstValOnly = this.service === 's3', + bodyHash + + if (this.service === 's3' && this.request.signQuery) { + bodyHash = 'UNSIGNED-PAYLOAD' + } else if (this.isCodeCommitGit) { + bodyHash = '' + } else { + bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] || + hash(this.request.body || '', 'hex') + } + + if (query) { + var reducedQuery = Object.keys(query).reduce(function(obj, key) { + if (!key) return obj + obj[encodeRfc3986Full(key)] = !Array.isArray(query[key]) ? query[key] : + (firstValOnly ? query[key][0] : query[key]) + return obj + }, {}) + var encodedQueryPieces = [] + Object.keys(reducedQuery).sort().forEach(function(key) { + if (!Array.isArray(reducedQuery[key])) { + encodedQueryPieces.push(key + '=' + encodeRfc3986Full(reducedQuery[key])) + } else { + reducedQuery[key].map(encodeRfc3986Full).sort() + .forEach(function(val) { encodedQueryPieces.push(key + '=' + val) }) + } + }) + queryStr = encodedQueryPieces.join('&') + } + if (pathStr !== '/') { + if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/') + pathStr = pathStr.split('/').reduce(function(path, piece) { + if (normalizePath && piece === '..') { + path.pop() + } else if (!normalizePath || piece !== '.') { + if (decodePath) piece = decodeURIComponent(piece.replace(/\+/g, ' ')) + path.push(encodeRfc3986Full(piece)) + } + return path + }, []).join('/') + if (pathStr[0] !== '/') pathStr = '/' + pathStr + if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/') + } + + return [ + this.request.method || 'GET', + pathStr, + queryStr, + this.canonicalHeaders() + '\n', + this.signedHeaders(), + bodyHash, + ].join('\n') +} + +RequestSigner.prototype.canonicalHeaders = function() { + var headers = this.request.headers + function trimAll(header) { + return header.toString().trim().replace(/\s+/g, ' ') + } + return Object.keys(headers) + .filter(function(key) { return HEADERS_TO_IGNORE[key.toLowerCase()] == null }) + .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) + .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) + .join('\n') +} + +RequestSigner.prototype.signedHeaders = function() { + return Object.keys(this.request.headers) + .map(function(key) { return key.toLowerCase() }) + .filter(function(key) { return HEADERS_TO_IGNORE[key] == null }) + .sort() + .join(';') +} + +RequestSigner.prototype.credentialString = function() { + return [ + this.getDate(), + this.region, + this.service, + 'aws4_request', + ].join('/') +} + +RequestSigner.prototype.defaultCredentials = function() { + var env = process.env + return { + accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY, + secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY, + sessionToken: env.AWS_SESSION_TOKEN, + } +} + +RequestSigner.prototype.parsePath = function() { + var path = this.request.path || '/' + + // S3 doesn't always encode characters > 127 correctly and + // all services don't encode characters > 255 correctly + // So if there are non-reserved chars (and it's not already all % encoded), just encode them all + if (/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(path)) { + path = encodeURI(decodeURI(path)) + } + + var queryIx = path.indexOf('?'), + query = null + + if (queryIx >= 0) { + query = querystring.parse(path.slice(queryIx + 1)) + path = path.slice(0, queryIx) + } + + this.parsedPath = { + path: path, + query: query, + } +} + +RequestSigner.prototype.formatPath = function() { + var path = this.parsedPath.path, + query = this.parsedPath.query + + if (!query) return path + + // Services don't support empty query string keys + if (query[''] != null) delete query[''] + + return path + '?' + encodeRfc3986(querystring.stringify(query)) +} + +aws4.RequestSigner = RequestSigner + +aws4.sign = function(request, credentials) { + return new RequestSigner(request, credentials).sign() +} + + +/***/ }), + +/***/ 74225: +/***/ ((module) => { + +module.exports = function(size) { + return new LruCache(size) +} + +function LruCache(size) { + this.capacity = size | 0 + this.map = Object.create(null) + this.list = new DoublyLinkedList() +} + +LruCache.prototype.get = function(key) { + var node = this.map[key] + if (node == null) return undefined + this.used(node) + return node.val +} + +LruCache.prototype.set = function(key, val) { + var node = this.map[key] + if (node != null) { + node.val = val + } else { + if (!this.capacity) this.prune() + if (!this.capacity) return false + node = new DoublyLinkedNode(key, val) + this.map[key] = node + this.capacity-- + } + this.used(node) + return true +} + +LruCache.prototype.used = function(node) { + this.list.moveToFront(node) +} + +LruCache.prototype.prune = function() { + var node = this.list.pop() + if (node != null) { + delete this.map[node.key] + this.capacity++ + } +} + + +function DoublyLinkedList() { + this.firstNode = null + this.lastNode = null +} + +DoublyLinkedList.prototype.moveToFront = function(node) { + if (this.firstNode == node) return + + this.remove(node) + + if (this.firstNode == null) { + this.firstNode = node + this.lastNode = node + node.prev = null + node.next = null + } else { + node.prev = null + node.next = this.firstNode + node.next.prev = node + this.firstNode = node + } +} + +DoublyLinkedList.prototype.pop = function() { + var lastNode = this.lastNode + if (lastNode != null) { + this.remove(lastNode) + } + return lastNode +} + +DoublyLinkedList.prototype.remove = function(node) { + if (this.firstNode == node) { + this.firstNode = node.next + } else if (node.prev != null) { + node.prev.next = node.next + } + if (this.lastNode == node) { + this.lastNode = node.prev + } else if (node.next != null) { + node.next.prev = node.prev + } +} + + +function DoublyLinkedNode(key, val) { + this.key = key + this.val = val + this.prev = null + this.next = null +} + + +/***/ }), + +/***/ 20336: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +var DuplexStream = __nccwpck_require__(51642).Duplex + , util = __nccwpck_require__(31669) + , Buffer = __nccwpck_require__(21867).Buffer + +function BufferList (callback) { + if (!(this instanceof BufferList)) + return new BufferList(callback) + + this._bufs = [] + this.length = 0 + + if (typeof callback == 'function') { + this._callback = callback + + var piper = function piper (err) { + if (this._callback) { + this._callback(err) + this._callback = null + } + }.bind(this) + + this.on('pipe', function onPipe (src) { + src.on('error', piper) + }) + this.on('unpipe', function onUnpipe (src) { + src.removeListener('error', piper) + }) + } else { + this.append(callback) + } + + DuplexStream.call(this) +} + + +util.inherits(BufferList, DuplexStream) + + +BufferList.prototype._offset = function _offset (offset) { + var tot = 0, i = 0, _t + if (offset === 0) return [ 0, 0 ] + for (; i < this._bufs.length; i++) { + _t = tot + this._bufs[i].length + if (offset < _t || i == this._bufs.length - 1) { + return [ i, offset - tot ] + } + tot = _t + } +} + +BufferList.prototype._reverseOffset = function (blOffset) { + var bufferId = blOffset[0] + var offset = blOffset[1] + for (var i = 0; i < bufferId; i++) { + offset += this._bufs[i].length + } + return offset +} + +BufferList.prototype.append = function append (buf) { + var i = 0 + + if (Buffer.isBuffer(buf)) { + this._appendBuffer(buf) + } else if (Array.isArray(buf)) { + for (; i < buf.length; i++) + this.append(buf[i]) + } else if (buf instanceof BufferList) { + // unwrap argument into individual BufferLists + for (; i < buf._bufs.length; i++) + this.append(buf._bufs[i]) + } else if (buf != null) { + // coerce number arguments to strings, since Buffer(number) does + // uninitialized memory allocation + if (typeof buf == 'number') + buf = buf.toString() + + this._appendBuffer(Buffer.from(buf)) + } + + return this +} + + +BufferList.prototype._appendBuffer = function appendBuffer (buf) { + this._bufs.push(buf) + this.length += buf.length +} + + +BufferList.prototype._write = function _write (buf, encoding, callback) { + this._appendBuffer(buf) + + if (typeof callback == 'function') + callback() +} + + +BufferList.prototype._read = function _read (size) { + if (!this.length) + return this.push(null) + + size = Math.min(size, this.length) + this.push(this.slice(0, size)) + this.consume(size) +} + + +BufferList.prototype.end = function end (chunk) { + DuplexStream.prototype.end.call(this, chunk) + + if (this._callback) { + this._callback(null, this.slice()) + this._callback = null + } +} + + +BufferList.prototype.get = function get (index) { + if (index > this.length || index < 0) { + return undefined + } + var offset = this._offset(index) + return this._bufs[offset[0]][offset[1]] +} + + +BufferList.prototype.slice = function slice (start, end) { + if (typeof start == 'number' && start < 0) + start += this.length + if (typeof end == 'number' && end < 0) + end += this.length + return this.copy(null, 0, start, end) +} + + +BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { + if (typeof srcStart != 'number' || srcStart < 0) + srcStart = 0 + if (typeof srcEnd != 'number' || srcEnd > this.length) + srcEnd = this.length + if (srcStart >= this.length) + return dst || Buffer.alloc(0) + if (srcEnd <= 0) + return dst || Buffer.alloc(0) + + var copy = !!dst + , off = this._offset(srcStart) + , len = srcEnd - srcStart + , bytes = len + , bufoff = (copy && dstStart) || 0 + , start = off[1] + , l + , i + + // copy/slice everything + if (srcStart === 0 && srcEnd == this.length) { + if (!copy) { // slice, but full concat if multiple buffers + return this._bufs.length === 1 + ? this._bufs[0] + : Buffer.concat(this._bufs, this.length) + } + + // copy, need to copy individual buffers + for (i = 0; i < this._bufs.length; i++) { + this._bufs[i].copy(dst, bufoff) + bufoff += this._bufs[i].length + } + + return dst + } + + // easy, cheap case where it's a subset of one of the buffers + if (bytes <= this._bufs[off[0]].length - start) { + return copy + ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) + : this._bufs[off[0]].slice(start, start + bytes) + } + + if (!copy) // a slice, we need something to copy in to + dst = Buffer.allocUnsafe(len) + + for (i = off[0]; i < this._bufs.length; i++) { + l = this._bufs[i].length - start + + if (bytes > l) { + this._bufs[i].copy(dst, bufoff, start) + bufoff += l + } else { + this._bufs[i].copy(dst, bufoff, start, start + bytes) + bufoff += l + break + } + + bytes -= l + + if (start) + start = 0 + } + + // safeguard so that we don't return uninitialized memory + if (dst.length > bufoff) return dst.slice(0, bufoff) + + return dst +} + +BufferList.prototype.shallowSlice = function shallowSlice (start, end) { + start = start || 0 + end = typeof end !== 'number' ? this.length : end + + if (start < 0) + start += this.length + if (end < 0) + end += this.length + + if (start === end) { + return new BufferList() + } + var startOffset = this._offset(start) + , endOffset = this._offset(end) + , buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) + + if (endOffset[1] == 0) + buffers.pop() + else + buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1]) + + if (startOffset[1] != 0) + buffers[0] = buffers[0].slice(startOffset[1]) + + return new BufferList(buffers) +} + +BufferList.prototype.toString = function toString (encoding, start, end) { + return this.slice(start, end).toString(encoding) +} + +BufferList.prototype.consume = function consume (bytes) { + // first, normalize the argument, in accordance with how Buffer does it + bytes = Math.trunc(bytes) + // do nothing if not a positive number + if (Number.isNaN(bytes) || bytes <= 0) return this + + while (this._bufs.length) { + if (bytes >= this._bufs[0].length) { + bytes -= this._bufs[0].length + this.length -= this._bufs[0].length + this._bufs.shift() + } else { + this._bufs[0] = this._bufs[0].slice(bytes) + this.length -= bytes + break + } + } + return this +} + + +BufferList.prototype.duplicate = function duplicate () { + var i = 0 + , copy = new BufferList() + + for (; i < this._bufs.length; i++) + copy.append(this._bufs[i]) + + return copy +} + + +BufferList.prototype.destroy = function destroy () { + this._bufs.length = 0 + this.length = 0 + this.push(null) +} + + +BufferList.prototype.indexOf = function (search, offset, encoding) { + if (encoding === undefined && typeof offset === 'string') { + encoding = offset + offset = undefined + } + if (typeof search === 'function' || Array.isArray(search)) { + throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.') + } else if (typeof search === 'number') { + search = Buffer.from([search]) + } else if (typeof search === 'string') { + search = Buffer.from(search, encoding) + } else if (search instanceof BufferList) { + search = search.slice() + } else if (!Buffer.isBuffer(search)) { + search = Buffer.from(search) + } + + offset = Number(offset || 0) + if (isNaN(offset)) { + offset = 0 + } + + if (offset < 0) { + offset = this.length + offset + } + + if (offset < 0) { + offset = 0 + } + + if (search.length === 0) { + return offset > this.length ? this.length : offset + } + + var blOffset = this._offset(offset) + var blIndex = blOffset[0] // index of which internal buffer we're working on + var buffOffset = blOffset[1] // offset of the internal buffer we're working on + + // scan over each buffer + for (blIndex; blIndex < this._bufs.length; blIndex++) { + var buff = this._bufs[blIndex] + while(buffOffset < buff.length) { + var availableWindow = buff.length - buffOffset + if (availableWindow >= search.length) { + var nativeSearchResult = buff.indexOf(search, buffOffset) + if (nativeSearchResult !== -1) { + return this._reverseOffset([blIndex, nativeSearchResult]) + } + buffOffset = buff.length - search.length + 1 // end of native search window + } else { + var revOffset = this._reverseOffset([blIndex, buffOffset]) + if (this._match(revOffset, search)) { + return revOffset + } + buffOffset++ + } + } + buffOffset = 0 + } + return -1 +} + +BufferList.prototype._match = function(offset, search) { + if (this.length - offset < search.length) { + return false + } + for (var searchOffset = 0; searchOffset < search.length ; searchOffset++) { + if(this.get(offset + searchOffset) !== search[searchOffset]){ + return false + } + } + return true +} + + +;(function () { + var methods = { + 'readDoubleBE' : 8 + , 'readDoubleLE' : 8 + , 'readFloatBE' : 4 + , 'readFloatLE' : 4 + , 'readInt32BE' : 4 + , 'readInt32LE' : 4 + , 'readUInt32BE' : 4 + , 'readUInt32LE' : 4 + , 'readInt16BE' : 2 + , 'readInt16LE' : 2 + , 'readUInt16BE' : 2 + , 'readUInt16LE' : 2 + , 'readInt8' : 1 + , 'readUInt8' : 1 + , 'readIntBE' : null + , 'readIntLE' : null + , 'readUIntBE' : null + , 'readUIntLE' : null + } + + for (var m in methods) { + (function (m) { + if (methods[m] === null) { + BufferList.prototype[m] = function (offset, byteLength) { + return this.slice(offset, offset + byteLength)[m](0, byteLength) + } + } + else { + BufferList.prototype[m] = function (offset) { + return this.slice(offset, offset + methods[m])[m](0) + } + } + }(m)) + } +}()) + + +module.exports = BufferList + + +/***/ }), + +/***/ 94044: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var BSON = __nccwpck_require__(56800), + Binary = __nccwpck_require__(55497), + Code = __nccwpck_require__(27113), + DBRef = __nccwpck_require__(33797), + Decimal128 = __nccwpck_require__(20414), + Double = __nccwpck_require__(90972), + Int32 = __nccwpck_require__(46142), + Long = __nccwpck_require__(98522), + Map = __nccwpck_require__(93639), + MaxKey = __nccwpck_require__(95846), + MinKey = __nccwpck_require__(75325), + ObjectId = __nccwpck_require__(99502), + BSONRegExp = __nccwpck_require__(74636), + Symbol = __nccwpck_require__(72259), + Timestamp = __nccwpck_require__(61031); + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Add BSON types to function creation +BSON.Binary = Binary; +BSON.Code = Code; +BSON.DBRef = DBRef; +BSON.Decimal128 = Decimal128; +BSON.Double = Double; +BSON.Int32 = Int32; +BSON.Long = Long; +BSON.Map = Map; +BSON.MaxKey = MaxKey; +BSON.MinKey = MinKey; +BSON.ObjectId = ObjectId; +BSON.ObjectID = ObjectId; +BSON.BSONRegExp = BSONRegExp; +BSON.Symbol = Symbol; +BSON.Timestamp = Timestamp; + +// Return the BSON +module.exports = BSON; + + +/***/ }), + +/***/ 55497: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Module dependencies. + * @ignore + */ + +// Test if we're in Node via presence of "global" not absence of "window" +// to support hybrid environments like Electron +if (typeof global !== 'undefined') { + var Buffer = __nccwpck_require__(64293).Buffer; // TODO just use global Buffer +} + +var utils = __nccwpck_require__(12863); + +/** + * A class representation of the BSON Binary type. + * + * Sub types + * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. + * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. + * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. + * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. + * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. + * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. + * + * @class + * @param {Buffer} buffer a buffer object containing the binary data. + * @param {Number} [subType] the option binary type. + * @return {Binary} + */ +function Binary(buffer, subType) { + if (!(this instanceof Binary)) return new Binary(buffer, subType); + + if ( + buffer != null && + !(typeof buffer === 'string') && + !Buffer.isBuffer(buffer) && + !(buffer instanceof Uint8Array) && + !Array.isArray(buffer) + ) { + throw new Error('only String, Buffer, Uint8Array or Array accepted'); + } + + this._bsontype = 'Binary'; + + if (buffer instanceof Number) { + this.sub_type = buffer; + this.position = 0; + } else { + this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; + this.position = 0; + } + + if (buffer != null && !(buffer instanceof Number)) { + // Only accept Buffer, Uint8Array or Arrays + if (typeof buffer === 'string') { + // Different ways of writing the length of the string for the different types + if (typeof Buffer !== 'undefined') { + this.buffer = utils.toBuffer(buffer); + } else if ( + typeof Uint8Array !== 'undefined' || + Object.prototype.toString.call(buffer) === '[object Array]' + ) { + this.buffer = writeStringToArray(buffer); + } else { + throw new Error('only String, Buffer, Uint8Array or Array accepted'); + } + } else { + this.buffer = buffer; + } + this.position = buffer.length; + } else { + if (typeof Buffer !== 'undefined') { + this.buffer = utils.allocBuffer(Binary.BUFFER_SIZE); + } else if (typeof Uint8Array !== 'undefined') { + this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); + } else { + this.buffer = new Array(Binary.BUFFER_SIZE); + } + // Set position to start of buffer + this.position = 0; + } +} + +/** + * Updates this binary with byte_value. + * + * @method + * @param {string} byte_value a single byte we wish to write. + */ +Binary.prototype.put = function put(byte_value) { + // If it's a string and a has more than one character throw an error + if (byte_value['length'] != null && typeof byte_value !== 'number' && byte_value.length !== 1) + throw new Error('only accepts single character String, Uint8Array or Array'); + if ((typeof byte_value !== 'number' && byte_value < 0) || byte_value > 255) + throw new Error('only accepts number in a valid unsigned byte range 0-255'); + + // Decode the byte value once + var decoded_byte = null; + if (typeof byte_value === 'string') { + decoded_byte = byte_value.charCodeAt(0); + } else if (byte_value['length'] != null) { + decoded_byte = byte_value[0]; + } else { + decoded_byte = byte_value; + } + + if (this.buffer.length > this.position) { + this.buffer[this.position++] = decoded_byte; + } else { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + // Create additional overflow buffer + var buffer = utils.allocBuffer(Binary.BUFFER_SIZE + this.buffer.length); + // Combine the two buffers together + this.buffer.copy(buffer, 0, 0, this.buffer.length); + this.buffer = buffer; + this.buffer[this.position++] = decoded_byte; + } else { + buffer = null; + // Create a new buffer (typed or normal array) + if (Object.prototype.toString.call(this.buffer) === '[object Uint8Array]') { + buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); + } else { + buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); + } + + // We need to copy all the content to the new array + for (var i = 0; i < this.buffer.length; i++) { + buffer[i] = this.buffer[i]; + } + + // Reassign the buffer + this.buffer = buffer; + // Write the byte + this.buffer[this.position++] = decoded_byte; + } + } +}; + +/** + * Writes a buffer or string to the binary. + * + * @method + * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. + * @param {number} offset specify the binary of where to write the content. + * @return {null} + */ +Binary.prototype.write = function write(string, offset) { + offset = typeof offset === 'number' ? offset : this.position; + + // If the buffer is to small let's extend the buffer + if (this.buffer.length < offset + string.length) { + var buffer = null; + // If we are in node.js + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + buffer = utils.allocBuffer(this.buffer.length + string.length); + this.buffer.copy(buffer, 0, 0, this.buffer.length); + } else if (Object.prototype.toString.call(this.buffer) === '[object Uint8Array]') { + // Create a new buffer + buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)); + // Copy the content + for (var i = 0; i < this.position; i++) { + buffer[i] = this.buffer[i]; + } + } + + // Assign the new buffer + this.buffer = buffer; + } + + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { + string.copy(this.buffer, offset, 0, string.length); + this.position = offset + string.length > this.position ? offset + string.length : this.position; + // offset = string.length + } else if ( + typeof Buffer !== 'undefined' && + typeof string === 'string' && + Buffer.isBuffer(this.buffer) + ) { + this.buffer.write(string, offset, 'binary'); + this.position = offset + string.length > this.position ? offset + string.length : this.position; + // offset = string.length; + } else if ( + Object.prototype.toString.call(string) === '[object Uint8Array]' || + (Object.prototype.toString.call(string) === '[object Array]' && typeof string !== 'string') + ) { + for (i = 0; i < string.length; i++) { + this.buffer[offset++] = string[i]; + } + + this.position = offset > this.position ? offset : this.position; + } else if (typeof string === 'string') { + for (i = 0; i < string.length; i++) { + this.buffer[offset++] = string.charCodeAt(i); + } + + this.position = offset > this.position ? offset : this.position; + } +}; + +/** + * Reads **length** bytes starting at **position**. + * + * @method + * @param {number} position read from the given position in the Binary. + * @param {number} length the number of bytes to read. + * @return {Buffer} + */ +Binary.prototype.read = function read(position, length) { + length = length && length > 0 ? length : this.position; + + // Let's return the data based on the type we have + if (this.buffer['slice']) { + return this.buffer.slice(position, position + length); + } else { + // Create a buffer to keep the result + var buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(length)) + : new Array(length); + for (var i = 0; i < length; i++) { + buffer[i] = this.buffer[position++]; + } + } + // Return the buffer + return buffer; +}; + +/** + * Returns the value of this binary as a string. + * + * @method + * @return {string} + */ +Binary.prototype.value = function value(asRaw) { + asRaw = asRaw == null ? false : asRaw; + + // Optimize to serialize for the situation where the data == size of buffer + if ( + asRaw && + typeof Buffer !== 'undefined' && + Buffer.isBuffer(this.buffer) && + this.buffer.length === this.position + ) + return this.buffer; + + // If it's a node.js buffer object + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + return asRaw + ? this.buffer.slice(0, this.position) + : this.buffer.toString('binary', 0, this.position); + } else { + if (asRaw) { + // we support the slice command use it + if (this.buffer['slice'] != null) { + return this.buffer.slice(0, this.position); + } else { + // Create a new buffer to copy content to + var newBuffer = + Object.prototype.toString.call(this.buffer) === '[object Uint8Array]' + ? new Uint8Array(new ArrayBuffer(this.position)) + : new Array(this.position); + // Copy content + for (var i = 0; i < this.position; i++) { + newBuffer[i] = this.buffer[i]; + } + // Return the buffer + return newBuffer; + } + } else { + return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); + } + } +}; + +/** + * Length. + * + * @method + * @return {number} the length of the binary. + */ +Binary.prototype.length = function length() { + return this.position; +}; + +/** + * @ignore + */ +Binary.prototype.toJSON = function() { + return this.buffer != null ? this.buffer.toString('base64') : ''; +}; + +/** + * @ignore + */ +Binary.prototype.toString = function(format) { + return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; +}; + +/** + * Binary default subtype + * @ignore + */ +var BSON_BINARY_SUBTYPE_DEFAULT = 0; + +/** + * @ignore + */ +var writeStringToArray = function(data) { + // Create a buffer + var buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(data.length)) + : new Array(data.length); + // Write the content to the buffer + for (var i = 0; i < data.length; i++) { + buffer[i] = data.charCodeAt(i); + } + // Write the string to the buffer + return buffer; +}; + +/** + * Convert Array ot Uint8Array to Binary String + * + * @ignore + */ +var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { + var result = ''; + for (var i = startIndex; i < endIndex; i++) { + result = result + String.fromCharCode(byteArray[i]); + } + return result; +}; + +Binary.BUFFER_SIZE = 256; + +/** + * Default BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_DEFAULT = 0; +/** + * Function BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_FUNCTION = 1; +/** + * Byte Array BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_BYTE_ARRAY = 2; +/** + * OLD UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_UUID_OLD = 3; +/** + * UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_UUID = 4; +/** + * MD5 BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_MD5 = 5; +/** + * User BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_USER_DEFINED = 128; + +/** + * Expose. + */ +module.exports = Binary; +module.exports.Binary = Binary; + + +/***/ }), + +/***/ 56800: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Map = __nccwpck_require__(93639), + Long = __nccwpck_require__(98522), + Double = __nccwpck_require__(90972), + Timestamp = __nccwpck_require__(61031), + ObjectID = __nccwpck_require__(99502), + BSONRegExp = __nccwpck_require__(74636), + Symbol = __nccwpck_require__(72259), + Int32 = __nccwpck_require__(46142), + Code = __nccwpck_require__(27113), + Decimal128 = __nccwpck_require__(20414), + MinKey = __nccwpck_require__(75325), + MaxKey = __nccwpck_require__(95846), + DBRef = __nccwpck_require__(33797), + Binary = __nccwpck_require__(55497); + +// Parts of the parser +var deserialize = __nccwpck_require__(62139), + serializer = __nccwpck_require__(99290), + calculateObjectSize = __nccwpck_require__(61273), + utils = __nccwpck_require__(12863); + +/** + * @ignore + * @api private + */ +// Default Max Size +var MAXSIZE = 1024 * 1024 * 17; + +// Current Internal Temporary Serialization Buffer +var buffer = utils.allocBuffer(MAXSIZE); + +var BSON = function() {}; + +/** + * Serialize a Javascript object. + * + * @param {Object} object the Javascript object to serialize. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @param {Number} [options.minInternalBufferSize=1024*1024*17] minimum size of the internal temporary serialization buffer **(default:1024*1024*17)**. + * @return {Buffer} returns the Buffer object containing the serialized object. + * @api public + */ +BSON.prototype.serialize = function serialize(object, options) { + options = options || {}; + // Unpack the options + var checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + var minInternalBufferSize = + typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE; + + // Resize the internal serialization buffer if needed + if (buffer.length < minInternalBufferSize) { + buffer = utils.allocBuffer(minInternalBufferSize); + } + + // Attempt to serialize + var serializationIndex = serializer( + buffer, + object, + checkKeys, + 0, + 0, + serializeFunctions, + ignoreUndefined, + [] + ); + // Create the final buffer + var finishedBuffer = utils.allocBuffer(serializationIndex); + // Copy into the finished buffer + buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); + // Return the buffer + return finishedBuffer; +}; + +/** + * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. + * + * @param {Object} object the Javascript object to serialize. + * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @param {Number} [options.index] the index in the buffer where we wish to start serializing into. + * @return {Number} returns the index pointing to the last written byte in the buffer. + * @api public + */ +BSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) { + options = options || {}; + // Unpack the options + var checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + var startIndex = typeof options.index === 'number' ? options.index : 0; + + // Attempt to serialize + var serializationIndex = serializer( + finalBuffer, + object, + checkKeys, + startIndex || 0, + 0, + serializeFunctions, + ignoreUndefined + ); + + // Return the index + return serializationIndex - 1; +}; + +/** + * Deserialize data as BSON. + * + * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Object} returns the deserialized Javascript Object. + * @api public + */ +BSON.prototype.deserialize = function(buffer, options) { + return deserialize(buffer, options); +}; + +/** + * Calculate the bson size for a passed in Javascript object. + * + * @param {Object} object the Javascript object to calculate the BSON byte size for. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @return {Number} returns the number of bytes the BSON object will take up. + * @api public + */ +BSON.prototype.calculateObjectSize = function(object, options) { + options = options || {}; + + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + + return calculateObjectSize(object, serializeFunctions, ignoreUndefined); +}; + +/** + * Deserialize stream data as BSON documents. + * + * @param {Buffer} data the buffer containing the serialized set of BSON documents. + * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. + * @param {Number} numberOfDocuments number of documents to deserialize. + * @param {Array} documents an array where to store the deserialized documents. + * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. + * @param {Object} [options] additional options used for the deserialization. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. + * @api public + */ +BSON.prototype.deserializeStream = function( + data, + startIndex, + numberOfDocuments, + documents, + docStartIndex, + options +) { + options = options != null ? options : {}; + var index = startIndex; + // Loop over all documents + for (var i = 0; i < numberOfDocuments; i++) { + // Find size of the document + var size = + data[index] | (data[index + 1] << 8) | (data[index + 2] << 16) | (data[index + 3] << 24); + // Update options with index + options['index'] = index; + // Parse the document at this point + documents[docStartIndex + i] = this.deserialize(data, options); + // Adjust index by the document size + index = index + size; + } + + // Return object containing end index of parsing and list of documents + return index; +}; + +/** + * @ignore + * @api private + */ +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +// var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +// var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; + +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// Return BSON +module.exports = BSON; +module.exports.Code = Code; +module.exports.Map = Map; +module.exports.Symbol = Symbol; +module.exports.BSON = BSON; +module.exports.DBRef = DBRef; +module.exports.Binary = Binary; +module.exports.ObjectID = ObjectID; +module.exports.Long = Long; +module.exports.Timestamp = Timestamp; +module.exports.Double = Double; +module.exports.Int32 = Int32; +module.exports.MinKey = MinKey; +module.exports.MaxKey = MaxKey; +module.exports.BSONRegExp = BSONRegExp; +module.exports.Decimal128 = Decimal128; + + +/***/ }), + +/***/ 27113: +/***/ ((module) => { + +/** + * A class representation of the BSON Code type. + * + * @class + * @param {(string|function)} code a string or function. + * @param {Object} [scope] an optional scope for the function. + * @return {Code} + */ +var Code = function Code(code, scope) { + if (!(this instanceof Code)) return new Code(code, scope); + this._bsontype = 'Code'; + this.code = code; + this.scope = scope; +}; + +/** + * @ignore + */ +Code.prototype.toJSON = function() { + return { scope: this.scope, code: this.code }; +}; + +module.exports = Code; +module.exports.Code = Code; + + +/***/ }), + +/***/ 33797: +/***/ ((module) => { + +/** + * A class representation of the BSON DBRef type. + * + * @class + * @param {string} namespace the collection name. + * @param {ObjectID} oid the reference ObjectID. + * @param {string} [db] optional db name, if omitted the reference is local to the current db. + * @return {DBRef} + */ +function DBRef(namespace, oid, db) { + if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db); + + this._bsontype = 'DBRef'; + this.namespace = namespace; + this.oid = oid; + this.db = db; +} + +/** + * @ignore + * @api private + */ +DBRef.prototype.toJSON = function() { + return { + $ref: this.namespace, + $id: this.oid, + $db: this.db == null ? '' : this.db + }; +}; + +module.exports = DBRef; +module.exports.DBRef = DBRef; + + +/***/ }), + +/***/ 20414: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Long = __nccwpck_require__(98522); + +var PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/; +var PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i; +var PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i; + +var EXPONENT_MAX = 6111; +var EXPONENT_MIN = -6176; +var EXPONENT_BIAS = 6176; +var MAX_DIGITS = 34; + +// Nan value bits as 32 bit values (due to lack of longs) +var NAN_BUFFER = [ + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); +// Infinity value bits 32 bit values (due to lack of longs) +var INF_NEGATIVE_BUFFER = [ + 0xf8, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); +var INF_POSITIVE_BUFFER = [ + 0x78, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); + +var EXPONENT_REGEX = /^([-+])?(\d+)?$/; + +var utils = __nccwpck_require__(12863); + +// Detect if the value is a digit +var isDigit = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +// Divide two uint128 values +var divideu128 = function(value) { + var DIVISOR = Long.fromNumber(1000 * 1000 * 1000); + var _rem = Long.fromNumber(0); + var i = 0; + + if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) { + return { quotient: value, rem: _rem }; + } + + for (i = 0; i <= 3; i++) { + // Adjust remainder to match value of next dividend + _rem = _rem.shiftLeft(32); + // Add the divided to _rem + _rem = _rem.add(new Long(value.parts[i], 0)); + value.parts[i] = _rem.div(DIVISOR).low_; + _rem = _rem.modulo(DIVISOR); + } + + return { quotient: value, rem: _rem }; +}; + +// Multiply two Long values and return the 128 bit value +var multiply64x2 = function(left, right) { + if (!left && !right) { + return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; + } + + var leftHigh = left.shiftRightUnsigned(32); + var leftLow = new Long(left.getLowBits(), 0); + var rightHigh = right.shiftRightUnsigned(32); + var rightLow = new Long(right.getLowBits(), 0); + + var productHigh = leftHigh.multiply(rightHigh); + var productMid = leftHigh.multiply(rightLow); + var productMid2 = leftLow.multiply(rightHigh); + var productLow = leftLow.multiply(rightLow); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productMid = new Long(productMid.getLowBits(), 0) + .add(productMid2) + .add(productLow.shiftRightUnsigned(32)); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); + + // Return the 128 bit result + return { high: productHigh, low: productLow }; +}; + +var lessThan = function(left, right) { + // Make values unsigned + var uhleft = left.high_ >>> 0; + var uhright = right.high_ >>> 0; + + // Compare high bits first + if (uhleft < uhright) { + return true; + } else if (uhleft === uhright) { + var ulleft = left.low_ >>> 0; + var ulright = right.low_ >>> 0; + if (ulleft < ulright) return true; + } + + return false; +}; + +// var longtoHex = function(value) { +// var buffer = utils.allocBuffer(8); +// var index = 0; +// // Encode the low 64 bits of the decimal +// // Encode low bits +// buffer[index++] = value.low_ & 0xff; +// buffer[index++] = (value.low_ >> 8) & 0xff; +// buffer[index++] = (value.low_ >> 16) & 0xff; +// buffer[index++] = (value.low_ >> 24) & 0xff; +// // Encode high bits +// buffer[index++] = value.high_ & 0xff; +// buffer[index++] = (value.high_ >> 8) & 0xff; +// buffer[index++] = (value.high_ >> 16) & 0xff; +// buffer[index++] = (value.high_ >> 24) & 0xff; +// return buffer.reverse().toString('hex'); +// }; + +// var int32toHex = function(value) { +// var buffer = utils.allocBuffer(4); +// var index = 0; +// // Encode the low 64 bits of the decimal +// // Encode low bits +// buffer[index++] = value & 0xff; +// buffer[index++] = (value >> 8) & 0xff; +// buffer[index++] = (value >> 16) & 0xff; +// buffer[index++] = (value >> 24) & 0xff; +// return buffer.reverse().toString('hex'); +// }; + +/** + * A class representation of the BSON Decimal128 type. + * + * @class + * @param {Buffer} bytes a buffer containing the raw Decimal128 bytes. + * @return {Double} + */ +var Decimal128 = function(bytes) { + this._bsontype = 'Decimal128'; + this.bytes = bytes; +}; + +/** + * Create a Decimal128 instance from a string representation + * + * @method + * @param {string} string a numeric string representation. + * @return {Decimal128} returns a Decimal128 instance. + */ +Decimal128.fromString = function(string) { + // Parse state tracking + var isNegative = false; + var sawRadix = false; + var foundNonZero = false; + + // Total number of significant digits (no leading or trailing zero) + var significantDigits = 0; + // Total number of significand digits read + var nDigitsRead = 0; + // Total number of digits (no leading zeros) + var nDigits = 0; + // The number of the digits after radix + var radixPosition = 0; + // The index of the first non-zero in *str* + var firstNonZero = 0; + + // Digits Array + var digits = [0]; + // The number of digits in digits + var nDigitsStored = 0; + // Insertion pointer for digits + var digitsInsert = 0; + // The index of the first non-zero digit + var firstDigit = 0; + // The index of the last digit + var lastDigit = 0; + + // Exponent + var exponent = 0; + // loop index over array + var i = 0; + // The high 17 digits of the significand + var significandHigh = [0, 0]; + // The low 17 digits of the significand + var significandLow = [0, 0]; + // The biased exponent + var biasedExponent = 0; + + // Read index + var index = 0; + + // Trim the string + string = string.trim(); + + // Naively prevent against REDOS attacks. + // TODO: implementing a custom parsing for this, or refactoring the regex would yield + // further gains. + if (string.length >= 7000) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Results + var stringMatch = string.match(PARSE_STRING_REGEXP); + var infMatch = string.match(PARSE_INF_REGEXP); + var nanMatch = string.match(PARSE_NAN_REGEXP); + + // Validate the string + if ((!stringMatch && !infMatch && !nanMatch) || string.length === 0) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Check if we have an illegal exponent format + if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Get the negative or positive sign + if (string[index] === '+' || string[index] === '-') { + isNegative = string[index++] === '-'; + } + + // Check if user passed Infinity or NaN + if (!isDigit(string[index]) && string[index] !== '.') { + if (string[index] === 'i' || string[index] === 'I') { + return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } else if (string[index] === 'N') { + return new Decimal128(utils.toBuffer(NAN_BUFFER)); + } + } + + // Read all the digits + while (isDigit(string[index]) || string[index] === '.') { + if (string[index] === '.') { + if (sawRadix) { + return new Decimal128(utils.toBuffer(NAN_BUFFER)); + } + + sawRadix = true; + index = index + 1; + continue; + } + + if (nDigitsStored < 34) { + if (string[index] !== '0' || foundNonZero) { + if (!foundNonZero) { + firstNonZero = nDigitsRead; + } + + foundNonZero = true; + + // Only store 34 digits + digits[digitsInsert++] = parseInt(string[index], 10); + nDigitsStored = nDigitsStored + 1; + } + } + + if (foundNonZero) { + nDigits = nDigits + 1; + } + + if (sawRadix) { + radixPosition = radixPosition + 1; + } + + nDigitsRead = nDigitsRead + 1; + index = index + 1; + } + + if (sawRadix && !nDigitsRead) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Read exponent if exists + if (string[index] === 'e' || string[index] === 'E') { + // Read exponent digits + var match = string.substr(++index).match(EXPONENT_REGEX); + + // No digits read + if (!match || !match[2]) { + return new Decimal128(utils.toBuffer(NAN_BUFFER)); + } + + // Get exponent + exponent = parseInt(match[0], 10); + + // Adjust the index + index = index + match[0].length; + } + + // Return not a number + if (string[index]) { + return new Decimal128(utils.toBuffer(NAN_BUFFER)); + } + + // Done reading input + // Find first non-zero digit in digits + firstDigit = 0; + + if (!nDigitsStored) { + firstDigit = 0; + lastDigit = 0; + digits[0] = 0; + nDigits = 1; + nDigitsStored = 1; + significantDigits = 0; + } else { + lastDigit = nDigitsStored - 1; + significantDigits = nDigits; + + if (exponent !== 0 && significantDigits !== 1) { + while (string[firstNonZero + significantDigits - 1] === '0') { + significantDigits = significantDigits - 1; + } + } + } + + // Normalization of exponent + // Correct exponent based on radix position, and shift significand as needed + // to represent user input + + // Overflow prevention + if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) { + exponent = EXPONENT_MIN; + } else { + exponent = exponent - radixPosition; + } + + // Attempt to normalize the exponent + while (exponent > EXPONENT_MAX) { + // Shift exponent to significand and decrease + lastDigit = lastDigit + 1; + + if (lastDigit - firstDigit > MAX_DIGITS) { + // Check if we have a zero then just hard clamp, otherwise fail + var digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } + } + + exponent = exponent - 1; + } + + while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { + // Shift last digit + if (lastDigit === 0) { + exponent = EXPONENT_MIN; + significantDigits = 0; + break; + } + + if (nDigitsStored < nDigits) { + // adjust to match digits not stored + nDigits = nDigits - 1; + } else { + // adjust to round + lastDigit = lastDigit - 1; + } + + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + } else { + // Check if we have a zero then just hard clamp, otherwise fail + digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } + } + } + + // Round + // We've normalized the exponent, but might still need to round. + if (lastDigit - firstDigit + 1 < significantDigits && string[significantDigits] !== '0') { + var endOfString = nDigitsRead; + + // If we have seen a radix point, 'string' is 1 longer than we have + // documented with ndigits_read, so inc the position of the first nonzero + // digit and the position that digits are read to. + if (sawRadix && exponent === EXPONENT_MIN) { + firstNonZero = firstNonZero + 1; + endOfString = endOfString + 1; + } + + var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10); + var roundBit = 0; + + if (roundDigit >= 5) { + roundBit = 1; + + if (roundDigit === 5) { + roundBit = digits[lastDigit] % 2 === 1; + + for (i = firstNonZero + lastDigit + 2; i < endOfString; i++) { + if (parseInt(string[i], 10)) { + roundBit = 1; + break; + } + } + } + } + + if (roundBit) { + var dIdx = lastDigit; + + for (; dIdx >= 0; dIdx--) { + if (++digits[dIdx] > 9) { + digits[dIdx] = 0; + + // overflowed most significant digit + if (dIdx === 0) { + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + digits[dIdx] = 1; + } else { + return new Decimal128( + utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER) + ); + } + } + } else { + break; + } + } + } + } + + // Encode significand + // The high 17 digits of the significand + significandHigh = Long.fromNumber(0); + // The low 17 digits of the significand + significandLow = Long.fromNumber(0); + + // read a zero + if (significantDigits === 0) { + significandHigh = Long.fromNumber(0); + significandLow = Long.fromNumber(0); + } else if (lastDigit - firstDigit < 17) { + dIdx = firstDigit; + significandLow = Long.fromNumber(digits[dIdx++]); + significandHigh = new Long(0, 0); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } else { + dIdx = firstDigit; + significandHigh = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit - 17; dIdx++) { + significandHigh = significandHigh.multiply(Long.fromNumber(10)); + significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx])); + } + + significandLow = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } + + var significand = multiply64x2(significandHigh, Long.fromString('100000000000000000')); + + significand.low = significand.low.add(significandLow); + + if (lessThan(significand.low, significandLow)) { + significand.high = significand.high.add(Long.fromNumber(1)); + } + + // Biased exponent + biasedExponent = exponent + EXPONENT_BIAS; + var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) }; + + // Encode combination, exponent, and significand. + if ( + significand.high + .shiftRightUnsigned(49) + .and(Long.fromNumber(1)) + .equals(Long.fromNumber) + ) { + // Encode '11' into bits 1 to 3 + dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61)); + dec.high = dec.high.or( + Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)) + ); + dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff))); + } else { + dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49)); + dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff))); + } + + dec.low = significand.low; + + // Encode sign + if (isNegative) { + dec.high = dec.high.or(Long.fromString('9223372036854775808')); + } + + // Encode into a buffer + var buffer = utils.allocBuffer(16); + index = 0; + + // Encode the low 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.low.low_ & 0xff; + buffer[index++] = (dec.low.low_ >> 8) & 0xff; + buffer[index++] = (dec.low.low_ >> 16) & 0xff; + buffer[index++] = (dec.low.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.low.high_ & 0xff; + buffer[index++] = (dec.low.high_ >> 8) & 0xff; + buffer[index++] = (dec.low.high_ >> 16) & 0xff; + buffer[index++] = (dec.low.high_ >> 24) & 0xff; + + // Encode the high 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.high.low_ & 0xff; + buffer[index++] = (dec.high.low_ >> 8) & 0xff; + buffer[index++] = (dec.high.low_ >> 16) & 0xff; + buffer[index++] = (dec.high.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.high.high_ & 0xff; + buffer[index++] = (dec.high.high_ >> 8) & 0xff; + buffer[index++] = (dec.high.high_ >> 16) & 0xff; + buffer[index++] = (dec.high.high_ >> 24) & 0xff; + + // Return the new Decimal128 + return new Decimal128(buffer); +}; + +// Extract least significant 5 bits +var COMBINATION_MASK = 0x1f; +// Extract least significant 14 bits +var EXPONENT_MASK = 0x3fff; +// Value of combination field for Inf +var COMBINATION_INFINITY = 30; +// Value of combination field for NaN +var COMBINATION_NAN = 31; +// Value of combination field for NaN +// var COMBINATION_SNAN = 32; +// decimal128 exponent bias +EXPONENT_BIAS = 6176; + +/** + * Create a string representation of the raw Decimal128 value + * + * @method + * @return {string} returns a Decimal128 string representation. + */ +Decimal128.prototype.toString = function() { + // Note: bits in this routine are referred to starting at 0, + // from the sign bit, towards the coefficient. + + // bits 0 - 31 + var high; + // bits 32 - 63 + var midh; + // bits 64 - 95 + var midl; + // bits 96 - 127 + var low; + // bits 1 - 5 + var combination; + // decoded biased exponent (14 bits) + var biased_exponent; + // the number of significand digits + var significand_digits = 0; + // the base-10 digits in the significand + var significand = new Array(36); + for (var i = 0; i < significand.length; i++) significand[i] = 0; + // read pointer into significand + var index = 0; + + // unbiased exponent + var exponent; + // the exponent if scientific notation is used + var scientific_exponent; + + // true if the number is zero + var is_zero = false; + + // the most signifcant significand bits (50-46) + var significand_msb; + // temporary storage for significand decoding + var significand128 = { parts: new Array(4) }; + // indexing variables + i; + var j, k; + + // Output string + var string = []; + + // Unpack index + index = 0; + + // Buffer reference + var buffer = this.bytes; + + // Unpack the low 64bits into a long + low = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + midl = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Unpack the high 64bits into a long + midh = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + high = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Unpack index + index = 0; + + // Create the state of the decimal + var dec = { + low: new Long(low, midl), + high: new Long(midh, high) + }; + + if (dec.high.lessThan(Long.ZERO)) { + string.push('-'); + } + + // Decode combination field and exponent + combination = (high >> 26) & COMBINATION_MASK; + + if (combination >> 3 === 3) { + // Check for 'special' values + if (combination === COMBINATION_INFINITY) { + return string.join('') + 'Infinity'; + } else if (combination === COMBINATION_NAN) { + return 'NaN'; + } else { + biased_exponent = (high >> 15) & EXPONENT_MASK; + significand_msb = 0x08 + ((high >> 14) & 0x01); + } + } else { + significand_msb = (high >> 14) & 0x07; + biased_exponent = (high >> 17) & EXPONENT_MASK; + } + + exponent = biased_exponent - EXPONENT_BIAS; + + // Create string of significand digits + + // Convert the 114-bit binary number represented by + // (significand_high, significand_low) to at most 34 decimal + // digits through modulo and division. + significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); + significand128.parts[1] = midh; + significand128.parts[2] = midl; + significand128.parts[3] = low; + + if ( + significand128.parts[0] === 0 && + significand128.parts[1] === 0 && + significand128.parts[2] === 0 && + significand128.parts[3] === 0 + ) { + is_zero = true; + } else { + for (k = 3; k >= 0; k--) { + var least_digits = 0; + // Peform the divide + var result = divideu128(significand128); + significand128 = result.quotient; + least_digits = result.rem.low_; + + // We now have the 9 least significant digits (in base 2). + // Convert and output to string. + if (!least_digits) continue; + + for (j = 8; j >= 0; j--) { + // significand[k * 9 + j] = Math.round(least_digits % 10); + significand[k * 9 + j] = least_digits % 10; + // least_digits = Math.round(least_digits / 10); + least_digits = Math.floor(least_digits / 10); + } + } + } + + // Output format options: + // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd + // Regular - ddd.ddd + + if (is_zero) { + significand_digits = 1; + significand[index] = 0; + } else { + significand_digits = 36; + i = 0; + + while (!significand[index]) { + i++; + significand_digits = significand_digits - 1; + index = index + 1; + } + } + + scientific_exponent = significand_digits - 1 + exponent; + + // The scientific exponent checks are dictated by the string conversion + // specification and are somewhat arbitrary cutoffs. + // + // We must check exponent > 0, because if this is the case, the number + // has trailing zeros. However, we *cannot* output these trailing zeros, + // because doing so would change the precision of the value, and would + // change stored data if the string converted number is round tripped. + + if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) { + // Scientific format + string.push(significand[index++]); + significand_digits = significand_digits - 1; + + if (significand_digits) { + string.push('.'); + } + + for (i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + + // Exponent + string.push('E'); + if (scientific_exponent > 0) { + string.push('+' + scientific_exponent); + } else { + string.push(scientific_exponent); + } + } else { + // Regular format with no decimal place + if (exponent >= 0) { + for (i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + } else { + var radix_position = significand_digits + exponent; + + // non-zero digits before radix + if (radix_position > 0) { + for (i = 0; i < radix_position; i++) { + string.push(significand[index++]); + } + } else { + string.push('0'); + } + + string.push('.'); + // add leading zeros after radix + while (radix_position++ < 0) { + string.push('0'); + } + + for (i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) { + string.push(significand[index++]); + } + } + } + + return string.join(''); +}; + +Decimal128.prototype.toJSON = function() { + return { $numberDecimal: this.toString() }; +}; + +module.exports = Decimal128; +module.exports.Decimal128 = Decimal128; + + +/***/ }), + +/***/ 90972: +/***/ ((module) => { + +/** + * A class representation of the BSON Double type. + * + * @class + * @param {number} value the number we want to represent as a double. + * @return {Double} + */ +function Double(value) { + if (!(this instanceof Double)) return new Double(value); + + this._bsontype = 'Double'; + this.value = value; +} + +/** + * Access the number value. + * + * @method + * @return {number} returns the wrapped double number. + */ +Double.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Double.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Double; +module.exports.Double = Double; + + +/***/ }), + +/***/ 57281: +/***/ ((__unused_webpack_module, exports) => { + +var __webpack_unused_export__; +// Copyright (c) 2008, Fair Oaks Labs, Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// +// Modifications to writeIEEE754 to support negative zeroes made by Brian White + +var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { + var e, + m, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = -7, + i = bBE ? 0 : nBytes - 1, + d = bBE ? 1 : -1, + 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); +}; + +var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { + var e, + m, + c, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + i = bBE ? nBytes - 1 : 0, + d = bBE ? -1 : 1, + 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; +}; + +__webpack_unused_export__ = readIEEE754; +exports.P = writeIEEE754; + + +/***/ }), + +/***/ 46142: +/***/ ((module) => { + +/** + * A class representation of a BSON Int32 type. + * + * @class + * @param {number} value the number we want to represent as an int32. + * @return {Int32} + */ +var Int32 = function(value) { + if (!(this instanceof Int32)) return new Int32(value); + + this._bsontype = 'Int32'; + this.value = value; +}; + +/** + * Access the number value. + * + * @method + * @return {number} returns the wrapped int32 number. + */ +Int32.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Int32.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Int32; +module.exports.Int32 = Int32; + + +/***/ }), + +/***/ 98522: +/***/ ((module) => { + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright 2009 Google Inc. All Rights Reserved + +/** + * Defines a Long class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Long". This + * implementation is derived from LongLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Longs. + * + * The internal representation of a Long is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Long. + * @param {number} high the high (signed) 32 bits of the Long. + * @return {Long} + */ +function Long(low, high) { + if (!(this instanceof Long)) return new Long(low, high); + + this._bsontype = 'Long'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. +} + +/** + * Return the int value. + * + * @method + * @return {number} the value, assuming it is a 32-bit integer. + */ +Long.prototype.toInt = function() { + return this.low_; +}; + +/** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ +Long.prototype.toNumber = function() { + return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); +}; + +/** Converts the Long to a BigInt (arbitrary precision). */ +Long.prototype.toBigInt = function () { + return BigInt(this.toString()); +} + +/** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ +Long.prototype.toJSON = function() { + return this.toString(); +}; + +/** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ +Long.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = Long.fromNumber(radix); + var div = this.div(radixLong); + var rem = div.multiply(radixLong).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 6)); + + rem = this; + var result = ''; + + while (!rem.isZero()) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } +}; + +/** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ +Long.prototype.getHighBits = function() { + return this.high_; +}; + +/** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ +Long.prototype.getLowBits = function() { + return this.low_; +}; + +/** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ +Long.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; +}; + +/** + * Returns the number of bits needed to represent the absolute value of this Long. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Long. + */ +Long.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ !== 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) !== 0) { + break; + } + } + return this.high_ !== 0 ? bit + 33 : bit + 1; + } +}; + +/** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ +Long.prototype.isZero = function() { + return this.high_ === 0 && this.low_ === 0; +}; + +/** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ +Long.prototype.isNegative = function() { + return this.high_ < 0; +}; + +/** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ +Long.prototype.isOdd = function() { + return (this.low_ & 1) === 1; +}; + +/** + * Return whether this Long equals the other + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long equals the other + */ +Long.prototype.equals = function(other) { + return this.high_ === other.high_ && this.low_ === other.low_; +}; + +/** + * Return whether this Long does not equal the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long does not equal the other. + */ +Long.prototype.notEquals = function(other) { + return this.high_ !== other.high_ || this.low_ !== other.low_; +}; + +/** + * Return whether this Long is less than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than the other. + */ +Long.prototype.lessThan = function(other) { + return this.compare(other) < 0; +}; + +/** + * Return whether this Long is less than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than or equal to the other. + */ +Long.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; +}; + +/** + * Return whether this Long is greater than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than the other. + */ +Long.prototype.greaterThan = function(other) { + return this.compare(other) > 0; +}; + +/** + * Return whether this Long is greater than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than or equal to the other. + */ +Long.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; +}; + +/** + * Compares this Long with the given one. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ +Long.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } +}; + +/** + * The negation of this value. + * + * @method + * @return {Long} the negation of this value. + */ +Long.prototype.negate = function() { + if (this.equals(Long.MIN_VALUE)) { + return Long.MIN_VALUE; + } else { + return this.not().add(Long.ONE); + } +}; + +/** + * Returns the sum of this and the given Long. + * + * @method + * @param {Long} other Long to add to this one. + * @return {Long} the sum of this and the given Long. + */ +Long.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns the difference of this and the given Long. + * + * @method + * @param {Long} other Long to subtract from this. + * @return {Long} the difference of this and the given Long. + */ +Long.prototype.subtract = function(other) { + return this.add(other.negate()); +}; + +/** + * Returns the product of this and the given Long. + * + * @method + * @param {Long} other Long to multiply with this. + * @return {Long} the product of this and the other. + */ +Long.prototype.multiply = function(other) { + if (this.isZero()) { + return Long.ZERO; + } else if (other.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } else if (other.equals(Long.MIN_VALUE)) { + return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Longs are small, use float multiplication + if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) { + return Long.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns this Long divided by the given one. + * + * @method + * @param {Long} other Long by which to divide. + * @return {Long} this Long divided by the given one. + */ +Long.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) { + return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Long.ZERO)) { + return other.isNegative() ? Long.ONE : Long.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Long.ZERO; + rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Long.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Long.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Long.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; +}; + +/** + * Returns this Long modulo the given one. + * + * @method + * @param {Long} other Long by which to mod. + * @return {Long} this Long modulo the given one. + */ +Long.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); +}; + +/** + * The bitwise-NOT of this value. + * + * @method + * @return {Long} the bitwise-NOT of this value. + */ +Long.prototype.not = function() { + return Long.fromBits(~this.low_, ~this.high_); +}; + +/** + * Returns the bitwise-AND of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to AND. + * @return {Long} the bitwise-AND of this and the other. + */ +Long.prototype.and = function(other) { + return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); +}; + +/** + * Returns the bitwise-OR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to OR. + * @return {Long} the bitwise-OR of this and the other. + */ +Long.prototype.or = function(other) { + return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); +}; + +/** + * Returns the bitwise-XOR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to XOR. + * @return {Long} the bitwise-XOR of this and the other. + */ +Long.prototype.xor = function(other) { + return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the left by the given amount. + */ +Long.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Long.fromBits(low << numBits, (high << numBits) | (low >>> (32 - numBits))); + } else { + return Long.fromBits(0, low << (numBits - 32)); + } + } +}; + +/** + * Returns this Long with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount. + */ +Long.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >> numBits); + } else { + return Long.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } +}; + +/** + * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ +Long.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits); + } else if (numBits === 32) { + return Long.fromBits(high, 0); + } else { + return Long.fromBits(high >>> (numBits - 32), 0); + } + } +}; + +/** + * Returns a Long representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Long} the corresponding Long value. + */ +Long.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Long.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Long(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Long.INT_CACHE_[value] = obj; + } + return obj; +}; + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Long} the corresponding Long value. + */ +Long.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Long.ZERO; + } else if (value <= -Long.TWO_PWR_63_DBL_) { + return Long.MIN_VALUE; + } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { + return Long.MAX_VALUE; + } else if (value < 0) { + return Long.fromNumber(-value).negate(); + } else { + return new Long((value % Long.TWO_PWR_32_DBL_) | 0, (value / Long.TWO_PWR_32_DBL_) | 0); + } +}; + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * @param {bigint} value - The number in question + * @returns {Long} The corresponding Long value + */ +Long.fromBigInt = function(value) { + return Long.fromString(value.toString(10), 10); +} + +/** + * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Long} the corresponding Long value. + */ +Long.fromBits = function(lowBits, highBits) { + return new Long(lowBits, highBits); +}; + +/** + * Returns a Long representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Long. + * @param {number} opt_radix the radix in which the text is written. + * @return {Long} the corresponding Long value. + */ +Long.fromString = function(str, opt_radix) { + if (str.length === 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) === '-') { + return Long.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 8)); + + var result = Long.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Long.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Long.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Long.fromNumber(value)); + } + } + return result; +}; + +// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the +// from* methods on which they depend. + +/** + * A cache of the Long representations of small integer values. + * @type {Object} + * @ignore + */ +Long.INT_CACHE_ = {}; + +// NOTE: the compiler should inline these constant values below and then remove +// these variables, so there should be no runtime penalty for these. + +/** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ +Long.TWO_PWR_16_DBL_ = 1 << 16; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_24_DBL_ = 1 << 24; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; + +/** @type {Long} */ +Long.ZERO = Long.fromInt(0); + +/** @type {Long} */ +Long.ONE = Long.fromInt(1); + +/** @type {Long} */ +Long.NEG_ONE = Long.fromInt(-1); + +/** @type {Long} */ +Long.MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0); + +/** @type {Long} */ +Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); + +/** + * @type {Long} + * @ignore + */ +Long.TWO_PWR_24_ = Long.fromInt(1 << 24); + +/** + * Expose. + */ +module.exports = Long; +module.exports.Long = Long; + + +/***/ }), + +/***/ 93639: +/***/ ((module) => { + +"use strict"; + + +// We have an ES6 Map available, return the native instance +if (typeof global.Map !== 'undefined') { + module.exports = global.Map; + module.exports.Map = global.Map; +} else { + // We will return a polyfill + var Map = function(array) { + this._keys = []; + this._values = {}; + + for (var i = 0; i < array.length; i++) { + if (array[i] == null) continue; // skip null and undefined + var entry = array[i]; + var key = entry[0]; + var value = entry[1]; + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + } + }; + + Map.prototype.clear = function() { + this._keys = []; + this._values = {}; + }; + + Map.prototype.delete = function(key) { + var value = this._values[key]; + if (value == null) return false; + // Delete entry + delete this._values[key]; + // Remove the key from the ordered keys list + this._keys.splice(value.i, 1); + return true; + }; + + Map.prototype.entries = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? [key, self._values[key].v] : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.forEach = function(callback, self) { + self = self || this; + + for (var i = 0; i < this._keys.length; i++) { + var key = this._keys[i]; + // Call the forEach callback + callback.call(self, this._values[key].v, key, self); + } + }; + + Map.prototype.get = function(key) { + return this._values[key] ? this._values[key].v : undefined; + }; + + Map.prototype.has = function(key) { + return this._values[key] != null; + }; + + Map.prototype.keys = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? key : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.set = function(key, value) { + if (this._values[key]) { + this._values[key].v = value; + return this; + } + + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + return this; + }; + + Map.prototype.values = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? self._values[key].v : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + // Last ismaster + Object.defineProperty(Map.prototype, 'size', { + enumerable: true, + get: function() { + return this._keys.length; + } + }); + + module.exports = Map; + module.exports.Map = Map; +} + + +/***/ }), + +/***/ 95846: +/***/ ((module) => { + +/** + * A class representation of the BSON MaxKey type. + * + * @class + * @return {MaxKey} A MaxKey instance + */ +function MaxKey() { + if (!(this instanceof MaxKey)) return new MaxKey(); + + this._bsontype = 'MaxKey'; +} + +module.exports = MaxKey; +module.exports.MaxKey = MaxKey; + + +/***/ }), + +/***/ 75325: +/***/ ((module) => { + +/** + * A class representation of the BSON MinKey type. + * + * @class + * @return {MinKey} A MinKey instance + */ +function MinKey() { + if (!(this instanceof MinKey)) return new MinKey(); + + this._bsontype = 'MinKey'; +} + +module.exports = MinKey; +module.exports.MinKey = MinKey; + + +/***/ }), + +/***/ 99502: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Custom inspect property name / symbol. +var inspect = 'inspect'; + +var utils = __nccwpck_require__(12863); + +/** + * Machine id. + * + * Create a random 3-byte value (i.e. unique for this + * process). Other drivers use a md5 of the machine id here, but + * that would mean an asyc call to gethostname, so we don't bother. + * @ignore + */ +var MACHINE_ID = parseInt(Math.random() * 0xffffff, 10); + +// Regular expression that checks for hex value +var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$'); + +// Check if buffer exists +try { + if (Buffer && Buffer.from) { + var hasBufferType = true; + inspect = __nccwpck_require__(31669).inspect.custom || 'inspect'; + } +} catch (err) { + hasBufferType = false; +} + +/** +* Create a new ObjectID instance +* +* @class +* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. +* @property {number} generationTime The generation time of this ObjectId instance +* @return {ObjectID} instance of ObjectID. +*/ +var ObjectID = function ObjectID(id) { + // Duck-typing to support ObjectId from different npm packages + if (id instanceof ObjectID) return id; + if (!(this instanceof ObjectID)) return new ObjectID(id); + + this._bsontype = 'ObjectID'; + + // The most common usecase (blank id, new objectId instance) + if (id == null || typeof id === 'number') { + // Generate a new id + this.id = this.generate(id); + // If we are caching the hex string + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); + // Return the object + return; + } + + // Check if the passed in id is valid + var valid = ObjectID.isValid(id); + + // Throw an error if it's not a valid setup + if (!valid && id != null) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } else if (valid && typeof id === 'string' && id.length === 24 && hasBufferType) { + return new ObjectID(utils.toBuffer(id, 'hex')); + } else if (valid && typeof id === 'string' && id.length === 24) { + return ObjectID.createFromHexString(id); + } else if (id != null && id.length === 12) { + // assume 12 byte string + this.id = id; + } else if (id != null && typeof id.toHexString === 'function') { + // Duck-typing to support ObjectId from different npm packages + return id; + } else { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); +}; + +// Allow usage of ObjectId as well as ObjectID +// var ObjectId = ObjectID; + +// Precomputed hex table enables speedy hex string conversion +var hexTable = []; +for (var i = 0; i < 256; i++) { + hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); +} + +/** +* Return the ObjectID id as a 24 byte hex string representation +* +* @method +* @return {string} return the 24 byte hex string representation. +*/ +ObjectID.prototype.toHexString = function() { + if (ObjectID.cacheHexString && this.__id) return this.__id; + + var hexString = ''; + if (!this.id || !this.id.length) { + throw new Error( + 'invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + + JSON.stringify(this.id) + + ']' + ); + } + + if (this.id instanceof _Buffer) { + hexString = convertToHex(this.id); + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; + } + + for (var i = 0; i < this.id.length; i++) { + hexString += hexTable[this.id.charCodeAt(i)]; + } + + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; +}; + +/** +* Update the ObjectID index used in generating new ObjectID's on the driver +* +* @method +* @return {number} returns next index value. +* @ignore +*/ +ObjectID.prototype.get_inc = function() { + return (ObjectID.index = (ObjectID.index + 1) % 0xffffff); +}; + +/** +* Update the ObjectID index used in generating new ObjectID's on the driver +* +* @method +* @return {number} returns next index value. +* @ignore +*/ +ObjectID.prototype.getInc = function() { + return this.get_inc(); +}; + +/** +* Generate a 12 byte id buffer used in ObjectID's +* +* @method +* @param {number} [time] optional parameter allowing to pass in a second based timestamp. +* @return {Buffer} return the 12 byte id buffer string. +*/ +ObjectID.prototype.generate = function(time) { + if ('number' !== typeof time) { + time = ~~(Date.now() / 1000); + } + + // Use pid + var pid = + (typeof process === 'undefined' || process.pid === 1 + ? Math.floor(Math.random() * 100000) + : process.pid) % 0xffff; + var inc = this.get_inc(); + // Buffer used + var buffer = utils.allocBuffer(12); + // Encode time + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Encode machine + buffer[6] = MACHINE_ID & 0xff; + buffer[5] = (MACHINE_ID >> 8) & 0xff; + buffer[4] = (MACHINE_ID >> 16) & 0xff; + // Encode pid + buffer[8] = pid & 0xff; + buffer[7] = (pid >> 8) & 0xff; + // Encode index + buffer[11] = inc & 0xff; + buffer[10] = (inc >> 8) & 0xff; + buffer[9] = (inc >> 16) & 0xff; + // Return the buffer + return buffer; +}; + +/** +* Converts the id into a 24 byte hex string for printing +* +* @param {String} format The Buffer toString format parameter. +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype.toString = function(format) { + // Is the id a buffer then use the buffer toString method to return the format + if (this.id && this.id.copy) { + return this.id.toString(typeof format === 'string' ? format : 'hex'); + } + + // if(this.buffer ) + return this.toHexString(); +}; + +/** +* Converts to a string representation of this Id. +* +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype[inspect] = ObjectID.prototype.toString; + +/** +* Converts to its JSON representation. +* +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype.toJSON = function() { + return this.toHexString(); +}; + +/** +* Compares the equality of this ObjectID with `otherID`. +* +* @method +* @param {object} otherID ObjectID instance to compare against. +* @return {boolean} the result of comparing two ObjectID's +*/ +ObjectID.prototype.equals = function equals(otherId) { + // var id; + + if (otherId instanceof ObjectID) { + return this.toString() === otherId.toString(); + } else if ( + typeof otherId === 'string' && + ObjectID.isValid(otherId) && + otherId.length === 12 && + this.id instanceof _Buffer + ) { + return otherId === this.id.toString('binary'); + } else if (typeof otherId === 'string' && ObjectID.isValid(otherId) && otherId.length === 24) { + return otherId.toLowerCase() === this.toHexString(); + } else if (typeof otherId === 'string' && ObjectID.isValid(otherId) && otherId.length === 12) { + return otherId === this.id; + } else if (otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) { + return otherId.toHexString() === this.toHexString(); + } else { + return false; + } +}; + +/** +* Returns the generation date (accurate up to the second) that this ID was generated. +* +* @method +* @return {date} the generation date +*/ +ObjectID.prototype.getTimestamp = function() { + var timestamp = new Date(); + var time = this.id[3] | (this.id[2] << 8) | (this.id[1] << 16) | (this.id[0] << 24); + timestamp.setTime(Math.floor(time) * 1000); + return timestamp; +}; + +/** +* @ignore +*/ +ObjectID.index = ~~(Math.random() * 0xffffff); + +/** +* @ignore +*/ +ObjectID.createPk = function createPk() { + return new ObjectID(); +}; + +/** +* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. +* +* @method +* @param {number} time an integer number representing a number of seconds. +* @return {ObjectID} return the created ObjectID +*/ +ObjectID.createFromTime = function createFromTime(time) { + var buffer = utils.toBuffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + // Encode time into first 4 bytes + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Return the new objectId + return new ObjectID(buffer); +}; + +// Lookup tables +//var encodeLookup = '0123456789abcdef'.split(''); +var decodeLookup = []; +i = 0; +while (i < 10) decodeLookup[0x30 + i] = i++; +while (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++; + +var _Buffer = Buffer; +var convertToHex = function(bytes) { + return bytes.toString('hex'); +}; + +/** +* Creates an ObjectID from a hex string representation of an ObjectID. +* +* @method +* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. +* @return {ObjectID} return the created ObjectID +*/ +ObjectID.createFromHexString = function createFromHexString(string) { + // Throw an error if it's not a valid setup + if (typeof string === 'undefined' || (string != null && string.length !== 24)) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + // Use Buffer.from method if available + if (hasBufferType) return new ObjectID(utils.toBuffer(string, 'hex')); + + // Calculate lengths + var array = new _Buffer(12); + var n = 0; + var i = 0; + + while (i < 24) { + array[n++] = (decodeLookup[string.charCodeAt(i++)] << 4) | decodeLookup[string.charCodeAt(i++)]; + } + + return new ObjectID(array); +}; + +/** +* Checks if a value is a valid bson ObjectId +* +* @method +* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. +*/ +ObjectID.isValid = function isValid(id) { + if (id == null) return false; + + if (typeof id === 'number') { + return true; + } + + if (typeof id === 'string') { + return id.length === 12 || (id.length === 24 && checkForHexRegExp.test(id)); + } + + if (id instanceof ObjectID) { + return true; + } + + if (id instanceof _Buffer) { + return true; + } + + // Duck-Typing detection of ObjectId like objects + if ( + typeof id.toHexString === 'function' && + (id.id instanceof _Buffer || typeof id.id === 'string') + ) { + return id.id.length === 12 || (id.id.length === 24 && checkForHexRegExp.test(id.id)); + } + + return false; +}; + +/** +* @ignore +*/ +Object.defineProperty(ObjectID.prototype, 'generationTime', { + enumerable: true, + get: function() { + return this.id[3] | (this.id[2] << 8) | (this.id[1] << 16) | (this.id[0] << 24); + }, + set: function(value) { + // Encode time into first 4 bytes + this.id[3] = value & 0xff; + this.id[2] = (value >> 8) & 0xff; + this.id[1] = (value >> 16) & 0xff; + this.id[0] = (value >> 24) & 0xff; + } +}); + +/** + * Expose. + */ +module.exports = ObjectID; +module.exports.ObjectID = ObjectID; +module.exports.ObjectId = ObjectID; + + +/***/ }), + +/***/ 61273: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Long = __nccwpck_require__(98522).Long, + Double = __nccwpck_require__(90972).Double, + Timestamp = __nccwpck_require__(61031).Timestamp, + ObjectID = __nccwpck_require__(99502).ObjectID, + Symbol = __nccwpck_require__(72259).Symbol, + BSONRegExp = __nccwpck_require__(74636).BSONRegExp, + Code = __nccwpck_require__(27113).Code, + Decimal128 = __nccwpck_require__(20414), + MinKey = __nccwpck_require__(75325).MinKey, + MaxKey = __nccwpck_require__(95846).MaxKey, + DBRef = __nccwpck_require__(33797).DBRef, + Binary = __nccwpck_require__(55497).Binary; + +var normalizedFunctionString = __nccwpck_require__(12863).normalizedFunctionString; + +// To ensure that 0.4 of node works correctly +var isDate = function isDate(d) { + return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; +}; + +var calculateObjectSize = function calculateObjectSize( + object, + serializeFunctions, + ignoreUndefined +) { + var totalLength = 4 + 1; + + if (Array.isArray(object)) { + for (var i = 0; i < object.length; i++) { + totalLength += calculateElement( + i.toString(), + object[i], + serializeFunctions, + true, + ignoreUndefined + ); + } + } else { + // If we have toBSON defined, override the current object + if (object.toBSON) { + object = object.toBSON(); + } + + // Calculate size + for (var key in object) { + totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined); + } + } + + return totalLength; +}; + +/** + * @ignore + * @api private + */ +function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) { + // If we have toBSON defined, override the current object + if (value && value.toBSON) { + value = value.toBSON(); + } + + switch (typeof value) { + case 'string': + return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; + case 'number': + if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { + // 32 bit + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (4 + 1); + } else { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } + } else { + // 64 bit + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } + case 'undefined': + if (isArray || !ignoreUndefined) + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; + return 0; + case 'boolean': + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 1); + case 'object': + if ( + value == null || + value instanceof MinKey || + value instanceof MaxKey || + value['_bsontype'] === 'MinKey' || + value['_bsontype'] === 'MaxKey' + ) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; + } else if (value instanceof ObjectID || value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1); + } else if (value instanceof Date || isDate(value)) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 4 + 1) + value.length + ); + } else if ( + value instanceof Long || + value instanceof Double || + value instanceof Timestamp || + value['_bsontype'] === 'Long' || + value['_bsontype'] === 'Double' || + value['_bsontype'] === 'Timestamp' + ) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } else if (value instanceof Decimal128 || value['_bsontype'] === 'Decimal128') { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (16 + 1); + } else if (value instanceof Code || value['_bsontype'] === 'Code') { + // Calculate size depending on the availability of a scope + if (value.scope != null && Object.keys(value.scope).length > 0) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined) + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + ); + } + } else if (value instanceof Binary || value['_bsontype'] === 'Binary') { + // Check what kind of subtype we have + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (value.position + 1 + 4 + 1 + 4) + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1) + ); + } + } else if (value instanceof Symbol || value['_bsontype'] === 'Symbol') { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + Buffer.byteLength(value.value, 'utf8') + + 4 + + 1 + + 1 + ); + } else if (value instanceof DBRef || value['_bsontype'] === 'DBRef') { + // Set up correct object for serialization + var ordered_values = { + $ref: value.namespace, + $id: value.oid + }; + + // Add db reference if it exists + if (null != value.db) { + ordered_values['$db'] = value.db; + } + + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined) + ); + } else if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else if (value instanceof BSONRegExp || value['_bsontype'] === 'BSONRegExp') { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.pattern, 'utf8') + + 1 + + Buffer.byteLength(value.options, 'utf8') + + 1 + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + + 1 + ); + } + case 'function': + // WTF for 0.4.X where typeof /someregexp/ === 'function' + if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' || + String.call(value) === '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else { + if (serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(normalizedFunctionString(value), 'utf8') + + 1 + + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined) + ); + } else if (serializeFunctions) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + Buffer.byteLength(normalizedFunctionString(value), 'utf8') + + 1 + ); + } + } + } + + return 0; +} + +var BSON = {}; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = calculateObjectSize; + + +/***/ }), + +/***/ 62139: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Long = __nccwpck_require__(98522).Long, + Double = __nccwpck_require__(90972).Double, + Timestamp = __nccwpck_require__(61031).Timestamp, + ObjectID = __nccwpck_require__(99502).ObjectID, + Symbol = __nccwpck_require__(72259).Symbol, + Code = __nccwpck_require__(27113).Code, + MinKey = __nccwpck_require__(75325).MinKey, + MaxKey = __nccwpck_require__(95846).MaxKey, + Decimal128 = __nccwpck_require__(20414), + Int32 = __nccwpck_require__(46142), + DBRef = __nccwpck_require__(33797).DBRef, + BSONRegExp = __nccwpck_require__(74636).BSONRegExp, + Binary = __nccwpck_require__(55497).Binary; + +var utils = __nccwpck_require__(12863); + +var deserialize = function(buffer, options, isArray) { + options = options == null ? {} : options; + var index = options && options.index ? options.index : 0; + // Read the document size + var size = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + + // Ensure buffer is valid size + if (size < 5 || buffer.length < size || size + index > buffer.length) { + throw new Error('corrupt bson message'); + } + + // Illegal end value + if (buffer[index + size - 1] !== 0) { + throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"); + } + + // Start deserializtion + return deserializeObject(buffer, index, options, isArray); +}; + +var deserializeObject = function(buffer, index, options, isArray) { + var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; + var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; + var cacheFunctionsCrc32 = + options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; + + if (!cacheFunctionsCrc32) var crc32 = null; + + var fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw']; + + // Return raw bson buffer instead of parsing it + var raw = options['raw'] == null ? false : options['raw']; + + // Return BSONRegExp objects instead of native regular expressions + var bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false; + + // Controls the promotion of values vs wrapper classes + var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers']; + var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; + var promoteValues = options['promoteValues'] == null ? true : options['promoteValues']; + + // Set the start index + var startIndex = index; + + // Validate that we have at least 4 bytes of buffer + if (buffer.length < 5) throw new Error('corrupt bson message < 5 bytes long'); + + // Read the document size + var size = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Ensure buffer is valid size + if (size < 5 || size > buffer.length) throw new Error('corrupt bson message'); + + // Create holding object + var object = isArray ? [] : {}; + // Used for arrays to skip having to perform utf8 decoding + var arrayIndex = 0; + + var done = false; + + // While we have more left data left keep parsing + // while (buffer[index + 1] !== 0) { + while (!done) { + // Read the type + var elementType = buffer[index++]; + // If we get a zero it's the last byte, exit + if (elementType === 0) break; + + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i); + + index = i + 1; + + if (elementType === BSON.BSON_DATA_STRING) { + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + object[name] = buffer.toString('utf8', index, index + stringSize - 1); + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_OID) { + var oid = utils.allocBuffer(12); + buffer.copy(oid, 0, index, index + 12); + object[name] = new ObjectID(oid); + index = index + 12; + } else if (elementType === BSON.BSON_DATA_INT && promoteValues === false) { + object[name] = new Int32( + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24) + ); + } else if (elementType === BSON.BSON_DATA_INT) { + object[name] = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + } else if (elementType === BSON.BSON_DATA_NUMBER && promoteValues === false) { + object[name] = new Double(buffer.readDoubleLE(index)); + index = index + 8; + } else if (elementType === BSON.BSON_DATA_NUMBER) { + object[name] = buffer.readDoubleLE(index); + index = index + 8; + } else if (elementType === BSON.BSON_DATA_DATE) { + var lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Date(new Long(lowBits, highBits).toNumber()); + } else if (elementType === BSON.BSON_DATA_BOOLEAN) { + if (buffer[index] !== 0 && buffer[index] !== 1) throw new Error('illegal boolean type value'); + object[name] = buffer[index++] === 1; + } else if (elementType === BSON.BSON_DATA_OBJECT) { + var _index = index; + var objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + if (objectSize <= 0 || objectSize > buffer.length - index) + throw new Error('bad embedded document length in bson'); + + // We have a raw value + if (raw) { + object[name] = buffer.slice(index, index + objectSize); + } else { + object[name] = deserializeObject(buffer, _index, options, false); + } + + index = index + objectSize; + } else if (elementType === BSON.BSON_DATA_ARRAY) { + _index = index; + objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + var arrayOptions = options; + + // Stop index + var stopIndex = index + objectSize; + + // All elements of array to be returned as raw bson + if (fieldsAsRaw && fieldsAsRaw[name]) { + arrayOptions = {}; + for (var n in options) arrayOptions[n] = options[n]; + arrayOptions['raw'] = true; + } + + object[name] = deserializeObject(buffer, _index, arrayOptions, true); + index = index + objectSize; + + if (buffer[index - 1] !== 0) throw new Error('invalid array terminator byte'); + if (index !== stopIndex) throw new Error('corrupted array bson'); + } else if (elementType === BSON.BSON_DATA_UNDEFINED) { + object[name] = undefined; + } else if (elementType === BSON.BSON_DATA_NULL) { + object[name] = null; + } else if (elementType === BSON.BSON_DATA_LONG) { + // Unpack the low and high bits + lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var long = new Long(lowBits, highBits); + // Promote the long if possible + if (promoteLongs && promoteValues === true) { + object[name] = + long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) + ? long.toNumber() + : long; + } else { + object[name] = long; + } + } else if (elementType === BSON.BSON_DATA_DECIMAL128) { + // Buffer to contain the decimal bytes + var bytes = utils.allocBuffer(16); + // Copy the next 16 bytes into the bytes buffer + buffer.copy(bytes, 0, index, index + 16); + // Update index + index = index + 16; + // Assign the new Decimal128 value + var decimal128 = new Decimal128(bytes); + // If we have an alternative mapper use that + object[name] = decimal128.toObject ? decimal128.toObject() : decimal128; + } else if (elementType === BSON.BSON_DATA_BINARY) { + var binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var totalBinarySize = binarySize; + var subType = buffer[index++]; + + // Did we have a negative binary size, throw + if (binarySize < 0) throw new Error('Negative binary type element size found'); + + // Is the length longer than the document + if (binarySize > buffer.length) throw new Error('Binary type size larger than document size'); + + // Decode as raw Buffer object if options specifies it + if (buffer['slice'] != null) { + // If we have subtype 2 skip the 4 bytes for the size + if (subType === Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error('Negative binary type element size found for subtype 0x02'); + if (binarySize > totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to long binary size'); + if (binarySize < totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to short binary size'); + } + + if (promoteBuffers && promoteValues) { + object[name] = buffer.slice(index, index + binarySize); + } else { + object[name] = new Binary(buffer.slice(index, index + binarySize), subType); + } + } else { + var _buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(binarySize)) + : new Array(binarySize); + // If we have subtype 2 skip the 4 bytes for the size + if (subType === Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error('Negative binary type element size found for subtype 0x02'); + if (binarySize > totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to long binary size'); + if (binarySize < totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to short binary size'); + } + + // Copy the data + for (i = 0; i < binarySize; i++) { + _buffer[i] = buffer[index + i]; + } + + if (promoteBuffers && promoteValues) { + object[name] = _buffer; + } else { + object[name] = new Binary(_buffer, subType); + } + } + + // Update the index + index = index + binarySize; + } else if (elementType === BSON.BSON_DATA_REGEXP && bsonRegExp === false) { + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var source = buffer.toString('utf8', index, i); + // Create the regexp + index = i + 1; + + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // For each option add the corresponding one for javascript + var optionsArray = new Array(regExpOptions.length); + + // Parse options + for (i = 0; i < regExpOptions.length; i++) { + switch (regExpOptions[i]) { + case 'm': + optionsArray[i] = 'm'; + break; + case 's': + optionsArray[i] = 'g'; + break; + case 'i': + optionsArray[i] = 'i'; + break; + } + } + + object[name] = new RegExp(source, optionsArray.join('')); + } else if (elementType === BSON.BSON_DATA_REGEXP && bsonRegExp === true) { + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + source = buffer.toString('utf8', index, i); + index = i + 1; + + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // Set the object + object[name] = new BSONRegExp(source, regExpOptions); + } else if (elementType === BSON.BSON_DATA_SYMBOL) { + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_TIMESTAMP) { + lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Timestamp(lowBits, highBits); + } else if (elementType === BSON.BSON_DATA_MIN_KEY) { + object[name] = new MinKey(); + } else if (elementType === BSON.BSON_DATA_MAX_KEY) { + object[name] = new MaxKey(); + } else if (elementType === BSON.BSON_DATA_CODE) { + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + var functionString = buffer.toString('utf8', index, index + stringSize - 1); + + // If we are evaluating the functions + if (evalFunctions) { + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); + } else { + object[name] = isolateEval(functionString); + } + } else { + object[name] = new Code(functionString); + } + + // Update parse index position + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_CODE_W_SCOPE) { + var totalSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Element cannot be shorter than totalSize + stringSize + documentSize + terminator + if (totalSize < 4 + 4 + 4 + 1) { + throw new Error('code_w_scope total size shorter minimum expected length'); + } + + // Get the code string size + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + + // Javascript function + functionString = buffer.toString('utf8', index, index + stringSize - 1); + // Update parse index position + index = index + stringSize; + // Parse the element + _index = index; + // Decode the size of the object document + objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + // Decode the scope object + var scopeObject = deserializeObject(buffer, _index, options, false); + // Adjust the index + index = index + objectSize; + + // Check if field length is to short + if (totalSize < 4 + 4 + objectSize + stringSize) { + throw new Error('code_w_scope total size is to short, truncating scope'); + } + + // Check if totalSize field is to long + if (totalSize > 4 + 4 + objectSize + stringSize) { + throw new Error('code_w_scope total size is to long, clips outer document'); + } + + // If we are evaluating the functions + if (evalFunctions) { + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); + } else { + object[name] = isolateEval(functionString); + } + + object[name].scope = scopeObject; + } else { + object[name] = new Code(functionString, scopeObject); + } + } else if (elementType === BSON.BSON_DATA_DBPOINTER) { + // Get the code string size + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + // Namespace + var namespace = buffer.toString('utf8', index, index + stringSize - 1); + // Update parse index position + index = index + stringSize; + + // Read the oid + var oidBuffer = utils.allocBuffer(12); + buffer.copy(oidBuffer, 0, index, index + 12); + oid = new ObjectID(oidBuffer); + + // Update the index + index = index + 12; + + // Split the namespace + var parts = namespace.split('.'); + var db = parts.shift(); + var collection = parts.join('.'); + // Upgrade to DBRef type + object[name] = new DBRef(collection, oid, db); + } else { + throw new Error( + 'Detected unknown BSON type ' + + elementType.toString(16) + + ' for fieldname "' + + name + + '", are you using the latest BSON parser' + ); + } + } + + // Check if the deserialization was against a valid array/object + if (size !== index - startIndex) { + if (isArray) throw new Error('corrupt array bson'); + throw new Error('corrupt object bson'); + } + + // Check if we have a db ref object + if (object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); + return object; +}; + +/** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ +var isolateEvalWithHash = function(functionCache, hash, functionString, object) { + // Contains the value we are going to set + var value = null; + + // Check for cache hit, eval if missing and return cached function + if (functionCache[hash] == null) { + eval('value = ' + functionString); + functionCache[hash] = value; + } + // Set the object + return functionCache[hash].bind(object); +}; + +/** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ +var isolateEval = function(functionString) { + // Contains the value we are going to set + var value = null; + // Eval the function + eval('value = ' + functionString); + return value; +}; + +var BSON = {}; + +/** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ +var functionCache = (BSON.functionCache = {}); + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_UNDEFINED + **/ +BSON.BSON_DATA_UNDEFINED = 6; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_DBPOINTER + **/ +BSON.BSON_DATA_DBPOINTER = 12; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ +BSON.BSON_DATA_DECIMAL128 = 19; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; + +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = deserialize; + + +/***/ }), + +/***/ 99290: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var writeIEEE754 = __nccwpck_require__(57281)/* .writeIEEE754 */ .P, + Long = __nccwpck_require__(98522).Long, + Map = __nccwpck_require__(93639), + Binary = __nccwpck_require__(55497).Binary; + +var normalizedFunctionString = __nccwpck_require__(12863).normalizedFunctionString; + +// try { +// var _Buffer = Uint8Array; +// } catch (e) { +// _Buffer = Buffer; +// } + +var regexp = /\x00/; // eslint-disable-line no-control-regex +var ignoreKeys = ['$db', '$ref', '$id', '$clusterTime']; + +// To ensure that 0.4 of node works correctly +var isDate = function isDate(d) { + return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; +}; + +var isRegExp = function isRegExp(d) { + return Object.prototype.toString.call(d) === '[object RegExp]'; +}; + +var serializeString = function(buffer, key, value, index, isArray) { + // Encode String type + buffer[index++] = BSON.BSON_DATA_STRING; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes + 1; + buffer[index - 1] = 0; + // Write the string + var size = buffer.write(value, index + 4, 'utf8'); + // Write the size of the string to buffer + buffer[index + 3] = ((size + 1) >> 24) & 0xff; + buffer[index + 2] = ((size + 1) >> 16) & 0xff; + buffer[index + 1] = ((size + 1) >> 8) & 0xff; + buffer[index] = (size + 1) & 0xff; + // Update index + index = index + 4 + size; + // Write zero + buffer[index++] = 0; + return index; +}; + +var serializeNumber = function(buffer, key, value, index, isArray) { + // We have an integer value + if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + // If the value fits in 32 bits encode as int, if it fits in a double + // encode it as a double, otherwise long + if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } else { + // Set long type + buffer[index++] = BSON.BSON_DATA_LONG; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var longVal = Long.fromNumber(value); + var lowBits = longVal.getLowBits(); + var highBits = longVal.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + } + } else { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } + + return index; +}; + +var serializeNull = function(buffer, key, value, index, isArray) { + // Set long type + buffer[index++] = BSON.BSON_DATA_NULL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; +}; + +var serializeBoolean = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BOOLEAN; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Encode the boolean value + buffer[index++] = value ? 1 : 0; + return index; +}; + +var serializeDate = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_DATE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the date + var dateInMilis = Long.fromNumber(value.getTime()); + var lowBits = dateInMilis.getLowBits(); + var highBits = dateInMilis.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; +}; + +var serializeRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + if (value.source && value.source.match(regexp) != null) { + throw Error('value ' + value.source + ' must not contain null bytes'); + } + // Adjust the index + index = index + buffer.write(value.source, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the parameters + if (value.global) buffer[index++] = 0x73; // s + if (value.ignoreCase) buffer[index++] = 0x69; // i + if (value.multiline) buffer[index++] = 0x6d; // m + // Add ending zero + buffer[index++] = 0x00; + return index; +}; + +var serializeBSONRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Check the pattern for 0 bytes + if (value.pattern.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('pattern ' + value.pattern + ' must not contain null bytes'); + } + + // Adjust the index + index = index + buffer.write(value.pattern, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the options + index = + index + + buffer.write( + value.options + .split('') + .sort() + .join(''), + index, + 'utf8' + ); + // Add ending zero + buffer[index++] = 0x00; + return index; +}; + +var serializeMinMax = function(buffer, key, value, index, isArray) { + // Write the type of either min or max key + if (value === null) { + buffer[index++] = BSON.BSON_DATA_NULL; + } else if (value._bsontype === 'MinKey') { + buffer[index++] = BSON.BSON_DATA_MIN_KEY; + } else { + buffer[index++] = BSON.BSON_DATA_MAX_KEY; + } + + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; +}; + +var serializeObjectId = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OID; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the objectId into the shared buffer + if (typeof value.id === 'string') { + buffer.write(value.id, index, 'binary'); + } else if (value.id && value.id.copy) { + value.id.copy(buffer, index, 0, 12); + } else { + throw new Error('object [' + JSON.stringify(value) + '] is not a valid ObjectId'); + } + + // Ajust index + return index + 12; +}; + +var serializeBuffer = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Get size of the buffer (current write point) + var size = value.length; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the default subtype + buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; + // Copy the content form the binary field to the buffer + value.copy(buffer, index, 0, size); + // Adjust the index + index = index + size; + return index; +}; + +var serializeObject = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray, + path +) { + for (var i = 0; i < path.length; i++) { + if (path[i] === value) throw new Error('cyclic dependency detected'); + } + + // Push value to stack + path.push(value); + // Write the type + buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var endIndex = serializeInto( + buffer, + value, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined, + path + ); + // Pop stack + path.pop(); + // Write size + return endIndex; +}; + +var serializeDecimal128 = function(buffer, key, value, index, isArray) { + buffer[index++] = BSON.BSON_DATA_DECIMAL128; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the data from the value + value.bytes.copy(buffer, index, 0, 16); + return index + 16; +}; + +var serializeLong = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = value._bsontype === 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the date + var lowBits = value.getLowBits(); + var highBits = value.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; +}; + +var serializeInt32 = function(buffer, key, value, index, isArray) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + return index; +}; + +var serializeDouble = function(buffer, key, value, index, isArray) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + return index; +}; + +var serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + var functionString = normalizedFunctionString(value); + + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + return index; +}; + +var serializeCode = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray +) { + if (value.scope && typeof value.scope === 'object') { + // Write the type + buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Starting index + var startIndex = index; + + // Serialize the function + // Get the function string + var functionString = typeof value.code === 'string' ? value.code : value.code.toString(); + // Index adjustment + index = index + 4; + // Write string into buffer + var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = codeSize & 0xff; + buffer[index + 1] = (codeSize >> 8) & 0xff; + buffer[index + 2] = (codeSize >> 16) & 0xff; + buffer[index + 3] = (codeSize >> 24) & 0xff; + // Write end 0 + buffer[index + 4 + codeSize - 1] = 0; + // Write the + index = index + codeSize + 4; + + // + // Serialize the scope value + var endIndex = serializeInto( + buffer, + value.scope, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined + ); + index = endIndex - 1; + + // Writ the total + var totalSize = endIndex - startIndex; + + // Write the total size of the object + buffer[startIndex++] = totalSize & 0xff; + buffer[startIndex++] = (totalSize >> 8) & 0xff; + buffer[startIndex++] = (totalSize >> 16) & 0xff; + buffer[startIndex++] = (totalSize >> 24) & 0xff; + // Write trailing zero + buffer[index++] = 0; + } else { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + functionString = value.code.toString(); + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + } + + return index; +}; + +var serializeBinary = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Extract the buffer + var data = value.value(true); + // Calculate size + var size = value.position; + // Add the deprecated 02 type 4 bytes of size to total + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) size = size + 4; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the subtype to the buffer + buffer[index++] = value.sub_type; + + // If we have binary type 2 the 4 first bytes are the size + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { + size = size - 4; + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + } + + // Write the data to the object + data.copy(buffer, index, 0, value.position); + // Adjust the index + index = index + value.position; + return index; +}; + +var serializeSymbol = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_SYMBOL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the string + var size = buffer.write(value.value, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0x00; + return index; +}; + +var serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + var startIndex = index; + var endIndex; + + // Serialize object + if (null != value.db) { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid, + $db: value.db + }, + false, + index, + depth + 1, + serializeFunctions + ); + } else { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid + }, + false, + index, + depth + 1, + serializeFunctions + ); + } + + // Calculate object size + var size = endIndex - startIndex; + // Write the size + buffer[startIndex++] = size & 0xff; + buffer[startIndex++] = (size >> 8) & 0xff; + buffer[startIndex++] = (size >> 16) & 0xff; + buffer[startIndex++] = (size >> 24) & 0xff; + // Set index + return endIndex; +}; + +var serializeInto = function serializeInto( + buffer, + object, + checkKeys, + startingIndex, + depth, + serializeFunctions, + ignoreUndefined, + path +) { + startingIndex = startingIndex || 0; + path = path || []; + + // Push the object to the path + path.push(object); + + // Start place to serialize into + var index = startingIndex + 4; + // var self = this; + + // Special case isArray + if (Array.isArray(object)) { + // Get object keys + for (var i = 0; i < object.length; i++) { + var key = '' + i; + var value = object[i]; + + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON !== 'function') throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + var type = typeof value; + if (type === 'string') { + index = serializeString(buffer, key, value, index, true); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index, true); + } else if(type === 'bigint') { + throw new TypeError('Unsupported type BigInt, please use Decimal128'); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index, true); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index, true); + } else if (value === undefined) { + index = serializeNull(buffer, key, value, index, true); + } else if (value === null) { + index = serializeNull(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') { + index = serializeObjectId(buffer, key, value, index, true); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index, true); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index, true); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index, true); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + true + ); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true + ); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index, true); + } else if (typeof value['_bsontype'] !== 'undefined') { + throw new TypeError('Unrecognized or invalid _bsontype: ' + value['_bsontype']); + } + } + } else if (object instanceof Map) { + var iterator = object.entries(); + var done = false; + + while (!done) { + // Unpack the next entry + var entry = iterator.next(); + done = entry.done; + // Are we done, then skip and terminate + if (done) continue; + + // Get the entry values + key = entry.value[0]; + value = entry.value[1]; + + // Check the type of the value + type = typeof value; + + // Check the key and throw error if it's illegal + if (typeof key === 'string' && ignoreKeys.indexOf(key) === -1) { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' === key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type === 'string') { + index = serializeString(buffer, key, value, index); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index); + } else if(type === 'bigint') { + throw new TypeError('Unsupported type BigInt, please use Decimal128'); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + // } else if (value === undefined && ignoreUndefined === true) { + } else if (value === null || (value === undefined && ignoreUndefined === false)) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index); + } else if (typeof value['_bsontype'] !== 'undefined') { + throw new TypeError('Unrecognized or invalid _bsontype: ' + value['_bsontype']); + } + } + } else { + // Did we provide a custom serialization method + if (object.toBSON) { + if (typeof object.toBSON !== 'function') throw new Error('toBSON is not a function'); + object = object.toBSON(); + if (object != null && typeof object !== 'object') + throw new Error('toBSON function did not return an object'); + } + + // Iterate over all the keys + for (key in object) { + value = object[key]; + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON !== 'function') throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + // Check the type of the value + type = typeof value; + + // Check the key and throw error if it's illegal + if (typeof key === 'string' && ignoreKeys.indexOf(key) === -1) { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' === key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type === 'string') { + index = serializeString(buffer, key, value, index); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index); + } else if(type === 'bigint') { + throw new TypeError('Unsupported type BigInt, please use Decimal128'); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + } else if (value === undefined) { + if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index); + } else if (value === null) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index); + } else if (typeof value['_bsontype'] !== 'undefined') { + throw new TypeError('Unrecognized or invalid _bsontype: ' + value['_bsontype']); + } + } + } + + // Remove the path + path.pop(); + + // Final padding byte for object + buffer[index++] = 0x00; + + // Final size + var size = index - startingIndex; + // Write the size of the object + buffer[startingIndex++] = size & 0xff; + buffer[startingIndex++] = (size >> 8) & 0xff; + buffer[startingIndex++] = (size >> 16) & 0xff; + buffer[startingIndex++] = (size >> 24) & 0xff; + return index; +}; + +var BSON = {}; + +/** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ +// var functionCache = (BSON.functionCache = {}); + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * ObjectID BSON Type, deprecated + * + * @classconstant BSON_DATA_UNDEFINED + **/ +BSON.BSON_DATA_UNDEFINED = 6; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ +BSON.BSON_DATA_DECIMAL128 = 19; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +// var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +// var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = serializeInto; + + +/***/ }), + +/***/ 12863: +/***/ ((module) => { + +"use strict"; + + +/** + * Normalizes our expected stringified form of a function across versions of node + * @param {Function} fn The function to stringify + */ +function normalizedFunctionString(fn) { + return fn.toString().replace(/function *\(/, 'function ('); +} + +function newBuffer(item, encoding) { + return new Buffer(item, encoding); +} + +function allocBuffer() { + return Buffer.alloc.apply(Buffer, arguments); +} + +function toBuffer() { + return Buffer.from.apply(Buffer, arguments); +} + +module.exports = { + normalizedFunctionString: normalizedFunctionString, + allocBuffer: typeof Buffer.alloc === 'function' ? allocBuffer : newBuffer, + toBuffer: typeof Buffer.from === 'function' ? toBuffer : newBuffer +}; + + + +/***/ }), + +/***/ 74636: +/***/ ((module) => { + +/** + * A class representation of the BSON RegExp type. + * + * @class + * @return {BSONRegExp} A MinKey instance + */ +function BSONRegExp(pattern, options) { + if (!(this instanceof BSONRegExp)) return new BSONRegExp(); + + // Execute + this._bsontype = 'BSONRegExp'; + this.pattern = pattern || ''; + this.options = options || ''; + + // Validate options + for (var i = 0; i < this.options.length; i++) { + if ( + !( + this.options[i] === 'i' || + this.options[i] === 'm' || + this.options[i] === 'x' || + this.options[i] === 'l' || + this.options[i] === 's' || + this.options[i] === 'u' + ) + ) { + throw new Error('the regular expression options [' + this.options[i] + '] is not supported'); + } + } +} + +module.exports = BSONRegExp; +module.exports.BSONRegExp = BSONRegExp; + + +/***/ }), + +/***/ 72259: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Custom inspect property name / symbol. +var inspect = Buffer ? __nccwpck_require__(31669).inspect.custom || 'inspect' : 'inspect'; + +/** + * A class representation of the BSON Symbol type. + * + * @class + * @deprecated + * @param {string} value the string representing the symbol. + * @return {Symbol} + */ +function Symbol(value) { + if (!(this instanceof Symbol)) return new Symbol(value); + this._bsontype = 'Symbol'; + this.value = value; +} + +/** + * Access the wrapped string value. + * + * @method + * @return {String} returns the wrapped string. + */ +Symbol.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype.toString = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype[inspect] = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Symbol; +module.exports.Symbol = Symbol; + + +/***/ }), + +/***/ 61031: +/***/ ((module) => { + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright 2009 Google Inc. All Rights Reserved + +/** + * This type is for INTERNAL use in MongoDB only and should not be used in applications. + * The appropriate corresponding type is the JavaScript Date type. + * + * Defines a Timestamp class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Timestamp". This + * implementation is derived from TimestampLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Timestamps. + * + * The internal representation of a Timestamp is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Timestamp. + * @param {number} high the high (signed) 32 bits of the Timestamp. + */ +function Timestamp(low, high) { + if (!(this instanceof Timestamp)) return new Timestamp(low, high); + this._bsontype = 'Timestamp'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. +} + +/** + * Return the int value. + * + * @return {number} the value, assuming it is a 32-bit integer. + */ +Timestamp.prototype.toInt = function() { + return this.low_; +}; + +/** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ +Timestamp.prototype.toNumber = function() { + return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); +}; + +/** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ +Timestamp.prototype.toJSON = function() { + return this.toString(); +}; + +/** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ +Timestamp.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + // We need to change the Timestamp value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixTimestamp = Timestamp.fromNumber(radix); + var div = this.div(radixTimestamp); + var rem = div.multiply(radixTimestamp).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); + + rem = this; + var result = ''; + + while (!rem.isZero()) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } +}; + +/** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ +Timestamp.prototype.getHighBits = function() { + return this.high_; +}; + +/** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ +Timestamp.prototype.getLowBits = function() { + return this.low_; +}; + +/** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ +Timestamp.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; +}; + +/** + * Returns the number of bits needed to represent the absolute value of this Timestamp. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. + */ +Timestamp.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ !== 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) !== 0) { + break; + } + } + return this.high_ !== 0 ? bit + 33 : bit + 1; + } +}; + +/** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ +Timestamp.prototype.isZero = function() { + return this.high_ === 0 && this.low_ === 0; +}; + +/** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ +Timestamp.prototype.isNegative = function() { + return this.high_ < 0; +}; + +/** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ +Timestamp.prototype.isOdd = function() { + return (this.low_ & 1) === 1; +}; + +/** + * Return whether this Timestamp equals the other + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp equals the other + */ +Timestamp.prototype.equals = function(other) { + return this.high_ === other.high_ && this.low_ === other.low_; +}; + +/** + * Return whether this Timestamp does not equal the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp does not equal the other. + */ +Timestamp.prototype.notEquals = function(other) { + return this.high_ !== other.high_ || this.low_ !== other.low_; +}; + +/** + * Return whether this Timestamp is less than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than the other. + */ +Timestamp.prototype.lessThan = function(other) { + return this.compare(other) < 0; +}; + +/** + * Return whether this Timestamp is less than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than or equal to the other. + */ +Timestamp.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; +}; + +/** + * Return whether this Timestamp is greater than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than the other. + */ +Timestamp.prototype.greaterThan = function(other) { + return this.compare(other) > 0; +}; + +/** + * Return whether this Timestamp is greater than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than or equal to the other. + */ +Timestamp.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; +}; + +/** + * Compares this Timestamp with the given one. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ +Timestamp.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } +}; + +/** + * The negation of this value. + * + * @method + * @return {Timestamp} the negation of this value. + */ +Timestamp.prototype.negate = function() { + if (this.equals(Timestamp.MIN_VALUE)) { + return Timestamp.MIN_VALUE; + } else { + return this.not().add(Timestamp.ONE); + } +}; + +/** + * Returns the sum of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to add to this one. + * @return {Timestamp} the sum of this and the given Timestamp. + */ +Timestamp.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns the difference of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to subtract from this. + * @return {Timestamp} the difference of this and the given Timestamp. + */ +Timestamp.prototype.subtract = function(other) { + return this.add(other.negate()); +}; + +/** + * Returns the product of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to multiply with this. + * @return {Timestamp} the product of this and the other. + */ +Timestamp.prototype.multiply = function(other) { + if (this.isZero()) { + return Timestamp.ZERO; + } else if (other.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } else if (other.equals(Timestamp.MIN_VALUE)) { + return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Timestamps are small, use float multiplication + if (this.lessThan(Timestamp.TWO_PWR_24_) && other.lessThan(Timestamp.TWO_PWR_24_)) { + return Timestamp.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns this Timestamp divided by the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to divide. + * @return {Timestamp} this Timestamp divided by the given one. + */ +Timestamp.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) { + return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Timestamp.ZERO)) { + return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Timestamp.ZERO; + rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Timestamp.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Timestamp.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Timestamp.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; +}; + +/** + * Returns this Timestamp modulo the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to mod. + * @return {Timestamp} this Timestamp modulo the given one. + */ +Timestamp.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); +}; + +/** + * The bitwise-NOT of this value. + * + * @method + * @return {Timestamp} the bitwise-NOT of this value. + */ +Timestamp.prototype.not = function() { + return Timestamp.fromBits(~this.low_, ~this.high_); +}; + +/** + * Returns the bitwise-AND of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to AND. + * @return {Timestamp} the bitwise-AND of this and the other. + */ +Timestamp.prototype.and = function(other) { + return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); +}; + +/** + * Returns the bitwise-OR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to OR. + * @return {Timestamp} the bitwise-OR of this and the other. + */ +Timestamp.prototype.or = function(other) { + return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); +}; + +/** + * Returns the bitwise-XOR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to XOR. + * @return {Timestamp} the bitwise-XOR of this and the other. + */ +Timestamp.prototype.xor = function(other) { + return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); +}; + +/** + * Returns this Timestamp with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the left by the given amount. + */ +Timestamp.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Timestamp.fromBits(low << numBits, (high << numBits) | (low >>> (32 - numBits))); + } else { + return Timestamp.fromBits(0, low << (numBits - 32)); + } + } +}; + +/** + * Returns this Timestamp with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount. + */ +Timestamp.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits((low >>> numBits) | (high << (32 - numBits)), high >> numBits); + } else { + return Timestamp.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } +}; + +/** + * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ +Timestamp.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits); + } else if (numBits === 32) { + return Timestamp.fromBits(high, 0); + } else { + return Timestamp.fromBits(high >>> (numBits - 32), 0); + } + } +}; + +/** + * Returns a Timestamp representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Timestamp.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Timestamp.INT_CACHE_[value] = obj; + } + return obj; +}; + +/** + * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Timestamp.ZERO; + } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MIN_VALUE; + } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MAX_VALUE; + } else if (value < 0) { + return Timestamp.fromNumber(-value).negate(); + } else { + return new Timestamp( + (value % Timestamp.TWO_PWR_32_DBL_) | 0, + (value / Timestamp.TWO_PWR_32_DBL_) | 0 + ); + } +}; + +/** + * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromBits = function(lowBits, highBits) { + return new Timestamp(lowBits, highBits); +}; + +/** + * Returns a Timestamp representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Timestamp. + * @param {number} opt_radix the radix in which the text is written. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromString = function(str, opt_radix) { + if (str.length === 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) === '-') { + return Timestamp.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); + + var result = Timestamp.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Timestamp.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Timestamp.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Timestamp.fromNumber(value)); + } + } + return result; +}; + +// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the +// from* methods on which they depend. + +/** + * A cache of the Timestamp representations of small integer values. + * @type {Object} + * @ignore + */ +Timestamp.INT_CACHE_ = {}; + +// NOTE: the compiler should inline these constant values below and then remove +// these variables, so there should be no runtime penalty for these. + +/** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_16_DBL_ = 1 << 16; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_24_DBL_ = 1 << 24; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; + +/** @type {Timestamp} */ +Timestamp.ZERO = Timestamp.fromInt(0); + +/** @type {Timestamp} */ +Timestamp.ONE = Timestamp.fromInt(1); + +/** @type {Timestamp} */ +Timestamp.NEG_ONE = Timestamp.fromInt(-1); + +/** @type {Timestamp} */ +Timestamp.MAX_VALUE = Timestamp.fromBits(0xffffffff | 0, 0x7fffffff | 0); + +/** @type {Timestamp} */ +Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); + +/** + * @type {Timestamp} + * @ignore + */ +Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); + +/** + * Expose. + */ +module.exports = Timestamp; +module.exports.Timestamp = Timestamp; + + +/***/ }), + +/***/ 58606: +/***/ ((module) => { + +var clone = (function() { +'use strict'; + +function _instanceof(obj, type) { + return type != null && obj instanceof type; +} + +var nativeMap; +try { + nativeMap = Map; +} catch(_) { + // maybe a reference error because no `Map`. Give it a dummy value that no + // value will ever be an instanceof. + nativeMap = function() {}; +} + +var nativeSet; +try { + nativeSet = Set; +} catch(_) { + nativeSet = function() {}; +} + +var nativePromise; +try { + nativePromise = Promise; +} catch(_) { + nativePromise = function() {}; +} + +/** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). + * @param `includeNonEnumerable` - set to true if the non-enumerable properties + * should be cloned as well. Non-enumerable properties on the prototype + * chain will be ignored. (optional - false by default) +*/ +function clone(parent, circular, depth, prototype, includeNonEnumerable) { + if (typeof circular === 'object') { + depth = circular.depth; + prototype = circular.prototype; + includeNonEnumerable = circular.includeNonEnumerable; + circular = circular.circular; + } + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth === 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (_instanceof(parent, nativeMap)) { + child = new nativeMap(); + } else if (_instanceof(parent, nativeSet)) { + child = new nativeSet(); + } else if (_instanceof(parent, nativePromise)) { + child = new nativePromise(function (resolve, reject) { + parent.then(function(value) { + resolve(_clone(value, depth - 1)); + }, function(err) { + reject(_clone(err, depth - 1)); + }); + }); + } else if (clone.__isArray(parent)) { + child = []; + } else if (clone.__isRegExp(parent)) { + child = new RegExp(parent.source, __getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (clone.__isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + if (Buffer.allocUnsafe) { + // Node.js >= 4.5.0 + child = Buffer.allocUnsafe(parent.length); + } else { + // Older Node.js versions + child = new Buffer(parent.length); + } + parent.copy(child); + return child; + } else if (_instanceof(parent, Error)) { + child = Object.create(parent); + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + if (_instanceof(parent, nativeMap)) { + parent.forEach(function(value, key) { + var keyChild = _clone(key, depth - 1); + var valueChild = _clone(value, depth - 1); + child.set(keyChild, valueChild); + }); + } + if (_instanceof(parent, nativeSet)) { + parent.forEach(function(value) { + var entryChild = _clone(value, depth - 1); + child.add(entryChild); + }); + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(parent); + for (var i = 0; i < symbols.length; i++) { + // Don't need to worry about cloning a symbol because it is a primitive, + // like a number or string. + var symbol = symbols[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); + if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { + continue; + } + child[symbol] = _clone(parent[symbol], depth - 1); + if (!descriptor.enumerable) { + Object.defineProperty(child, symbol, { + enumerable: false + }); + } + } + } + + if (includeNonEnumerable) { + var allPropertyNames = Object.getOwnPropertyNames(parent); + for (var i = 0; i < allPropertyNames.length; i++) { + var propertyName = allPropertyNames[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); + if (descriptor && descriptor.enumerable) { + continue; + } + child[propertyName] = _clone(parent[propertyName], depth - 1); + Object.defineProperty(child, propertyName, { + enumerable: false + }); + } + } + + return child; + } + + return _clone(parent, depth); +} + +/** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ +clone.clonePrototype = function clonePrototype(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); +}; + +// private utility functions + +function __objToStr(o) { + return Object.prototype.toString.call(o); +} +clone.__objToStr = __objToStr; + +function __isDate(o) { + return typeof o === 'object' && __objToStr(o) === '[object Date]'; +} +clone.__isDate = __isDate; + +function __isArray(o) { + return typeof o === 'object' && __objToStr(o) === '[object Array]'; +} +clone.__isArray = __isArray; + +function __isRegExp(o) { + return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; +} +clone.__isRegExp = __isRegExp; + +function __getRegExpFlags(re) { + var flags = ''; + if (re.global) flags += 'g'; + if (re.ignoreCase) flags += 'i'; + if (re.multiline) flags += 'm'; + return flags; +} +clone.__getRegExpFlags = __getRegExpFlags; + +return clone; +})(); + +if ( true && module.exports) { + module.exports = clone; +} + + +/***/ }), + +/***/ 93658: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +var __webpack_unused_export__; +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +__webpack_unused_export__ = parse; +__webpack_unused_export__ = serialize; + +/** + * Module variables. + * @private + */ + +var decode = decodeURIComponent; +var encode = encodeURIComponent; +var pairSplitRegExp = /; */; + +/** + * RegExp to match field-content in RFC 7230 sec 3.2 + * + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * obs-text = %x80-FF + */ + +var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + +/** + * Parse a cookie header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var pairs = str.split(pairSplitRegExp); + var dec = opt.decode || decode; + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + var eq_idx = pair.indexOf('='); + + // skip things that don't look like key=value + if (eq_idx < 0) { + continue; + } + + var key = pair.substr(0, eq_idx).trim() + var val = pair.substr(++eq_idx, pair.length).trim(); + + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + if (typeof opt.expires.toUTCString !== 'function') { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + opt.expires.toUTCString(); + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + case 'none': + str += '; SameSite=None'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} + + +/***/ }), + +/***/ 95898: +/***/ ((__unused_webpack_module, exports) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +/***/ }), + +/***/ 84697: +/***/ ((module) => { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} + + +/***/ }), + +/***/ 28222: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(46243)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 46243: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(84697); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 38237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(28222); +} else { + module.exports = __nccwpck_require__(35332); +} + + +/***/ }), + +/***/ 35332: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(33867); +const util = __nccwpck_require__(31669); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(46243)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 56323: +/***/ ((module) => { + +"use strict"; + + +var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) +}; + +function isNonNullObject(value) { + return !!value && typeof value === 'object' +} + +function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) +} + +// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 +var canUseSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + +function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE +} + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return target.propertyIsEnumerable(symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } + }); + return destination +} + +function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +}; + +var deepmerge_1 = deepmerge; + +module.exports = deepmerge_1; + + +/***/ }), + +/***/ 42342: +/***/ ((module) => { + +"use strict"; + + +/** + * Custom implementation of a double ended queue. + */ +function Denque(array, options) { + var options = options || {}; + + this._head = 0; + this._tail = 0; + this._capacity = options.capacity; + this._capacityMask = 0x3; + this._list = new Array(4); + if (Array.isArray(array)) { + this._fromArray(array); + } +} + +/** + * ------------- + * PUBLIC API + * ------------- + */ + +/** + * Returns the item at the specified index from the list. + * 0 is the first element, 1 is the second, and so on... + * Elements at negative values are that many from the end: -1 is one before the end + * (the last element), -2 is two before the end (one before last), etc. + * @param index + * @returns {*} + */ +Denque.prototype.peekAt = function peekAt(index) { + var i = index; + // expect a number or return undefined + if ((i !== (i | 0))) { + return void 0; + } + var len = this.size(); + if (i >= len || i < -len) return undefined; + if (i < 0) i += len; + i = (this._head + i) & this._capacityMask; + return this._list[i]; +}; + +/** + * Alias for peekAt() + * @param i + * @returns {*} + */ +Denque.prototype.get = function get(i) { + return this.peekAt(i); +}; + +/** + * Returns the first item in the list without removing it. + * @returns {*} + */ +Denque.prototype.peek = function peek() { + if (this._head === this._tail) return undefined; + return this._list[this._head]; +}; + +/** + * Alias for peek() + * @returns {*} + */ +Denque.prototype.peekFront = function peekFront() { + return this.peek(); +}; + +/** + * Returns the item that is at the back of the queue without removing it. + * Uses peekAt(-1) + */ +Denque.prototype.peekBack = function peekBack() { + return this.peekAt(-1); +}; + +/** + * Returns the current length of the queue + * @return {Number} + */ +Object.defineProperty(Denque.prototype, 'length', { + get: function length() { + return this.size(); + } +}); + +/** + * Return the number of items on the list, or 0 if empty. + * @returns {number} + */ +Denque.prototype.size = function size() { + if (this._head === this._tail) return 0; + if (this._head < this._tail) return this._tail - this._head; + else return this._capacityMask + 1 - (this._head - this._tail); +}; + +/** + * Add an item at the beginning of the list. + * @param item + */ +Denque.prototype.unshift = function unshift(item) { + if (item === undefined) return this.size(); + var len = this._list.length; + this._head = (this._head - 1 + len) & this._capacityMask; + this._list[this._head] = item; + if (this._tail === this._head) this._growArray(); + if (this._capacity && this.size() > this._capacity) this.pop(); + if (this._head < this._tail) return this._tail - this._head; + else return this._capacityMask + 1 - (this._head - this._tail); +}; + +/** + * Remove and return the first item on the list, + * Returns undefined if the list is empty. + * @returns {*} + */ +Denque.prototype.shift = function shift() { + var head = this._head; + if (head === this._tail) return undefined; + var item = this._list[head]; + this._list[head] = undefined; + this._head = (head + 1) & this._capacityMask; + if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray(); + return item; +}; + +/** + * Add an item to the bottom of the list. + * @param item + */ +Denque.prototype.push = function push(item) { + if (item === undefined) return this.size(); + var tail = this._tail; + this._list[tail] = item; + this._tail = (tail + 1) & this._capacityMask; + if (this._tail === this._head) { + this._growArray(); + } + if (this._capacity && this.size() > this._capacity) { + this.shift(); + } + if (this._head < this._tail) return this._tail - this._head; + else return this._capacityMask + 1 - (this._head - this._tail); +}; + +/** + * Remove and return the last item on the list. + * Returns undefined if the list is empty. + * @returns {*} + */ +Denque.prototype.pop = function pop() { + var tail = this._tail; + if (tail === this._head) return undefined; + var len = this._list.length; + this._tail = (tail - 1 + len) & this._capacityMask; + var item = this._list[this._tail]; + this._list[this._tail] = undefined; + if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray(); + return item; +}; + +/** + * Remove and return the item at the specified index from the list. + * Returns undefined if the list is empty. + * @param index + * @returns {*} + */ +Denque.prototype.removeOne = function removeOne(index) { + var i = index; + // expect a number or return undefined + if ((i !== (i | 0))) { + return void 0; + } + if (this._head === this._tail) return void 0; + var size = this.size(); + var len = this._list.length; + if (i >= size || i < -size) return void 0; + if (i < 0) i += size; + i = (this._head + i) & this._capacityMask; + var item = this._list[i]; + var k; + if (index < size / 2) { + for (k = index; k > 0; k--) { + this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask]; + } + this._list[i] = void 0; + this._head = (this._head + 1 + len) & this._capacityMask; + } else { + for (k = size - 1 - index; k > 0; k--) { + this._list[i] = this._list[i = ( i + 1 + len) & this._capacityMask]; + } + this._list[i] = void 0; + this._tail = (this._tail - 1 + len) & this._capacityMask; + } + return item; +}; + +/** + * Remove number of items from the specified index from the list. + * Returns array of removed items. + * Returns undefined if the list is empty. + * @param index + * @param count + * @returns {array} + */ +Denque.prototype.remove = function remove(index, count) { + var i = index; + var removed; + var del_count = count; + // expect a number or return undefined + if ((i !== (i | 0))) { + return void 0; + } + if (this._head === this._tail) return void 0; + var size = this.size(); + var len = this._list.length; + if (i >= size || i < -size || count < 1) return void 0; + if (i < 0) i += size; + if (count === 1 || !count) { + removed = new Array(1); + removed[0] = this.removeOne(i); + return removed; + } + if (i === 0 && i + count >= size) { + removed = this.toArray(); + this.clear(); + return removed; + } + if (i + count > size) count = size - i; + var k; + removed = new Array(count); + for (k = 0; k < count; k++) { + removed[k] = this._list[(this._head + i + k) & this._capacityMask]; + } + i = (this._head + i) & this._capacityMask; + if (index + count === size) { + this._tail = (this._tail - count + len) & this._capacityMask; + for (k = count; k > 0; k--) { + this._list[i = (i + 1 + len) & this._capacityMask] = void 0; + } + return removed; + } + if (index === 0) { + this._head = (this._head + count + len) & this._capacityMask; + for (k = count - 1; k > 0; k--) { + this._list[i = (i + 1 + len) & this._capacityMask] = void 0; + } + return removed; + } + if (i < size / 2) { + this._head = (this._head + index + count + len) & this._capacityMask; + for (k = index; k > 0; k--) { + this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]); + } + i = (this._head - 1 + len) & this._capacityMask; + while (del_count > 0) { + this._list[i = (i - 1 + len) & this._capacityMask] = void 0; + del_count--; + } + if (index < 0) this._tail = i; + } else { + this._tail = i; + i = (i + count + len) & this._capacityMask; + for (k = size - (count + index); k > 0; k--) { + this.push(this._list[i++]); + } + i = this._tail; + while (del_count > 0) { + this._list[i = (i + 1 + len) & this._capacityMask] = void 0; + del_count--; + } + } + if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray(); + return removed; +}; + +/** + * Native splice implementation. + * Remove number of items from the specified index from the list and/or add new elements. + * Returns array of removed items or empty array if count == 0. + * Returns undefined if the list is empty. + * + * @param index + * @param count + * @param {...*} [elements] + * @returns {array} + */ +Denque.prototype.splice = function splice(index, count) { + var i = index; + // expect a number or return undefined + if ((i !== (i | 0))) { + return void 0; + } + var size = this.size(); + if (i < 0) i += size; + if (i > size) return void 0; + if (arguments.length > 2) { + var k; + var temp; + var removed; + var arg_len = arguments.length; + var len = this._list.length; + var arguments_index = 2; + if (!size || i < size / 2) { + temp = new Array(i); + for (k = 0; k < i; k++) { + temp[k] = this._list[(this._head + k) & this._capacityMask]; + } + if (count === 0) { + removed = []; + if (i > 0) { + this._head = (this._head + i + len) & this._capacityMask; + } + } else { + removed = this.remove(i, count); + this._head = (this._head + i + len) & this._capacityMask; + } + while (arg_len > arguments_index) { + this.unshift(arguments[--arg_len]); + } + for (k = i; k > 0; k--) { + this.unshift(temp[k - 1]); + } + } else { + temp = new Array(size - (i + count)); + var leng = temp.length; + for (k = 0; k < leng; k++) { + temp[k] = this._list[(this._head + i + count + k) & this._capacityMask]; + } + if (count === 0) { + removed = []; + if (i != size) { + this._tail = (this._head + i + len) & this._capacityMask; + } + } else { + removed = this.remove(i, count); + this._tail = (this._tail - leng + len) & this._capacityMask; + } + while (arguments_index < arg_len) { + this.push(arguments[arguments_index++]); + } + for (k = 0; k < leng; k++) { + this.push(temp[k]); + } + } + return removed; + } else { + return this.remove(i, count); + } +}; + +/** + * Soft clear - does not reset capacity. + */ +Denque.prototype.clear = function clear() { + this._head = 0; + this._tail = 0; +}; + +/** + * Returns true or false whether the list is empty. + * @returns {boolean} + */ +Denque.prototype.isEmpty = function isEmpty() { + return this._head === this._tail; +}; + +/** + * Returns an array of all queue items. + * @returns {Array} + */ +Denque.prototype.toArray = function toArray() { + return this._copyArray(false); +}; + +/** + * ------------- + * INTERNALS + * ------------- + */ + +/** + * Fills the queue with items from an array + * For use in the constructor + * @param array + * @private + */ +Denque.prototype._fromArray = function _fromArray(array) { + for (var i = 0; i < array.length; i++) this.push(array[i]); +}; + +/** + * + * @param fullCopy + * @returns {Array} + * @private + */ +Denque.prototype._copyArray = function _copyArray(fullCopy) { + var newArray = []; + var list = this._list; + var len = list.length; + var i; + if (fullCopy || this._head > this._tail) { + for (i = this._head; i < len; i++) newArray.push(list[i]); + for (i = 0; i < this._tail; i++) newArray.push(list[i]); + } else { + for (i = this._head; i < this._tail; i++) newArray.push(list[i]); + } + return newArray; +}; + +/** + * Grows the internal list array. + * @private + */ +Denque.prototype._growArray = function _growArray() { + if (this._head) { + // copy existing data, head to end, then beginning to tail. + this._list = this._copyArray(true); + this._head = 0; + } + + // head is at 0 and array is now full, safe to extend + this._tail = this._list.length; + + this._list.length <<= 1; + this._capacityMask = (this._capacityMask << 1) | 1; +}; + +/** + * Shrinks the internal list array. + * @private + */ +Denque.prototype._shrinkArray = function _shrinkArray() { + this._list.length >>>= 1; + this._capacityMask >>>= 1; +}; + + +module.exports = Denque; + + +/***/ }), + +/***/ 98691: +/***/ ((module) => { + +"use strict"; + + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; + + +/***/ }), + +/***/ 57977: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var assertErr = __nccwpck_require__(71623) +var GraphQLScalarType = __nccwpck_require__(16155).GraphQLScalarType +var GraphQLError = __nccwpck_require__(50578).GraphQLError +var Kind = __nccwpck_require__(89537).Kind + +module.exports = new GraphQLScalarType({ + name: 'Date', + /** + * Serialize date value into string + * @param {Date} value date value + * @return {String} date as string + */ + serialize: function (value) { + assertErr(value instanceof Date, TypeError, 'Field error: value is not an instance of Date') + assertErr(!isNaN(value.getTime()), TypeError, 'Field error: value is an invalid Date') + return value.toJSON() + }, + /** + * Parse value into date + * @param {*} value serialized date value + * @return {Date} date value + */ + parseValue: function (value) { + var date = new Date(value) + assertErr(!isNaN(date.getTime()), TypeError, 'Field error: value is an invalid Date') + return date + }, + /** + * Parse ast literal to date + * @param {Object} ast graphql ast + * @return {Date} date value + */ + parseLiteral: function (ast) { + assertErr(ast.kind === Kind.STRING, + GraphQLError, 'Query error: Can only parse strings to dates but got a: ' + ast.kind, [ast]) + + var result = new Date(ast.value) + assertErr(!isNaN(result.getTime()), + GraphQLError, 'Query error: Invalid date', [ast]) + assertErr(ast.value === result.toJSON(), + GraphQLError, 'Query error: Invalid date format, only accepts: YYYY-MM-DDTHH:MM:SS.SSSZ', [ast]) + + return result + } +}) + +/***/ }), + +/***/ 57636: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +exports.__esModule = true; +exports.GraphQLJSONObject = exports.default = exports.GraphQLJSON = void 0; + +var _graphql = __nccwpck_require__(16155); + +var _language = __nccwpck_require__(89537); + +function identity(value) { + return value; +} + +function ensureObject(value) { + if (typeof value !== 'object' || value === null || Array.isArray(value)) { + throw new TypeError("JSONObject cannot represent non-object value: " + value); + } + + return value; +} + +function parseObject(typeName, ast, variables) { + var value = Object.create(null); + ast.fields.forEach(function (field) { + // eslint-disable-next-line no-use-before-define + value[field.name.value] = _parseLiteral(typeName, field.value, variables); + }); + return value; +} + +function _parseLiteral(typeName, ast, variables) { + switch (ast.kind) { + case _language.Kind.STRING: + case _language.Kind.BOOLEAN: + return ast.value; + + case _language.Kind.INT: + case _language.Kind.FLOAT: + return parseFloat(ast.value); + + case _language.Kind.OBJECT: + return parseObject(typeName, ast, variables); + + case _language.Kind.LIST: + return ast.values.map(function (n) { + return _parseLiteral(typeName, n, variables); + }); + + case _language.Kind.NULL: + return null; + + case _language.Kind.VARIABLE: + return variables ? variables[ast.name.value] : undefined; + + default: + throw new TypeError(typeName + " cannot represent value: " + (0, _language.print)(ast)); + } +} // This named export is intended for users of CommonJS. Users of ES modules +// should instead use the default export. + + +var GraphQLJSON = new _graphql.GraphQLScalarType({ + name: 'JSON', + description: 'The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).', + specifiedByUrl: 'http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf', + serialize: identity, + parseValue: identity, + parseLiteral: function parseLiteral(ast, variables) { + return _parseLiteral('JSON', ast, variables); + } +}); +exports.GraphQLJSON = GraphQLJSON; +var _default = GraphQLJSON; +exports.default = _default; +var GraphQLJSONObject = new _graphql.GraphQLScalarType({ + name: 'JSONObject', + description: 'The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).', + specifiedByUrl: 'http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf', + serialize: ensureObject, + parseValue: ensureObject, + parseLiteral: function parseLiteral(ast, variables) { + if (ast.kind !== _language.Kind.OBJECT) { + throw new TypeError("JSONObject cannot represent non-object value: " + (0, _language.print)(ast)); + } + + return parseObject('JSONObject', ast, variables); + } +}); +exports.GraphQLJSONObject = GraphQLJSONObject; + +/***/ }), + +/***/ 4797: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.printError = printError; +exports.GraphQLError = void 0; + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _symbols = __nccwpck_require__(3255); + +var _location = __nccwpck_require__(61922); + +var _printLocation = __nccwpck_require__(35250); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ +var GraphQLError = /*#__PURE__*/function (_Error) { + _inherits(GraphQLError, _Error); + + var _super = _createSuper(GraphQLError); + + /** + * A message describing the Error for debugging purposes. + * + * Enumerable, and appears in the result of JSON.stringify(). + * + * Note: should be treated as readonly, despite invariant usage. + */ + + /** + * An array of { line, column } locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + function GraphQLError(message, nodes, source, positions, path, originalError, extensions) { + var _locations2, _source2, _positions2, _extensions2; + + var _this; + + _classCallCheck(this, GraphQLError); + + _this = _super.call(this, message); // Compute list of blame nodes. + + var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions. + + + var _source = source; + + if (!_source && _nodes) { + var _nodes$0$loc; + + _source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source; + } + + var _positions = positions; + + if (!_positions && _nodes) { + _positions = _nodes.reduce(function (list, node) { + if (node.loc) { + list.push(node.loc.start); + } + + return list; + }, []); + } + + if (_positions && _positions.length === 0) { + _positions = undefined; + } + + var _locations; + + if (positions && source) { + _locations = positions.map(function (pos) { + return (0, _location.getLocation)(source, pos); + }); + } else if (_nodes) { + _locations = _nodes.reduce(function (list, node) { + if (node.loc) { + list.push((0, _location.getLocation)(node.loc.source, node.loc.start)); + } + + return list; + }, []); + } + + var _extensions = extensions; + + if (_extensions == null && originalError != null) { + var originalExtensions = originalError.extensions; + + if ((0, _isObjectLike.default)(originalExtensions)) { + _extensions = originalExtensions; + } + } + + Object.defineProperties(_assertThisInitialized(_this), { + name: { + value: 'GraphQLError' + }, + message: { + value: message, + // By being enumerable, JSON.stringify will include `message` in the + // resulting output. This ensures that the simplest possible GraphQL + // service adheres to the spec. + enumerable: true, + writable: true + }, + locations: { + // Coercing falsy values to undefined ensures they will not be included + // in JSON.stringify() when not provided. + value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined, + // By being enumerable, JSON.stringify will include `locations` in the + // resulting output. This ensures that the simplest possible GraphQL + // service adheres to the spec. + enumerable: _locations != null + }, + path: { + // Coercing falsy values to undefined ensures they will not be included + // in JSON.stringify() when not provided. + value: path !== null && path !== void 0 ? path : undefined, + // By being enumerable, JSON.stringify will include `path` in the + // resulting output. This ensures that the simplest possible GraphQL + // service adheres to the spec. + enumerable: path != null + }, + nodes: { + value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined + }, + source: { + value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined + }, + positions: { + value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined + }, + originalError: { + value: originalError + }, + extensions: { + // Coercing falsy values to undefined ensures they will not be included + // in JSON.stringify() when not provided. + value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined, + // By being enumerable, JSON.stringify will include `path` in the + // resulting output. This ensures that the simplest possible GraphQL + // service adheres to the spec. + enumerable: _extensions != null + } + }); // Include (non-enumerable) stack trace. + + if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) { + Object.defineProperty(_assertThisInitialized(_this), 'stack', { + value: originalError.stack, + writable: true, + configurable: true + }); + return _possibleConstructorReturn(_this); + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') + + + if (Error.captureStackTrace) { + Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError); + } else { + Object.defineProperty(_assertThisInitialized(_this), 'stack', { + value: Error().stack, + writable: true, + configurable: true + }); + } + + return _this; + } + + _createClass(GraphQLError, [{ + key: "toString", + value: function toString() { + return printError(this); + } // FIXME: workaround to not break chai comparisons, should be remove in v16 + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + + }, { + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'Object'; + } + }]); + + return GraphQLError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + */ + + +exports.GraphQLError = GraphQLError; + +function printError(error) { + var output = error.message; + + if (error.nodes) { + for (var _i2 = 0, _error$nodes2 = error.nodes; _i2 < _error$nodes2.length; _i2++) { + var node = _error$nodes2[_i2]; + + if (node.loc) { + output += '\n\n' + (0, _printLocation.printLocation)(node.loc); + } + } + } else if (error.source && error.locations) { + for (var _i4 = 0, _error$locations2 = error.locations; _i4 < _error$locations2.length; _i4++) { + var location = _error$locations2[_i4]; + output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location); + } + } + + return output; +} + + +/***/ }), + +/***/ 67166: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.formatError = formatError; + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + */ +function formatError(error) { + var _error$message; + + error || (0, _devAssert.default)(0, 'Received null or undefined error.'); + var message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : 'An unknown error occurred.'; + var locations = error.locations; + var path = error.path; + var extensions = error.extensions; + return extensions ? { + message: message, + locations: locations, + path: path, + extensions: extensions + } : { + message: message, + locations: locations, + path: path + }; +} +/** + * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors + */ + + +/***/ }), + +/***/ 50578: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "GraphQLError", ({ + enumerable: true, + get: function get() { + return _GraphQLError.GraphQLError; + } +})); +Object.defineProperty(exports, "printError", ({ + enumerable: true, + get: function get() { + return _GraphQLError.printError; + } +})); +Object.defineProperty(exports, "syntaxError", ({ + enumerable: true, + get: function get() { + return _syntaxError.syntaxError; + } +})); +Object.defineProperty(exports, "locatedError", ({ + enumerable: true, + get: function get() { + return _locatedError.locatedError; + } +})); +Object.defineProperty(exports, "formatError", ({ + enumerable: true, + get: function get() { + return _formatError.formatError; + } +})); + +var _GraphQLError = __nccwpck_require__(4797); + +var _syntaxError = __nccwpck_require__(52295); + +var _locatedError = __nccwpck_require__(16842); + +var _formatError = __nccwpck_require__(67166); + + +/***/ }), + +/***/ 16842: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.locatedError = locatedError; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +function locatedError(rawOriginalError, nodes, path) { + var _nodes; + + // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + var originalError = rawOriginalError instanceof Error ? rawOriginalError : new Error('Unexpected error value: ' + (0, _inspect.default)(rawOriginalError)); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + + if (Array.isArray(originalError.path)) { + return originalError; + } + + return new _GraphQLError.GraphQLError(originalError.message, (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes, originalError.source, originalError.positions, path, originalError); +} + + +/***/ }), + +/***/ 52295: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.syntaxError = syntaxError; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +function syntaxError(source, position, description) { + return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); +} + + +/***/ }), + +/***/ 83677: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.execute = execute; +exports.executeSync = executeSync; +exports.assertValidExecutionArguments = assertValidExecutionArguments; +exports.buildExecutionContext = buildExecutionContext; +exports.collectFields = collectFields; +exports.buildResolveInfo = buildResolveInfo; +exports.getFieldDef = getFieldDef; +exports.defaultFieldResolver = exports.defaultTypeResolver = void 0; + +var _arrayFrom = _interopRequireDefault(__nccwpck_require__(86839)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _memoize = _interopRequireDefault(__nccwpck_require__(64217)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _isPromise = _interopRequireDefault(__nccwpck_require__(93910)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _isCollection = _interopRequireDefault(__nccwpck_require__(54363)); + +var _promiseReduce = _interopRequireDefault(__nccwpck_require__(77286)); + +var _promiseForObject = _interopRequireDefault(__nccwpck_require__(46804)); + +var _Path = __nccwpck_require__(11262); + +var _GraphQLError = __nccwpck_require__(4797); + +var _locatedError = __nccwpck_require__(16842); + +var _kinds = __nccwpck_require__(11927); + +var _validate = __nccwpck_require__(22430); + +var _introspection = __nccwpck_require__(28344); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +var _getOperationRootType = __nccwpck_require__(81605); + +var _values = __nccwpck_require__(94834); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function execute(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { + /* eslint-enable no-redeclare */ + // Extract arguments from object args if provided. + return arguments.length === 1 ? executeImpl(argsOrSchema) : executeImpl({ + schema: argsOrSchema, + document: document, + rootValue: rootValue, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver, + typeResolver: typeResolver + }); +} +/** + * Also implements the "Evaluating requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + + +function executeSync(args) { + var result = executeImpl(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.default)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function executeImpl(args) { + var schema = args.schema, + document = args.document, + rootValue = args.rootValue, + contextValue = args.contextValue, + variableValues = args.variableValues, + operationName = args.operationName, + fieldResolver = args.fieldResolver, + typeResolver = args.typeResolver; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + var exeContext = buildExecutionContext(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Return early errors if execution context failed. + + if (Array.isArray(exeContext)) { + return { + errors: exeContext + }; + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + + + var data = executeOperation(exeContext, exeContext.operation, rootValue); + return buildResponse(exeContext, data); +} +/** + * Given a completed execution context and data, build the { errors, data } + * response defined by the "Response" section of the GraphQL specification. + */ + + +function buildResponse(exeContext, data) { + if ((0, _isPromise.default)(data)) { + return data.then(function (resolved) { + return buildResponse(exeContext, resolved); + }); + } + + return exeContext.errors.length === 0 ? { + data: data + } : { + errors: exeContext.errors, + data: data + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + + +function assertValidExecutionArguments(schema, document, rawVariableValues) { + document || (0, _devAssert.default)(0, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || (0, _isObjectLike.default)(rawVariableValues) || (0, _devAssert.default)(0, 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.'); +} +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ + + +function buildExecutionContext(schema, document, rootValue, contextValue, rawVariableValues, operationName, fieldResolver, typeResolver) { + var _definition$name, _operation$variableDe; + + var operation; + var fragments = Object.create(null); + + for (var _i2 = 0, _document$definitions2 = document.definitions; _i2 < _document$definitions2.length; _i2++) { + var definition = _document$definitions2[_i2]; + + switch (definition.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [new _GraphQLError.GraphQLError('Must provide operation name if query contains multiple operations.')]; + } + + operation = definition; + } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { + operation = definition; + } + + break; + + case _kinds.Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + } + } + + if (!operation) { + if (operationName != null) { + return [new _GraphQLError.GraphQLError("Unknown operation named \"".concat(operationName, "\"."))]; + } + + return [new _GraphQLError.GraphQLError('Must provide an operation.')]; + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + + var variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; + var coercedVariableValues = (0, _values.getVariableValues)(schema, variableDefinitions, rawVariableValues !== null && rawVariableValues !== void 0 ? rawVariableValues : {}, { + maxErrors: 50 + }); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema: schema, + fragments: fragments, + rootValue: rootValue, + contextValue: contextValue, + operation: operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: fieldResolver !== null && fieldResolver !== void 0 ? fieldResolver : defaultFieldResolver, + typeResolver: typeResolver !== null && typeResolver !== void 0 ? typeResolver : defaultTypeResolver, + errors: [] + }; +} +/** + * Implements the "Evaluating operations" section of the spec. + */ + + +function executeOperation(exeContext, operation, rootValue) { + var type = (0, _getOperationRootType.getOperationRootType)(exeContext.schema, operation); + var fields = collectFields(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); + var path = undefined; // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + + try { + var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields); + + if ((0, _isPromise.default)(result)) { + return result.then(undefined, function (error) { + exeContext.errors.push(error); + return Promise.resolve(null); + }); + } + + return result; + } catch (error) { + exeContext.errors.push(error); + return null; + } +} +/** + * Implements the "Evaluating selection sets" section of the spec + * for "write" mode. + */ + + +function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) { + return (0, _promiseReduce.default)(Object.keys(fields), function (results, responseName) { + var fieldNodes = fields[responseName]; + var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); + + if (result === undefined) { + return results; + } + + if ((0, _isPromise.default)(result)) { + return result.then(function (resolvedResult) { + results[responseName] = resolvedResult; + return results; + }); + } + + results[responseName] = result; + return results; + }, Object.create(null)); +} +/** + * Implements the "Evaluating selection sets" section of the spec + * for "read" mode. + */ + + +function executeFields(exeContext, parentType, sourceValue, path, fields) { + var results = Object.create(null); + var containsPromise = false; + + for (var _i4 = 0, _Object$keys2 = Object.keys(fields); _i4 < _Object$keys2.length; _i4++) { + var responseName = _Object$keys2[_i4]; + var fieldNodes = fields[responseName]; + var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); + + if (result !== undefined) { + results[responseName] = result; + + if ((0, _isPromise.default)(result)) { + containsPromise = true; + } + } + } // If there are no promises, we can just return the object + + + if (!containsPromise) { + return results; + } // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + + + return (0, _promiseForObject.default)(results); +} +/** + * Given a selectionSet, adds all of the fields in that selection to + * the passed in map of fields, and returns it at the end. + * + * CollectFields requires the "runtime type" of an object. For a field which + * returns an Interface or Union type, the "runtime type" will be the actual + * Object type returned by that field. + * + * @internal + */ + + +function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFragmentNames) { + for (var _i6 = 0, _selectionSet$selecti2 = selectionSet.selections; _i6 < _selectionSet$selecti2.length; _i6++) { + var selection = _selectionSet$selecti2[_i6]; + + switch (selection.kind) { + case _kinds.Kind.FIELD: + { + if (!shouldIncludeNode(exeContext, selection)) { + continue; + } + + var name = getFieldEntryKey(selection); + + if (!fields[name]) { + fields[name] = []; + } + + fields[name].push(selection); + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: + { + if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) { + continue; + } + + collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: + { + var fragName = selection.name.value; + + if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) { + continue; + } + + visitedFragmentNames[fragName] = true; + var fragment = exeContext.fragments[fragName]; + + if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) { + continue; + } + + collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames); + break; + } + } + } + + return fields; +} +/** + * Determines if a field should be included based on the @include and @skip + * directives, where @skip has higher precedence than @include. + */ + + +function shouldIncludeNode(exeContext, node) { + var skip = (0, _values.getDirectiveValues)(_directives.GraphQLSkipDirective, node, exeContext.variableValues); + + if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { + return false; + } + + var include = (0, _values.getDirectiveValues)(_directives.GraphQLIncludeDirective, node, exeContext.variableValues); + + if ((include === null || include === void 0 ? void 0 : include.if) === false) { + return false; + } + + return true; +} +/** + * Determines if a fragment is applicable to the given type. + */ + + +function doesFragmentConditionMatch(exeContext, fragment, type) { + var typeConditionNode = fragment.typeCondition; + + if (!typeConditionNode) { + return true; + } + + var conditionalType = (0, _typeFromAST.typeFromAST)(exeContext.schema, typeConditionNode); + + if (conditionalType === type) { + return true; + } + + if ((0, _definition.isAbstractType)(conditionalType)) { + return exeContext.schema.isSubType(conditionalType, type); + } + + return false; +} +/** + * Implements the logic to compute the key of a given field's entry + */ + + +function getFieldEntryKey(node) { + return node.alias ? node.alias.value : node.name.value; +} +/** + * Resolves the field on the given source object. In particular, this + * figures out the value that the field returns by calling its resolve function, + * then calls completeValue to complete promises, serialize scalars, or execute + * the sub-selection-set for objects. + */ + + +function resolveField(exeContext, parentType, source, fieldNodes, path) { + var _fieldDef$resolve; + + var fieldNode = fieldNodes[0]; + var fieldName = fieldNode.name.value; + var fieldDef = getFieldDef(exeContext.schema, parentType, fieldName); + + if (!fieldDef) { + return; + } + + var returnType = fieldDef.type; + var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver; + var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error). + + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + var _contextValue = exeContext.contextValue; + var result = resolveFn(source, args, _contextValue, info); + var completed; + + if ((0, _isPromise.default)(result)) { + completed = result.then(function (resolved) { + return completeValue(exeContext, returnType, fieldNodes, info, path, resolved); + }); + } else { + completed = completeValue(exeContext, returnType, fieldNodes, info, path, result); + } + + if ((0, _isPromise.default)(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, function (rawError) { + var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); + return handleFieldError(error, returnType, exeContext); + }); + } + + return completed; + } catch (rawError) { + var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); + return handleFieldError(error, returnType, exeContext); + } +} +/** + * @internal + */ + + +function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes: fieldNodes, + returnType: fieldDef.type, + parentType: parentType, + path: path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues + }; +} + +function handleFieldError(error, returnType, exeContext) { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if ((0, _definition.isNonNullType)(returnType)) { + throw error; + } // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + + + exeContext.errors.push(error); + return null; +} +/** + * Implements the instructions for completeValue as defined in the + * "Field entries" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by evaluating all sub-selections. + */ + + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + + + if ((0, _definition.isNonNullType)(returnType)) { + var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path, result); + + if (completed === null) { + throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, ".")); + } + + return completed; + } // If result value is null or undefined then return null. + + + if (result == null) { + return null; + } // If field type is List, complete each item in the list with the inner type + + + if ((0, _definition.isListType)(returnType)) { + return completeListValue(exeContext, returnType, fieldNodes, info, path, result); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + + + if ((0, _definition.isLeafType)(returnType)) { + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + + + if ((0, _definition.isAbstractType)(returnType)) { + return completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result); + } // If field type is Object, execute and complete all sub-selections. + // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isObjectType)(returnType)) { + return completeObjectValue(exeContext, returnType, fieldNodes, info, path, result); + } // istanbul ignore next (Not reachable. All possible output types have been considered) + + + false || (0, _invariant.default)(0, 'Cannot complete value of unexpected output type: ' + (0, _inspect.default)(returnType)); +} +/** + * Complete a list value by completing each item in the list with the + * inner type + */ + + +function completeListValue(exeContext, returnType, fieldNodes, info, path, result) { + if (!(0, _isCollection.default)(result)) { + throw new _GraphQLError.GraphQLError("Expected Iterable, but did not find one for field \"".concat(info.parentType.name, ".").concat(info.fieldName, "\".")); + } // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + + + var itemType = returnType.ofType; + var containsPromise = false; + var completedResults = (0, _arrayFrom.default)(result, function (item, index) { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + var itemPath = (0, _Path.addPath)(path, index, undefined); + + try { + var completedItem; + + if ((0, _isPromise.default)(item)) { + completedItem = item.then(function (resolved) { + return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved); + }); + } else { + completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item); + } + + if ((0, _isPromise.default)(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, function (rawError) { + var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); + return handleFieldError(error, itemType, exeContext); + }); + } + + return completedItem; + } catch (rawError) { + var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); + return handleFieldError(error, itemType, exeContext); + } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; +} +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ + + +function completeLeafValue(returnType, result) { + var serializedResult = returnType.serialize(result); + + if (serializedResult === undefined) { + throw new Error("Expected a value of type \"".concat((0, _inspect.default)(returnType), "\" but ") + "received: ".concat((0, _inspect.default)(result))); + } + + return serializedResult; +} +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ + + +function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) { + var _returnType$resolveTy; + + var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver; + var contextValue = exeContext.contextValue; + var runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if ((0, _isPromise.default)(runtimeType)) { + return runtimeType.then(function (resolvedRuntimeType) { + return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); + }); + } + + return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); +} + +function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) { + if (runtimeTypeOrName == null) { + throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\". Either the \"").concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes); + } // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0 + + + var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName; + + if (typeof runtimeTypeName !== 'string') { + throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\" with ") + "value ".concat((0, _inspect.default)(result), ", received \"").concat((0, _inspect.default)(runtimeTypeOrName), "\".")); + } + + var runtimeType = exeContext.schema.getType(runtimeTypeName); + + if (runtimeType == null) { + throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a type \"").concat(runtimeTypeName, "\" that does not exist inside schema."), fieldNodes); + } + + if (!(0, _definition.isObjectType)(runtimeType)) { + throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a non-object type \"").concat(runtimeTypeName, "\"."), fieldNodes); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new _GraphQLError.GraphQLError("Runtime Object type \"".concat(runtimeType.name, "\" is not a possible type for \"").concat(returnType.name, "\"."), fieldNodes); + } + + return runtimeType; +} +/** + * Complete an Object value by executing all sub-selections. + */ + + +function completeObjectValue(exeContext, returnType, fieldNodes, info, path, result) { + // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + if (returnType.isTypeOf) { + var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if ((0, _isPromise.default)(isTypeOf)) { + return isTypeOf.then(function (resolvedIsTypeOf) { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + + return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result); +} + +function invalidReturnTypeError(returnType, result, fieldNodes) { + return new _GraphQLError.GraphQLError("Expected value of type \"".concat(returnType.name, "\" but got: ").concat((0, _inspect.default)(result), "."), fieldNodes); +} + +function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result) { + // Collect sub-fields to execute to complete this value. + var subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ + + +var collectSubfields = (0, _memoize.default)(_collectSubfields); + +function _collectSubfields(exeContext, returnType, fieldNodes) { + var subFieldNodes = Object.create(null); + var visitedFragmentNames = Object.create(null); + + for (var _i8 = 0; _i8 < fieldNodes.length; _i8++) { + var node = fieldNodes[_i8]; + + if (node.selectionSet) { + subFieldNodes = collectFields(exeContext, returnType, node.selectionSet, subFieldNodes, visitedFragmentNames); + } + } + + return subFieldNodes; +} +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ + + +var defaultTypeResolver = function defaultTypeResolver(value, contextValue, info, abstractType) { + // First, look for `__typename`. + if ((0, _isObjectLike.default)(value) && typeof value.__typename === 'string') { + return value.__typename; + } // Otherwise, test each possible type. + + + var possibleTypes = info.schema.getPossibleTypes(abstractType); + var promisedIsTypeOfResults = []; + + for (var i = 0; i < possibleTypes.length; i++) { + var type = possibleTypes[i]; + + if (type.isTypeOf) { + var isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if ((0, _isPromise.default)(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then(function (isTypeOfResults) { + for (var _i9 = 0; _i9 < isTypeOfResults.length; _i9++) { + if (isTypeOfResults[_i9]) { + return possibleTypes[_i9].name; + } + } + }); + } +}; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ + + +exports.defaultTypeResolver = defaultTypeResolver; + +var defaultFieldResolver = function defaultFieldResolver(source, args, contextValue, info) { + // ensure source is a value for which property access is acceptable. + if ((0, _isObjectLike.default)(source) || typeof source === 'function') { + var property = source[info.fieldName]; + + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + + return property; + } +}; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ + + +exports.defaultFieldResolver = defaultFieldResolver; + +function getFieldDef(schema, parentType, fieldName) { + if (fieldName === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.SchemaMetaFieldDef; + } else if (fieldName === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.TypeMetaFieldDef; + } else if (fieldName === _introspection.TypeNameMetaFieldDef.name) { + return _introspection.TypeNameMetaFieldDef; + } + + return parentType.getFields()[fieldName]; +} + + +/***/ }), + +/***/ 13176: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "responsePathAsArray", ({ + enumerable: true, + get: function get() { + return _Path.pathToArray; + } +})); +Object.defineProperty(exports, "execute", ({ + enumerable: true, + get: function get() { + return _execute.execute; + } +})); +Object.defineProperty(exports, "executeSync", ({ + enumerable: true, + get: function get() { + return _execute.executeSync; + } +})); +Object.defineProperty(exports, "defaultFieldResolver", ({ + enumerable: true, + get: function get() { + return _execute.defaultFieldResolver; + } +})); +Object.defineProperty(exports, "defaultTypeResolver", ({ + enumerable: true, + get: function get() { + return _execute.defaultTypeResolver; + } +})); +Object.defineProperty(exports, "getDirectiveValues", ({ + enumerable: true, + get: function get() { + return _values.getDirectiveValues; + } +})); + +var _Path = __nccwpck_require__(11262); + +var _execute = __nccwpck_require__(83677); + +var _values = __nccwpck_require__(94834); + + +/***/ }), + +/***/ 94834: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getVariableValues = getVariableValues; +exports.getArgumentValues = getArgumentValues; +exports.getDirectiveValues = getDirectiveValues; + +var _find = _interopRequireDefault(__nccwpck_require__(57649)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _printPathArray = _interopRequireDefault(__nccwpck_require__(94281)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _printer = __nccwpck_require__(68203); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +var _valueFromAST = __nccwpck_require__(83181); + +var _coerceInputValue = __nccwpck_require__(39603); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + * + * @internal + */ +function getVariableValues(schema, varDefNodes, inputs, options) { + var errors = []; + var maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors; + + try { + var coerced = coerceVariableValues(schema, varDefNodes, inputs, function (error) { + if (maxErrors != null && errors.length >= maxErrors) { + throw new _GraphQLError.GraphQLError('Too many errors processing variables, error limit reached. Execution aborted.'); + } + + errors.push(error); + }); + + if (errors.length === 0) { + return { + coerced: coerced + }; + } + } catch (error) { + errors.push(error); + } + + return { + errors: errors + }; +} + +function coerceVariableValues(schema, varDefNodes, inputs, onError) { + var coercedValues = {}; + + var _loop = function _loop(_i2) { + var varDefNode = varDefNodes[_i2]; + var varName = varDefNode.variable.name.value; + var varType = (0, _typeFromAST.typeFromAST)(schema, varDefNode.type); + + if (!(0, _definition.isInputType)(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + var varTypeStr = (0, _printer.print)(varDefNode.type); + onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" expected value of type \"").concat(varTypeStr, "\" which cannot be used as an input type."), varDefNode.type)); + return "continue"; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = (0, _valueFromAST.valueFromAST)(varDefNode.defaultValue, varType); + } else if ((0, _definition.isNonNullType)(varType)) { + var _varTypeStr = (0, _inspect.default)(varType); + + onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of required type \"").concat(_varTypeStr, "\" was not provided."), varDefNode)); + } + + return "continue"; + } + + var value = inputs[varName]; + + if (value === null && (0, _definition.isNonNullType)(varType)) { + var _varTypeStr2 = (0, _inspect.default)(varType); + + onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of non-null type \"").concat(_varTypeStr2, "\" must not be null."), varDefNode)); + return "continue"; + } + + coercedValues[varName] = (0, _coerceInputValue.coerceInputValue)(value, varType, function (path, invalidValue, error) { + var prefix = "Variable \"$".concat(varName, "\" got invalid value ") + (0, _inspect.default)(invalidValue); + + if (path.length > 0) { + prefix += " at \"".concat(varName).concat((0, _printPathArray.default)(path), "\""); + } + + onError(new _GraphQLError.GraphQLError(prefix + '; ' + error.message, varDefNode, undefined, undefined, undefined, error.originalError)); + }); + }; + + for (var _i2 = 0; _i2 < varDefNodes.length; _i2++) { + var _ret = _loop(_i2); + + if (_ret === "continue") continue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + * + * @internal + */ + + +function getArgumentValues(def, node, variableValues) { + var _node$arguments; + + var coercedValues = {}; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + var argumentNodes = (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 ? _node$arguments : []; + var argNodeMap = (0, _keyMap.default)(argumentNodes, function (arg) { + return arg.name.value; + }); + + for (var _i4 = 0, _def$args2 = def.args; _i4 < _def$args2.length; _i4++) { + var argDef = _def$args2[_i4]; + var name = argDef.name; + var argType = argDef.type; + var argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of required type \"").concat((0, _inspect.default)(argType), "\" ") + 'was not provided.', node); + } + + continue; + } + + var valueNode = argumentNode.value; + var isNull = valueNode.kind === _kinds.Kind.NULL; + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + var variableName = valueNode.name.value; + + if (variableValues == null || !hasOwnProperty(variableValues, variableName)) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of required type \"").concat((0, _inspect.default)(argType), "\" ") + "was provided the variable \"$".concat(variableName, "\" which was not provided a runtime value."), valueNode); + } + + continue; + } + + isNull = variableValues[variableName] == null; + } + + if (isNull && (0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" of non-null type \"").concat((0, _inspect.default)(argType), "\" ") + 'must not be null.', valueNode); + } + + var coercedValue = (0, _valueFromAST.valueFromAST)(valueNode, argType, variableValues); + + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new _GraphQLError.GraphQLError("Argument \"".concat(name, "\" has invalid value ").concat((0, _printer.print)(valueNode), "."), valueNode); + } + + coercedValues[name] = coercedValue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + + +function getDirectiveValues(directiveDef, node, variableValues) { + var directiveNode = node.directives && (0, _find.default)(node.directives, function (directive) { + return directive.name.value === directiveDef.name; + }); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + + +/***/ }), + +/***/ 64215: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.graphql = graphql; +exports.graphqlSync = graphqlSync; + +var _isPromise = _interopRequireDefault(__nccwpck_require__(93910)); + +var _parser = __nccwpck_require__(50655); + +var _validate = __nccwpck_require__(14193); + +var _validate2 = __nccwpck_require__(22430); + +var _execute = __nccwpck_require__(83677); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { + var _arguments = arguments; + + /* eslint-enable no-redeclare */ + // Always return a Promise for a consistent API. + return new Promise(function (resolve) { + return resolve( // Extract arguments from object args if provided. + _arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ + schema: argsOrSchema, + source: source, + rootValue: rootValue, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver, + typeResolver: typeResolver + })); + }); +} +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + + +function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { + /* eslint-enable no-redeclare */ + // Extract arguments from object args if provided. + var result = arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ + schema: argsOrSchema, + source: source, + rootValue: rootValue, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver, + typeResolver: typeResolver + }); // Assert that the execution was synchronous. + + if ((0, _isPromise.default)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args) { + var schema = args.schema, + source = args.source, + rootValue = args.rootValue, + contextValue = args.contextValue, + variableValues = args.variableValues, + operationName = args.operationName, + fieldResolver = args.fieldResolver, + typeResolver = args.typeResolver; // Validate Schema + + var schemaValidationErrors = (0, _validate2.validateSchema)(schema); + + if (schemaValidationErrors.length > 0) { + return { + errors: schemaValidationErrors + }; + } // Parse + + + var document; + + try { + document = (0, _parser.parse)(source); + } catch (syntaxError) { + return { + errors: [syntaxError] + }; + } // Validate + + + var validationErrors = (0, _validate.validate)(schema, document); + + if (validationErrors.length > 0) { + return { + errors: validationErrors + }; + } // Execute + + + return (0, _execute.execute)({ + schema: schema, + document: document, + rootValue: rootValue, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver, + typeResolver: typeResolver + }); +} + + +/***/ }), + +/***/ 16155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function get() { + return _version.version; + } +})); +Object.defineProperty(exports, "versionInfo", ({ + enumerable: true, + get: function get() { + return _version.versionInfo; + } +})); +Object.defineProperty(exports, "graphql", ({ + enumerable: true, + get: function get() { + return _graphql.graphql; + } +})); +Object.defineProperty(exports, "graphqlSync", ({ + enumerable: true, + get: function get() { + return _graphql.graphqlSync; + } +})); +Object.defineProperty(exports, "GraphQLSchema", ({ + enumerable: true, + get: function get() { + return _index.GraphQLSchema; + } +})); +Object.defineProperty(exports, "GraphQLDirective", ({ + enumerable: true, + get: function get() { + return _index.GraphQLDirective; + } +})); +Object.defineProperty(exports, "GraphQLScalarType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLScalarType; + } +})); +Object.defineProperty(exports, "GraphQLObjectType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLObjectType; + } +})); +Object.defineProperty(exports, "GraphQLInterfaceType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLInterfaceType; + } +})); +Object.defineProperty(exports, "GraphQLUnionType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLUnionType; + } +})); +Object.defineProperty(exports, "GraphQLEnumType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLEnumType; + } +})); +Object.defineProperty(exports, "GraphQLInputObjectType", ({ + enumerable: true, + get: function get() { + return _index.GraphQLInputObjectType; + } +})); +Object.defineProperty(exports, "GraphQLList", ({ + enumerable: true, + get: function get() { + return _index.GraphQLList; + } +})); +Object.defineProperty(exports, "GraphQLNonNull", ({ + enumerable: true, + get: function get() { + return _index.GraphQLNonNull; + } +})); +Object.defineProperty(exports, "specifiedScalarTypes", ({ + enumerable: true, + get: function get() { + return _index.specifiedScalarTypes; + } +})); +Object.defineProperty(exports, "GraphQLInt", ({ + enumerable: true, + get: function get() { + return _index.GraphQLInt; + } +})); +Object.defineProperty(exports, "GraphQLFloat", ({ + enumerable: true, + get: function get() { + return _index.GraphQLFloat; + } +})); +Object.defineProperty(exports, "GraphQLString", ({ + enumerable: true, + get: function get() { + return _index.GraphQLString; + } +})); +Object.defineProperty(exports, "GraphQLBoolean", ({ + enumerable: true, + get: function get() { + return _index.GraphQLBoolean; + } +})); +Object.defineProperty(exports, "GraphQLID", ({ + enumerable: true, + get: function get() { + return _index.GraphQLID; + } +})); +Object.defineProperty(exports, "specifiedDirectives", ({ + enumerable: true, + get: function get() { + return _index.specifiedDirectives; + } +})); +Object.defineProperty(exports, "GraphQLIncludeDirective", ({ + enumerable: true, + get: function get() { + return _index.GraphQLIncludeDirective; + } +})); +Object.defineProperty(exports, "GraphQLSkipDirective", ({ + enumerable: true, + get: function get() { + return _index.GraphQLSkipDirective; + } +})); +Object.defineProperty(exports, "GraphQLDeprecatedDirective", ({ + enumerable: true, + get: function get() { + return _index.GraphQLDeprecatedDirective; + } +})); +Object.defineProperty(exports, "GraphQLSpecifiedByDirective", ({ + enumerable: true, + get: function get() { + return _index.GraphQLSpecifiedByDirective; + } +})); +Object.defineProperty(exports, "TypeKind", ({ + enumerable: true, + get: function get() { + return _index.TypeKind; + } +})); +Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", ({ + enumerable: true, + get: function get() { + return _index.DEFAULT_DEPRECATION_REASON; + } +})); +Object.defineProperty(exports, "introspectionTypes", ({ + enumerable: true, + get: function get() { + return _index.introspectionTypes; + } +})); +Object.defineProperty(exports, "__Schema", ({ + enumerable: true, + get: function get() { + return _index.__Schema; + } +})); +Object.defineProperty(exports, "__Directive", ({ + enumerable: true, + get: function get() { + return _index.__Directive; + } +})); +Object.defineProperty(exports, "__DirectiveLocation", ({ + enumerable: true, + get: function get() { + return _index.__DirectiveLocation; + } +})); +Object.defineProperty(exports, "__Type", ({ + enumerable: true, + get: function get() { + return _index.__Type; + } +})); +Object.defineProperty(exports, "__Field", ({ + enumerable: true, + get: function get() { + return _index.__Field; + } +})); +Object.defineProperty(exports, "__InputValue", ({ + enumerable: true, + get: function get() { + return _index.__InputValue; + } +})); +Object.defineProperty(exports, "__EnumValue", ({ + enumerable: true, + get: function get() { + return _index.__EnumValue; + } +})); +Object.defineProperty(exports, "__TypeKind", ({ + enumerable: true, + get: function get() { + return _index.__TypeKind; + } +})); +Object.defineProperty(exports, "SchemaMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _index.SchemaMetaFieldDef; + } +})); +Object.defineProperty(exports, "TypeMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _index.TypeMetaFieldDef; + } +})); +Object.defineProperty(exports, "TypeNameMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _index.TypeNameMetaFieldDef; + } +})); +Object.defineProperty(exports, "isSchema", ({ + enumerable: true, + get: function get() { + return _index.isSchema; + } +})); +Object.defineProperty(exports, "isDirective", ({ + enumerable: true, + get: function get() { + return _index.isDirective; + } +})); +Object.defineProperty(exports, "isType", ({ + enumerable: true, + get: function get() { + return _index.isType; + } +})); +Object.defineProperty(exports, "isScalarType", ({ + enumerable: true, + get: function get() { + return _index.isScalarType; + } +})); +Object.defineProperty(exports, "isObjectType", ({ + enumerable: true, + get: function get() { + return _index.isObjectType; + } +})); +Object.defineProperty(exports, "isInterfaceType", ({ + enumerable: true, + get: function get() { + return _index.isInterfaceType; + } +})); +Object.defineProperty(exports, "isUnionType", ({ + enumerable: true, + get: function get() { + return _index.isUnionType; + } +})); +Object.defineProperty(exports, "isEnumType", ({ + enumerable: true, + get: function get() { + return _index.isEnumType; + } +})); +Object.defineProperty(exports, "isInputObjectType", ({ + enumerable: true, + get: function get() { + return _index.isInputObjectType; + } +})); +Object.defineProperty(exports, "isListType", ({ + enumerable: true, + get: function get() { + return _index.isListType; + } +})); +Object.defineProperty(exports, "isNonNullType", ({ + enumerable: true, + get: function get() { + return _index.isNonNullType; + } +})); +Object.defineProperty(exports, "isInputType", ({ + enumerable: true, + get: function get() { + return _index.isInputType; + } +})); +Object.defineProperty(exports, "isOutputType", ({ + enumerable: true, + get: function get() { + return _index.isOutputType; + } +})); +Object.defineProperty(exports, "isLeafType", ({ + enumerable: true, + get: function get() { + return _index.isLeafType; + } +})); +Object.defineProperty(exports, "isCompositeType", ({ + enumerable: true, + get: function get() { + return _index.isCompositeType; + } +})); +Object.defineProperty(exports, "isAbstractType", ({ + enumerable: true, + get: function get() { + return _index.isAbstractType; + } +})); +Object.defineProperty(exports, "isWrappingType", ({ + enumerable: true, + get: function get() { + return _index.isWrappingType; + } +})); +Object.defineProperty(exports, "isNullableType", ({ + enumerable: true, + get: function get() { + return _index.isNullableType; + } +})); +Object.defineProperty(exports, "isNamedType", ({ + enumerable: true, + get: function get() { + return _index.isNamedType; + } +})); +Object.defineProperty(exports, "isRequiredArgument", ({ + enumerable: true, + get: function get() { + return _index.isRequiredArgument; + } +})); +Object.defineProperty(exports, "isRequiredInputField", ({ + enumerable: true, + get: function get() { + return _index.isRequiredInputField; + } +})); +Object.defineProperty(exports, "isSpecifiedScalarType", ({ + enumerable: true, + get: function get() { + return _index.isSpecifiedScalarType; + } +})); +Object.defineProperty(exports, "isIntrospectionType", ({ + enumerable: true, + get: function get() { + return _index.isIntrospectionType; + } +})); +Object.defineProperty(exports, "isSpecifiedDirective", ({ + enumerable: true, + get: function get() { + return _index.isSpecifiedDirective; + } +})); +Object.defineProperty(exports, "assertSchema", ({ + enumerable: true, + get: function get() { + return _index.assertSchema; + } +})); +Object.defineProperty(exports, "assertDirective", ({ + enumerable: true, + get: function get() { + return _index.assertDirective; + } +})); +Object.defineProperty(exports, "assertType", ({ + enumerable: true, + get: function get() { + return _index.assertType; + } +})); +Object.defineProperty(exports, "assertScalarType", ({ + enumerable: true, + get: function get() { + return _index.assertScalarType; + } +})); +Object.defineProperty(exports, "assertObjectType", ({ + enumerable: true, + get: function get() { + return _index.assertObjectType; + } +})); +Object.defineProperty(exports, "assertInterfaceType", ({ + enumerable: true, + get: function get() { + return _index.assertInterfaceType; + } +})); +Object.defineProperty(exports, "assertUnionType", ({ + enumerable: true, + get: function get() { + return _index.assertUnionType; + } +})); +Object.defineProperty(exports, "assertEnumType", ({ + enumerable: true, + get: function get() { + return _index.assertEnumType; + } +})); +Object.defineProperty(exports, "assertInputObjectType", ({ + enumerable: true, + get: function get() { + return _index.assertInputObjectType; + } +})); +Object.defineProperty(exports, "assertListType", ({ + enumerable: true, + get: function get() { + return _index.assertListType; + } +})); +Object.defineProperty(exports, "assertNonNullType", ({ + enumerable: true, + get: function get() { + return _index.assertNonNullType; + } +})); +Object.defineProperty(exports, "assertInputType", ({ + enumerable: true, + get: function get() { + return _index.assertInputType; + } +})); +Object.defineProperty(exports, "assertOutputType", ({ + enumerable: true, + get: function get() { + return _index.assertOutputType; + } +})); +Object.defineProperty(exports, "assertLeafType", ({ + enumerable: true, + get: function get() { + return _index.assertLeafType; + } +})); +Object.defineProperty(exports, "assertCompositeType", ({ + enumerable: true, + get: function get() { + return _index.assertCompositeType; + } +})); +Object.defineProperty(exports, "assertAbstractType", ({ + enumerable: true, + get: function get() { + return _index.assertAbstractType; + } +})); +Object.defineProperty(exports, "assertWrappingType", ({ + enumerable: true, + get: function get() { + return _index.assertWrappingType; + } +})); +Object.defineProperty(exports, "assertNullableType", ({ + enumerable: true, + get: function get() { + return _index.assertNullableType; + } +})); +Object.defineProperty(exports, "assertNamedType", ({ + enumerable: true, + get: function get() { + return _index.assertNamedType; + } +})); +Object.defineProperty(exports, "getNullableType", ({ + enumerable: true, + get: function get() { + return _index.getNullableType; + } +})); +Object.defineProperty(exports, "getNamedType", ({ + enumerable: true, + get: function get() { + return _index.getNamedType; + } +})); +Object.defineProperty(exports, "validateSchema", ({ + enumerable: true, + get: function get() { + return _index.validateSchema; + } +})); +Object.defineProperty(exports, "assertValidSchema", ({ + enumerable: true, + get: function get() { + return _index.assertValidSchema; + } +})); +Object.defineProperty(exports, "Token", ({ + enumerable: true, + get: function get() { + return _index2.Token; + } +})); +Object.defineProperty(exports, "Source", ({ + enumerable: true, + get: function get() { + return _index2.Source; + } +})); +Object.defineProperty(exports, "Location", ({ + enumerable: true, + get: function get() { + return _index2.Location; + } +})); +Object.defineProperty(exports, "getLocation", ({ + enumerable: true, + get: function get() { + return _index2.getLocation; + } +})); +Object.defineProperty(exports, "printLocation", ({ + enumerable: true, + get: function get() { + return _index2.printLocation; + } +})); +Object.defineProperty(exports, "printSourceLocation", ({ + enumerable: true, + get: function get() { + return _index2.printSourceLocation; + } +})); +Object.defineProperty(exports, "Lexer", ({ + enumerable: true, + get: function get() { + return _index2.Lexer; + } +})); +Object.defineProperty(exports, "TokenKind", ({ + enumerable: true, + get: function get() { + return _index2.TokenKind; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function get() { + return _index2.parse; + } +})); +Object.defineProperty(exports, "parseValue", ({ + enumerable: true, + get: function get() { + return _index2.parseValue; + } +})); +Object.defineProperty(exports, "parseType", ({ + enumerable: true, + get: function get() { + return _index2.parseType; + } +})); +Object.defineProperty(exports, "print", ({ + enumerable: true, + get: function get() { + return _index2.print; + } +})); +Object.defineProperty(exports, "visit", ({ + enumerable: true, + get: function get() { + return _index2.visit; + } +})); +Object.defineProperty(exports, "visitInParallel", ({ + enumerable: true, + get: function get() { + return _index2.visitInParallel; + } +})); +Object.defineProperty(exports, "getVisitFn", ({ + enumerable: true, + get: function get() { + return _index2.getVisitFn; + } +})); +Object.defineProperty(exports, "BREAK", ({ + enumerable: true, + get: function get() { + return _index2.BREAK; + } +})); +Object.defineProperty(exports, "Kind", ({ + enumerable: true, + get: function get() { + return _index2.Kind; + } +})); +Object.defineProperty(exports, "DirectiveLocation", ({ + enumerable: true, + get: function get() { + return _index2.DirectiveLocation; + } +})); +Object.defineProperty(exports, "isDefinitionNode", ({ + enumerable: true, + get: function get() { + return _index2.isDefinitionNode; + } +})); +Object.defineProperty(exports, "isExecutableDefinitionNode", ({ + enumerable: true, + get: function get() { + return _index2.isExecutableDefinitionNode; + } +})); +Object.defineProperty(exports, "isSelectionNode", ({ + enumerable: true, + get: function get() { + return _index2.isSelectionNode; + } +})); +Object.defineProperty(exports, "isValueNode", ({ + enumerable: true, + get: function get() { + return _index2.isValueNode; + } +})); +Object.defineProperty(exports, "isTypeNode", ({ + enumerable: true, + get: function get() { + return _index2.isTypeNode; + } +})); +Object.defineProperty(exports, "isTypeSystemDefinitionNode", ({ + enumerable: true, + get: function get() { + return _index2.isTypeSystemDefinitionNode; + } +})); +Object.defineProperty(exports, "isTypeDefinitionNode", ({ + enumerable: true, + get: function get() { + return _index2.isTypeDefinitionNode; + } +})); +Object.defineProperty(exports, "isTypeSystemExtensionNode", ({ + enumerable: true, + get: function get() { + return _index2.isTypeSystemExtensionNode; + } +})); +Object.defineProperty(exports, "isTypeExtensionNode", ({ + enumerable: true, + get: function get() { + return _index2.isTypeExtensionNode; + } +})); +Object.defineProperty(exports, "execute", ({ + enumerable: true, + get: function get() { + return _index3.execute; + } +})); +Object.defineProperty(exports, "executeSync", ({ + enumerable: true, + get: function get() { + return _index3.executeSync; + } +})); +Object.defineProperty(exports, "defaultFieldResolver", ({ + enumerable: true, + get: function get() { + return _index3.defaultFieldResolver; + } +})); +Object.defineProperty(exports, "defaultTypeResolver", ({ + enumerable: true, + get: function get() { + return _index3.defaultTypeResolver; + } +})); +Object.defineProperty(exports, "responsePathAsArray", ({ + enumerable: true, + get: function get() { + return _index3.responsePathAsArray; + } +})); +Object.defineProperty(exports, "getDirectiveValues", ({ + enumerable: true, + get: function get() { + return _index3.getDirectiveValues; + } +})); +Object.defineProperty(exports, "subscribe", ({ + enumerable: true, + get: function get() { + return _index4.subscribe; + } +})); +Object.defineProperty(exports, "createSourceEventStream", ({ + enumerable: true, + get: function get() { + return _index4.createSourceEventStream; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function get() { + return _index5.validate; + } +})); +Object.defineProperty(exports, "ValidationContext", ({ + enumerable: true, + get: function get() { + return _index5.ValidationContext; + } +})); +Object.defineProperty(exports, "specifiedRules", ({ + enumerable: true, + get: function get() { + return _index5.specifiedRules; + } +})); +Object.defineProperty(exports, "ExecutableDefinitionsRule", ({ + enumerable: true, + get: function get() { + return _index5.ExecutableDefinitionsRule; + } +})); +Object.defineProperty(exports, "FieldsOnCorrectTypeRule", ({ + enumerable: true, + get: function get() { + return _index5.FieldsOnCorrectTypeRule; + } +})); +Object.defineProperty(exports, "FragmentsOnCompositeTypesRule", ({ + enumerable: true, + get: function get() { + return _index5.FragmentsOnCompositeTypesRule; + } +})); +Object.defineProperty(exports, "KnownArgumentNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.KnownArgumentNamesRule; + } +})); +Object.defineProperty(exports, "KnownDirectivesRule", ({ + enumerable: true, + get: function get() { + return _index5.KnownDirectivesRule; + } +})); +Object.defineProperty(exports, "KnownFragmentNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.KnownFragmentNamesRule; + } +})); +Object.defineProperty(exports, "KnownTypeNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.KnownTypeNamesRule; + } +})); +Object.defineProperty(exports, "LoneAnonymousOperationRule", ({ + enumerable: true, + get: function get() { + return _index5.LoneAnonymousOperationRule; + } +})); +Object.defineProperty(exports, "NoFragmentCyclesRule", ({ + enumerable: true, + get: function get() { + return _index5.NoFragmentCyclesRule; + } +})); +Object.defineProperty(exports, "NoUndefinedVariablesRule", ({ + enumerable: true, + get: function get() { + return _index5.NoUndefinedVariablesRule; + } +})); +Object.defineProperty(exports, "NoUnusedFragmentsRule", ({ + enumerable: true, + get: function get() { + return _index5.NoUnusedFragmentsRule; + } +})); +Object.defineProperty(exports, "NoUnusedVariablesRule", ({ + enumerable: true, + get: function get() { + return _index5.NoUnusedVariablesRule; + } +})); +Object.defineProperty(exports, "OverlappingFieldsCanBeMergedRule", ({ + enumerable: true, + get: function get() { + return _index5.OverlappingFieldsCanBeMergedRule; + } +})); +Object.defineProperty(exports, "PossibleFragmentSpreadsRule", ({ + enumerable: true, + get: function get() { + return _index5.PossibleFragmentSpreadsRule; + } +})); +Object.defineProperty(exports, "ProvidedRequiredArgumentsRule", ({ + enumerable: true, + get: function get() { + return _index5.ProvidedRequiredArgumentsRule; + } +})); +Object.defineProperty(exports, "ScalarLeafsRule", ({ + enumerable: true, + get: function get() { + return _index5.ScalarLeafsRule; + } +})); +Object.defineProperty(exports, "SingleFieldSubscriptionsRule", ({ + enumerable: true, + get: function get() { + return _index5.SingleFieldSubscriptionsRule; + } +})); +Object.defineProperty(exports, "UniqueArgumentNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueArgumentNamesRule; + } +})); +Object.defineProperty(exports, "UniqueDirectivesPerLocationRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueDirectivesPerLocationRule; + } +})); +Object.defineProperty(exports, "UniqueFragmentNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueFragmentNamesRule; + } +})); +Object.defineProperty(exports, "UniqueInputFieldNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueInputFieldNamesRule; + } +})); +Object.defineProperty(exports, "UniqueOperationNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueOperationNamesRule; + } +})); +Object.defineProperty(exports, "UniqueVariableNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueVariableNamesRule; + } +})); +Object.defineProperty(exports, "ValuesOfCorrectTypeRule", ({ + enumerable: true, + get: function get() { + return _index5.ValuesOfCorrectTypeRule; + } +})); +Object.defineProperty(exports, "VariablesAreInputTypesRule", ({ + enumerable: true, + get: function get() { + return _index5.VariablesAreInputTypesRule; + } +})); +Object.defineProperty(exports, "VariablesInAllowedPositionRule", ({ + enumerable: true, + get: function get() { + return _index5.VariablesInAllowedPositionRule; + } +})); +Object.defineProperty(exports, "LoneSchemaDefinitionRule", ({ + enumerable: true, + get: function get() { + return _index5.LoneSchemaDefinitionRule; + } +})); +Object.defineProperty(exports, "UniqueOperationTypesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueOperationTypesRule; + } +})); +Object.defineProperty(exports, "UniqueTypeNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueTypeNamesRule; + } +})); +Object.defineProperty(exports, "UniqueEnumValueNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueEnumValueNamesRule; + } +})); +Object.defineProperty(exports, "UniqueFieldDefinitionNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueFieldDefinitionNamesRule; + } +})); +Object.defineProperty(exports, "UniqueDirectiveNamesRule", ({ + enumerable: true, + get: function get() { + return _index5.UniqueDirectiveNamesRule; + } +})); +Object.defineProperty(exports, "PossibleTypeExtensionsRule", ({ + enumerable: true, + get: function get() { + return _index5.PossibleTypeExtensionsRule; + } +})); +Object.defineProperty(exports, "NoDeprecatedCustomRule", ({ + enumerable: true, + get: function get() { + return _index5.NoDeprecatedCustomRule; + } +})); +Object.defineProperty(exports, "NoSchemaIntrospectionCustomRule", ({ + enumerable: true, + get: function get() { + return _index5.NoSchemaIntrospectionCustomRule; + } +})); +Object.defineProperty(exports, "GraphQLError", ({ + enumerable: true, + get: function get() { + return _index6.GraphQLError; + } +})); +Object.defineProperty(exports, "syntaxError", ({ + enumerable: true, + get: function get() { + return _index6.syntaxError; + } +})); +Object.defineProperty(exports, "locatedError", ({ + enumerable: true, + get: function get() { + return _index6.locatedError; + } +})); +Object.defineProperty(exports, "printError", ({ + enumerable: true, + get: function get() { + return _index6.printError; + } +})); +Object.defineProperty(exports, "formatError", ({ + enumerable: true, + get: function get() { + return _index6.formatError; + } +})); +Object.defineProperty(exports, "getIntrospectionQuery", ({ + enumerable: true, + get: function get() { + return _index7.getIntrospectionQuery; + } +})); +Object.defineProperty(exports, "getOperationAST", ({ + enumerable: true, + get: function get() { + return _index7.getOperationAST; + } +})); +Object.defineProperty(exports, "getOperationRootType", ({ + enumerable: true, + get: function get() { + return _index7.getOperationRootType; + } +})); +Object.defineProperty(exports, "introspectionFromSchema", ({ + enumerable: true, + get: function get() { + return _index7.introspectionFromSchema; + } +})); +Object.defineProperty(exports, "buildClientSchema", ({ + enumerable: true, + get: function get() { + return _index7.buildClientSchema; + } +})); +Object.defineProperty(exports, "buildASTSchema", ({ + enumerable: true, + get: function get() { + return _index7.buildASTSchema; + } +})); +Object.defineProperty(exports, "buildSchema", ({ + enumerable: true, + get: function get() { + return _index7.buildSchema; + } +})); +Object.defineProperty(exports, "getDescription", ({ + enumerable: true, + get: function get() { + return _index7.getDescription; + } +})); +Object.defineProperty(exports, "extendSchema", ({ + enumerable: true, + get: function get() { + return _index7.extendSchema; + } +})); +Object.defineProperty(exports, "lexicographicSortSchema", ({ + enumerable: true, + get: function get() { + return _index7.lexicographicSortSchema; + } +})); +Object.defineProperty(exports, "printSchema", ({ + enumerable: true, + get: function get() { + return _index7.printSchema; + } +})); +Object.defineProperty(exports, "printType", ({ + enumerable: true, + get: function get() { + return _index7.printType; + } +})); +Object.defineProperty(exports, "printIntrospectionSchema", ({ + enumerable: true, + get: function get() { + return _index7.printIntrospectionSchema; + } +})); +Object.defineProperty(exports, "typeFromAST", ({ + enumerable: true, + get: function get() { + return _index7.typeFromAST; + } +})); +Object.defineProperty(exports, "valueFromAST", ({ + enumerable: true, + get: function get() { + return _index7.valueFromAST; + } +})); +Object.defineProperty(exports, "valueFromASTUntyped", ({ + enumerable: true, + get: function get() { + return _index7.valueFromASTUntyped; + } +})); +Object.defineProperty(exports, "astFromValue", ({ + enumerable: true, + get: function get() { + return _index7.astFromValue; + } +})); +Object.defineProperty(exports, "TypeInfo", ({ + enumerable: true, + get: function get() { + return _index7.TypeInfo; + } +})); +Object.defineProperty(exports, "visitWithTypeInfo", ({ + enumerable: true, + get: function get() { + return _index7.visitWithTypeInfo; + } +})); +Object.defineProperty(exports, "coerceInputValue", ({ + enumerable: true, + get: function get() { + return _index7.coerceInputValue; + } +})); +Object.defineProperty(exports, "concatAST", ({ + enumerable: true, + get: function get() { + return _index7.concatAST; + } +})); +Object.defineProperty(exports, "separateOperations", ({ + enumerable: true, + get: function get() { + return _index7.separateOperations; + } +})); +Object.defineProperty(exports, "stripIgnoredCharacters", ({ + enumerable: true, + get: function get() { + return _index7.stripIgnoredCharacters; + } +})); +Object.defineProperty(exports, "isEqualType", ({ + enumerable: true, + get: function get() { + return _index7.isEqualType; + } +})); +Object.defineProperty(exports, "isTypeSubTypeOf", ({ + enumerable: true, + get: function get() { + return _index7.isTypeSubTypeOf; + } +})); +Object.defineProperty(exports, "doTypesOverlap", ({ + enumerable: true, + get: function get() { + return _index7.doTypesOverlap; + } +})); +Object.defineProperty(exports, "assertValidName", ({ + enumerable: true, + get: function get() { + return _index7.assertValidName; + } +})); +Object.defineProperty(exports, "isValidNameError", ({ + enumerable: true, + get: function get() { + return _index7.isValidNameError; + } +})); +Object.defineProperty(exports, "BreakingChangeType", ({ + enumerable: true, + get: function get() { + return _index7.BreakingChangeType; + } +})); +Object.defineProperty(exports, "DangerousChangeType", ({ + enumerable: true, + get: function get() { + return _index7.DangerousChangeType; + } +})); +Object.defineProperty(exports, "findBreakingChanges", ({ + enumerable: true, + get: function get() { + return _index7.findBreakingChanges; + } +})); +Object.defineProperty(exports, "findDangerousChanges", ({ + enumerable: true, + get: function get() { + return _index7.findDangerousChanges; + } +})); +Object.defineProperty(exports, "findDeprecatedUsages", ({ + enumerable: true, + get: function get() { + return _index7.findDeprecatedUsages; + } +})); + +var _version = __nccwpck_require__(81923); + +var _graphql = __nccwpck_require__(64215); + +var _index = __nccwpck_require__(63280); + +var _index2 = __nccwpck_require__(89537); + +var _index3 = __nccwpck_require__(13176); + +var _index4 = __nccwpck_require__(17575); + +var _index5 = __nccwpck_require__(82201); + +var _index6 = __nccwpck_require__(50578); + +var _index7 = __nccwpck_require__(676); + + +/***/ }), + +/***/ 11262: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.addPath = addPath; +exports.pathToArray = pathToArray; + +/** + * Given a Path and a key, return a new Path containing the new key. + */ +function addPath(prev, key, typename) { + return { + prev: prev, + key: key, + typename: typename + }; +} +/** + * Given a Path, return an Array of the path keys. + */ + + +function pathToArray(path) { + var flattened = []; + var curr = path; + + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + + return flattened.reverse(); +} + + +/***/ }), + +/***/ 73965: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = defineInspect; + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _nodejsCustomInspectSymbol = _interopRequireDefault(__nccwpck_require__(84755)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` + */ +function defineInspect(classObject) { + var fn = classObject.prototype.toJSON; + typeof fn === 'function' || (0, _invariant.default)(0); + classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') + + if (_nodejsCustomInspectSymbol.default) { + classObject.prototype[_nodejsCustomInspectSymbol.default] = fn; + } +} + + +/***/ }), + +/***/ 46514: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = devAssert; + +function devAssert(condition, message) { + var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') + + if (!booleanCondition) { + throw new Error(message); + } +} + + +/***/ }), + +/***/ 42878: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = didYouMean; +var MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + +// eslint-disable-next-line no-redeclare +function didYouMean(firstArg, secondArg) { + var _ref = typeof firstArg === 'string' ? [firstArg, secondArg] : [undefined, firstArg], + subMessage = _ref[0], + suggestionsArg = _ref[1]; + + var message = ' Did you mean '; + + if (subMessage) { + message += subMessage + ' '; + } + + var suggestions = suggestionsArg.map(function (x) { + return "\"".concat(x, "\""); + }); + + switch (suggestions.length) { + case 0: + return ''; + + case 1: + return message + suggestions[0] + '?'; + + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + var selected = suggestions.slice(0, MAX_SUGGESTIONS); + var lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} + + +/***/ }), + +/***/ 51188: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = identityFunc; + +/** + * Returns the first argument it receives. + */ +function identityFunc(x) { + return x; +} + + +/***/ }), + +/***/ 10102: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inspect; + +var _nodejsCustomInspectSymbol = _interopRequireDefault(__nccwpck_require__(84755)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var MAX_ARRAY_LENGTH = 10; +var MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (_typeof(value)) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? "[function ".concat(value.name, "]") : '[function]'; + + case 'object': + if (value === null) { + return 'null'; + } + + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (previouslySeenValues.indexOf(value) !== -1) { + return '[Circular]'; + } + + var seenValues = [].concat(previouslySeenValues, [value]); + var customInspectFn = getCustomFn(value); + + if (customInspectFn !== undefined) { + var customValue = customInspectFn.call(value); // check for infinite recursion + + if (customValue !== value) { + return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function formatObject(object, seenValues) { + var keys = Object.keys(object); + + if (keys.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + var properties = keys.map(function (key) { + var value = formatValue(object[key], seenValues); + return key + ': ' + value; + }); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + var len = Math.min(MAX_ARRAY_LENGTH, array.length); + var remaining = array.length - len; + var items = []; + + for (var i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push("... ".concat(remaining, " more items")); + } + + return '[' + items.join(', ') + ']'; +} + +function getCustomFn(object) { + var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; + + if (typeof customInspectFn === 'function') { + return customInspectFn; + } + + if (typeof object.inspect === 'function') { + return object.inspect; + } +} + +function getObjectTag(object) { + var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + var name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} + + +/***/ }), + +/***/ 93481: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + */ +// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production +// See: https://webpack.js.org/guides/production/ +var _default = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') +// eslint-disable-next-line no-shadow +function instanceOf(value, constructor) { + return value instanceof constructor; +} : // eslint-disable-next-line no-shadow +function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (value) { + var valueClass = value.constructor; + var className = constructor.name; + + if (className && valueClass && valueClass.name === className) { + throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.")); + } + } + + return false; +}; + +exports.default = _default; + + +/***/ }), + +/***/ 28847: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = invariant; + +function invariant(condition, message) { + var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') + + if (!booleanCondition) { + throw new Error(message != null ? message : 'Unexpected invariant triggered.'); + } +} + + +/***/ }), + +/***/ 20626: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isAsyncIterable; + +var _symbols = __nccwpck_require__(3255); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +// eslint-disable-next-line no-redeclare +function isAsyncIterable(maybeAsyncIterable) { + if (maybeAsyncIterable == null || _typeof(maybeAsyncIterable) !== 'object') { + return false; + } + + return typeof maybeAsyncIterable[_symbols.SYMBOL_ASYNC_ITERATOR] === 'function'; +} + + +/***/ }), + +/***/ 54363: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isCollection; + +var _symbols = __nccwpck_require__(3255); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and is either Iterable or Array-like. + * + * This may be used in place of [Array.isArray()][isArray] to determine if an + * object should be iterated-over. It always excludes string literals and + * includes Arrays (regardless of if it is Iterable). It also includes other + * Array-like objects such as NodeList, TypedArray, and Buffer. + * + * @example + * + * isCollection([ 1, 2, 3 ]) // true + * isCollection('ABC') // false + * isCollection({ length: 1, 0: 'Alpha' }) // true + * isCollection({ key: 'value' }) // false + * isCollection(new Map()) // true + * + * @param obj + * An Object value which might implement the Iterable or Array-like protocols. + * @return {boolean} true if Iterable or Array-like Object. + */ +function isCollection(obj) { + if (obj == null || _typeof(obj) !== 'object') { + return false; + } // Is Array like? + + + var length = obj.length; + + if (typeof length === 'number' && length >= 0 && length % 1 === 0) { + return true; + } // Is Iterable? + + + return typeof obj[_symbols.SYMBOL_ITERATOR] === 'function'; +} + + +/***/ }), + +/***/ 95865: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isObjectLike; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +function isObjectLike(value) { + return _typeof(value) == 'object' && value !== null; +} + + +/***/ }), + +/***/ 93910: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isPromise; + +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +// eslint-disable-next-line no-redeclare +function isPromise(value) { + return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; +} + + +/***/ }), + +/***/ 10711: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = keyMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } } + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { name: 'Jenny', num: '857-6309' } + * const jennyEntry = entriesByName['Jenny'] + * + */ +function keyMap(list, keyFn) { + return list.reduce(function (map, item) { + map[keyFn(item)] = item; + return map; + }, Object.create(null)); +} + + +/***/ }), + +/***/ 49268: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = keyValMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * + */ +function keyValMap(list, keyFn, valFn) { + return list.reduce(function (map, item) { + map[keyFn(item)] = valFn(item); + return map; + }, Object.create(null)); +} + + +/***/ }), + +/***/ 32223: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = mapValue; + +var _objectEntries3 = _interopRequireDefault(__nccwpck_require__(86422)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +function mapValue(map, fn) { + var result = Object.create(null); + + for (var _i2 = 0, _objectEntries2 = (0, _objectEntries3.default)(map); _i2 < _objectEntries2.length; _i2++) { + var _ref2 = _objectEntries2[_i2]; + var _key = _ref2[0]; + var _value = _ref2[1]; + result[_key] = fn(_value, _key); + } + + return result; +} + + +/***/ }), + +/***/ 64217: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = memoize3; + +/** + * Memoizes the provided three-argument function. + */ +function memoize3(fn) { + var cache0; + return function memoized(a1, a2, a3) { + if (!cache0) { + cache0 = new WeakMap(); + } + + var cache1 = cache0.get(a1); + var cache2; + + if (cache1) { + cache2 = cache1.get(a2); + + if (cache2) { + var cachedValue = cache2.get(a3); + + if (cachedValue !== undefined) { + return cachedValue; + } + } + } else { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + if (!cache2) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + var newValue = fn(a1, a2, a3); + cache2.set(a3, newValue); + return newValue; + }; +} + + +/***/ }), + +/***/ 84755: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') +var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; +var _default = nodejsCustomInspectSymbol; +exports.default = _default; + + +/***/ }), + +/***/ 94281: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = printPathArray; + +/** + * Build a string describing the path. + */ +function printPathArray(path) { + return path.map(function (key) { + return typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key; + }).join(''); +} + + +/***/ }), + +/***/ 46804: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = promiseForObject; + +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +function promiseForObject(object) { + var keys = Object.keys(object); + var valuesAndPromises = keys.map(function (name) { + return object[name]; + }); + return Promise.all(valuesAndPromises).then(function (values) { + return values.reduce(function (resolvedObject, value, i) { + resolvedObject[keys[i]] = value; + return resolvedObject; + }, Object.create(null)); + }); +} + + +/***/ }), + +/***/ 77286: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = promiseReduce; + +var _isPromise = _interopRequireDefault(__nccwpck_require__(93910)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +function promiseReduce(values, callback, initialValue) { + return values.reduce(function (previous, value) { + return (0, _isPromise.default)(previous) ? previous.then(function (resolved) { + return callback(resolved, value); + }) : callback(previous, value); + }, initialValue); +} + + +/***/ }), + +/***/ 57704: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = suggestionList; + +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +function suggestionList(input, options) { + var optionsByDistance = Object.create(null); + var lexicalDistance = new LexicalDistance(input); + var threshold = Math.floor(input.length * 0.4) + 1; + + for (var _i2 = 0; _i2 < options.length; _i2++) { + var option = options[_i2]; + var distance = lexicalDistance.measure(option, threshold); + + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort(function (a, b) { + var distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 ? distanceDiff : a.localeCompare(b); + }); +} +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ + + +var LexicalDistance = /*#__PURE__*/function () { + function LexicalDistance(input) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + this._rows = [new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0)]; + } + + var _proto = LexicalDistance.prototype; + + _proto.measure = function measure(option, threshold) { + if (this._input === option) { + return 0; + } + + var optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + var a = stringToArray(optionLowerCase); + var b = this._inputArray; + + if (a.length < b.length) { + var tmp = a; + a = b; + b = tmp; + } + + var aLength = a.length; + var bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + var rows = this._rows; + + for (var j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (var i = 1; i <= aLength; i++) { + var upRow = rows[(i - 1) % 3]; + var currentRow = rows[i % 3]; + var smallestCell = currentRow[0] = i; + + for (var _j = 1; _j <= bLength; _j++) { + var cost = a[i - 1] === b[_j - 1] ? 0 : 1; + var currentCell = Math.min(upRow[_j] + 1, // delete + currentRow[_j - 1] + 1, // insert + upRow[_j - 1] + cost // substitute + ); + + if (i > 1 && _j > 1 && a[i - 1] === b[_j - 2] && a[i - 2] === b[_j - 1]) { + // transposition + var doubleDiagonalCell = rows[(i - 2) % 3][_j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[_j] = currentCell; + } // Early exit, since distance can't go smaller than smallest element of the previous row. + + + if (smallestCell > threshold) { + return undefined; + } + } + + var distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + }; + + return LexicalDistance; +}(); + +function stringToArray(str) { + var strLength = str.length; + var array = new Array(strLength); + + for (var i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + + return array; +} + + +/***/ }), + +/***/ 74728: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toObjMap; + +var _objectEntries3 = _interopRequireDefault(__nccwpck_require__(86422)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toObjMap(obj) { + /* eslint-enable no-redeclare */ + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + var map = Object.create(null); + + for (var _i2 = 0, _objectEntries2 = (0, _objectEntries3.default)(obj); _i2 < _objectEntries2.length; _i2++) { + var _ref2 = _objectEntries2[_i2]; + var key = _ref2[0]; + var value = _ref2[1]; + map[key] = value; + } + + return map; +} + + +/***/ }), + +/***/ 45494: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isNode = isNode; +exports.Token = exports.Location = void 0; + +var _defineInspect = _interopRequireDefault(__nccwpck_require__(73965)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +var Location = /*#__PURE__*/function () { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + function Location(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + var _proto = Location.prototype; + + _proto.toJSON = function toJSON() { + return { + start: this.start, + end: this.end + }; + }; + + return Location; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.Location = Location; +(0, _defineInspect.default)(Location); +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +var Token = /*#__PURE__*/function () { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + function Token(kind, start, end, line, column, prev, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; + this.value = value; + this.prev = prev; + this.next = null; + } + + var _proto2 = Token.prototype; + + _proto2.toJSON = function toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column + }; + }; + + return Token; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.Token = Token; +(0, _defineInspect.default)(Token); +/** + * @internal + */ + +function isNode(maybeNode) { + return maybeNode != null && typeof maybeNode.kind === 'string'; +} +/** + * The list of all possible AST node types. + */ + + +/***/ }), + +/***/ 4515: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.dedentBlockStringValue = dedentBlockStringValue; +exports.getBlockStringIndentation = getBlockStringIndentation; +exports.printBlockString = printBlockString; + +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +function dedentBlockStringValue(rawString) { + // Expand a block string's raw value into independent lines. + var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. + + var commonIndent = getBlockStringIndentation(rawString); + + if (commonIndent !== 0) { + for (var i = 1; i < lines.length; i++) { + lines[i] = lines[i].slice(commonIndent); + } + } // Remove leading and trailing blank lines. + + + var startLine = 0; + + while (startLine < lines.length && isBlank(lines[startLine])) { + ++startLine; + } + + var endLine = lines.length; + + while (endLine > startLine && isBlank(lines[endLine - 1])) { + --endLine; + } // Return a string of the lines joined with U+000A. + + + return lines.slice(startLine, endLine).join('\n'); +} + +function isBlank(str) { + for (var i = 0; i < str.length; ++i) { + if (str[i] !== ' ' && str[i] !== '\t') { + return false; + } + } + + return true; +} +/** + * @internal + */ + + +function getBlockStringIndentation(value) { + var _commonIndent; + + var isFirstLine = true; + var isEmptyLine = true; + var indent = 0; + var commonIndent = null; + + for (var i = 0; i < value.length; ++i) { + switch (value.charCodeAt(i)) { + case 13: + // \r + if (value.charCodeAt(i + 1) === 10) { + ++i; // skip \r\n as one symbol + } + + // falls through + + case 10: + // \n + isFirstLine = false; + isEmptyLine = true; + indent = 0; + break; + + case 9: // \t + + case 32: + // + ++indent; + break; + + default: + if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { + commonIndent = indent; + } + + isEmptyLine = false; + } + } + + return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + + +function printBlockString(value) { + var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var isSingleLine = value.indexOf('\n') === -1; + var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; + var hasTrailingQuote = value[value.length - 1] === '"'; + var hasTrailingSlash = value[value.length - 1] === '\\'; + var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; + var result = ''; // Format a multi-line block quote to account for leading space. + + if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { + result += '\n' + indentation; + } + + result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; + + if (printAsMultipleLines) { + result += '\n'; + } + + return '"""' + result.replace(/"""/g, '\\"""') + '"""'; +} + + +/***/ }), + +/***/ 81205: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.DirectiveLocation = void 0; + +/** + * The set of allowed directive location values. + */ +var DirectiveLocation = Object.freeze({ + // Request Definitions + QUERY: 'QUERY', + MUTATION: 'MUTATION', + SUBSCRIPTION: 'SUBSCRIPTION', + FIELD: 'FIELD', + FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', + FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', + INLINE_FRAGMENT: 'INLINE_FRAGMENT', + VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', + // Type System Definitions + SCHEMA: 'SCHEMA', + SCALAR: 'SCALAR', + OBJECT: 'OBJECT', + FIELD_DEFINITION: 'FIELD_DEFINITION', + ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', + INTERFACE: 'INTERFACE', + UNION: 'UNION', + ENUM: 'ENUM', + ENUM_VALUE: 'ENUM_VALUE', + INPUT_OBJECT: 'INPUT_OBJECT', + INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' +}); +/** + * The enum type representing the directive location values. + */ + +exports.DirectiveLocation = DirectiveLocation; + + +/***/ }), + +/***/ 89537: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "Source", ({ + enumerable: true, + get: function get() { + return _source.Source; + } +})); +Object.defineProperty(exports, "getLocation", ({ + enumerable: true, + get: function get() { + return _location.getLocation; + } +})); +Object.defineProperty(exports, "printLocation", ({ + enumerable: true, + get: function get() { + return _printLocation.printLocation; + } +})); +Object.defineProperty(exports, "printSourceLocation", ({ + enumerable: true, + get: function get() { + return _printLocation.printSourceLocation; + } +})); +Object.defineProperty(exports, "Kind", ({ + enumerable: true, + get: function get() { + return _kinds.Kind; + } +})); +Object.defineProperty(exports, "TokenKind", ({ + enumerable: true, + get: function get() { + return _tokenKind.TokenKind; + } +})); +Object.defineProperty(exports, "Lexer", ({ + enumerable: true, + get: function get() { + return _lexer.Lexer; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function get() { + return _parser.parse; + } +})); +Object.defineProperty(exports, "parseValue", ({ + enumerable: true, + get: function get() { + return _parser.parseValue; + } +})); +Object.defineProperty(exports, "parseType", ({ + enumerable: true, + get: function get() { + return _parser.parseType; + } +})); +Object.defineProperty(exports, "print", ({ + enumerable: true, + get: function get() { + return _printer.print; + } +})); +Object.defineProperty(exports, "visit", ({ + enumerable: true, + get: function get() { + return _visitor.visit; + } +})); +Object.defineProperty(exports, "visitInParallel", ({ + enumerable: true, + get: function get() { + return _visitor.visitInParallel; + } +})); +Object.defineProperty(exports, "getVisitFn", ({ + enumerable: true, + get: function get() { + return _visitor.getVisitFn; + } +})); +Object.defineProperty(exports, "BREAK", ({ + enumerable: true, + get: function get() { + return _visitor.BREAK; + } +})); +Object.defineProperty(exports, "Location", ({ + enumerable: true, + get: function get() { + return _ast.Location; + } +})); +Object.defineProperty(exports, "Token", ({ + enumerable: true, + get: function get() { + return _ast.Token; + } +})); +Object.defineProperty(exports, "isDefinitionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isDefinitionNode; + } +})); +Object.defineProperty(exports, "isExecutableDefinitionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isExecutableDefinitionNode; + } +})); +Object.defineProperty(exports, "isSelectionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isSelectionNode; + } +})); +Object.defineProperty(exports, "isValueNode", ({ + enumerable: true, + get: function get() { + return _predicates.isValueNode; + } +})); +Object.defineProperty(exports, "isTypeNode", ({ + enumerable: true, + get: function get() { + return _predicates.isTypeNode; + } +})); +Object.defineProperty(exports, "isTypeSystemDefinitionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isTypeSystemDefinitionNode; + } +})); +Object.defineProperty(exports, "isTypeDefinitionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isTypeDefinitionNode; + } +})); +Object.defineProperty(exports, "isTypeSystemExtensionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isTypeSystemExtensionNode; + } +})); +Object.defineProperty(exports, "isTypeExtensionNode", ({ + enumerable: true, + get: function get() { + return _predicates.isTypeExtensionNode; + } +})); +Object.defineProperty(exports, "DirectiveLocation", ({ + enumerable: true, + get: function get() { + return _directiveLocation.DirectiveLocation; + } +})); + +var _source = __nccwpck_require__(65521); + +var _location = __nccwpck_require__(61922); + +var _printLocation = __nccwpck_require__(35250); + +var _kinds = __nccwpck_require__(11927); + +var _tokenKind = __nccwpck_require__(91565); + +var _lexer = __nccwpck_require__(24605); + +var _parser = __nccwpck_require__(50655); + +var _printer = __nccwpck_require__(68203); + +var _visitor = __nccwpck_require__(5678); + +var _ast = __nccwpck_require__(45494); + +var _predicates = __nccwpck_require__(20535); + +var _directiveLocation = __nccwpck_require__(81205); + + +/***/ }), + +/***/ 11927: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.Kind = void 0; + +/** + * The set of allowed kind values for AST nodes. + */ +var Kind = Object.freeze({ + // Name + NAME: 'Name', + // Document + DOCUMENT: 'Document', + OPERATION_DEFINITION: 'OperationDefinition', + VARIABLE_DEFINITION: 'VariableDefinition', + SELECTION_SET: 'SelectionSet', + FIELD: 'Field', + ARGUMENT: 'Argument', + // Fragments + FRAGMENT_SPREAD: 'FragmentSpread', + INLINE_FRAGMENT: 'InlineFragment', + FRAGMENT_DEFINITION: 'FragmentDefinition', + // Values + VARIABLE: 'Variable', + INT: 'IntValue', + FLOAT: 'FloatValue', + STRING: 'StringValue', + BOOLEAN: 'BooleanValue', + NULL: 'NullValue', + ENUM: 'EnumValue', + LIST: 'ListValue', + OBJECT: 'ObjectValue', + OBJECT_FIELD: 'ObjectField', + // Directives + DIRECTIVE: 'Directive', + // Types + NAMED_TYPE: 'NamedType', + LIST_TYPE: 'ListType', + NON_NULL_TYPE: 'NonNullType', + // Type System Definitions + SCHEMA_DEFINITION: 'SchemaDefinition', + OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', + // Type Definitions + SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', + OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', + FIELD_DEFINITION: 'FieldDefinition', + INPUT_VALUE_DEFINITION: 'InputValueDefinition', + INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', + UNION_TYPE_DEFINITION: 'UnionTypeDefinition', + ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', + ENUM_VALUE_DEFINITION: 'EnumValueDefinition', + INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', + // Directive Definitions + DIRECTIVE_DEFINITION: 'DirectiveDefinition', + // Type System Extensions + SCHEMA_EXTENSION: 'SchemaExtension', + // Type Extensions + SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', + OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', + INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', + UNION_TYPE_EXTENSION: 'UnionTypeExtension', + ENUM_TYPE_EXTENSION: 'EnumTypeExtension', + INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' +}); +/** + * The enum type representing the possible kind values of AST nodes. + */ + +exports.Kind = Kind; + + +/***/ }), + +/***/ 24605: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isPunctuatorTokenKind = isPunctuatorTokenKind; +exports.Lexer = void 0; + +var _syntaxError = __nccwpck_require__(52295); + +var _ast = __nccwpck_require__(45494); + +var _tokenKind = __nccwpck_require__(91565); + +var _blockString = __nccwpck_require__(4515); + +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +var Lexer = /*#__PURE__*/function () { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + function Lexer(source) { + var startOfFileToken = new _ast.Token(_tokenKind.TokenKind.SOF, 0, 0, 0, 0, null); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + + var _proto = Lexer.prototype; + + _proto.advance = function advance() { + this.lastToken = this.token; + var token = this.token = this.lookahead(); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + ; + + _proto.lookahead = function lookahead() { + var token = this.token; + + if (token.kind !== _tokenKind.TokenKind.EOF) { + do { + var _token$next; + + // Note: next is only mutable during parsing, so we cast to allow this. + token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token); + } while (token.kind === _tokenKind.TokenKind.COMMENT); + } + + return token; + }; + + return Lexer; +}(); +/** + * @internal + */ + + +exports.Lexer = Lexer; + +function isPunctuatorTokenKind(kind) { + return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; +} + +function printCharCode(code) { + return (// NaN/undefined represents access beyond the end of the file. + isNaN(code) ? _tokenKind.TokenKind.EOF : // Trust JSON for ASCII. + code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. + "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") + ); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + + +function readToken(lexer, prev) { + var source = lexer.source; + var body = source.body; + var bodyLength = body.length; + var pos = prev.end; + + while (pos < bodyLength) { + var code = body.charCodeAt(pos); + var _line = lexer.line; + + var _col = 1 + pos - lexer.lineStart; // SourceCharacter + + + switch (code) { + case 0xfeff: // + + case 9: // \t + + case 32: // + + case 44: + // , + ++pos; + continue; + + case 10: + // \n + ++pos; + ++lexer.line; + lexer.lineStart = pos; + continue; + + case 13: + // \r + if (body.charCodeAt(pos + 1) === 10) { + pos += 2; + } else { + ++pos; + } + + ++lexer.line; + lexer.lineStart = pos; + continue; + + case 33: + // ! + return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, _line, _col, prev); + + case 35: + // # + return readComment(source, pos, _line, _col, prev); + + case 36: + // $ + return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev); + + case 38: + // & + return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, _line, _col, prev); + + case 40: + // ( + return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev); + + case 41: + // ) + return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev); + + case 46: + // . + if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { + return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev); + } + + break; + + case 58: + // : + return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, _line, _col, prev); + + case 61: + // = + return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev); + + case 64: + // @ + return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, _line, _col, prev); + + case 91: + // [ + return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev); + + case 93: + // ] + return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev); + + case 123: + // { + return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev); + + case 124: + // | + return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, _line, _col, prev); + + case 125: + // } + return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev); + + case 34: + // " + if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { + return readBlockString(source, pos, _line, _col, prev, lexer); + } + + return readString(source, pos, _line, _col, prev); + + case 45: // - + + case 48: // 0 + + case 49: // 1 + + case 50: // 2 + + case 51: // 3 + + case 52: // 4 + + case 53: // 5 + + case 54: // 6 + + case 55: // 7 + + case 56: // 8 + + case 57: + // 9 + return readNumber(source, pos, code, _line, _col, prev); + + case 65: // A + + case 66: // B + + case 67: // C + + case 68: // D + + case 69: // E + + case 70: // F + + case 71: // G + + case 72: // H + + case 73: // I + + case 74: // J + + case 75: // K + + case 76: // L + + case 77: // M + + case 78: // N + + case 79: // O + + case 80: // P + + case 81: // Q + + case 82: // R + + case 83: // S + + case 84: // T + + case 85: // U + + case 86: // V + + case 87: // W + + case 88: // X + + case 89: // Y + + case 90: // Z + + case 95: // _ + + case 97: // a + + case 98: // b + + case 99: // c + + case 100: // d + + case 101: // e + + case 102: // f + + case 103: // g + + case 104: // h + + case 105: // i + + case 106: // j + + case 107: // k + + case 108: // l + + case 109: // m + + case 110: // n + + case 111: // o + + case 112: // p + + case 113: // q + + case 114: // r + + case 115: // s + + case 116: // t + + case 117: // u + + case 118: // v + + case 119: // w + + case 120: // x + + case 121: // y + + case 122: + // z + return readName(source, pos, _line, _col, prev); + } + + throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code)); + } + + var line = lexer.line; + var col = 1 + pos - lexer.lineStart; + return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev); +} +/** + * Report a message that an unexpected character was encountered. + */ + + +function unexpectedCharacterMessage(code) { + if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { + return "Cannot contain the invalid character ".concat(printCharCode(code), "."); + } + + if (code === 39) { + // ' + return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; + } + + return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); +} +/** + * Reads a comment token from the source file. + * + * #[\u0009\u0020-\uFFFF]* + */ + + +function readComment(source, start, line, col, prev) { + var body = source.body; + var code; + var position = start; + + do { + code = body.charCodeAt(++position); + } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator + code > 0x001f || code === 0x0009)); + + return new _ast.Token(_tokenKind.TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); +} +/** + * Reads a number token from the source file, either a float + * or an int depending on whether a decimal point appears. + * + * Int: -?(0|[1-9][0-9]*) + * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? + */ + + +function readNumber(source, start, firstCode, line, col, prev) { + var body = source.body; + var code = firstCode; + var position = start; + var isFloat = false; + + if (code === 45) { + // - + code = body.charCodeAt(++position); + } + + if (code === 48) { + // 0 + code = body.charCodeAt(++position); + + if (code >= 48 && code <= 57) { + throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); + } + } else { + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } + + if (code === 46) { + // . + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } + + if (code === 69 || code === 101) { + // E e + isFloat = true; + code = body.charCodeAt(++position); + + if (code === 43 || code === 45) { + // + - + code = body.charCodeAt(++position); + } + + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + + if (code === 46 || isNameStart(code)) { + throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); + } + + return new _ast.Token(isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); +} +/** + * Returns the new position in the source after reading digits. + */ + + +function readDigits(source, start, firstCode) { + var body = source.body; + var position = start; + var code = firstCode; + + if (code >= 48 && code <= 57) { + // 0 - 9 + do { + code = body.charCodeAt(++position); + } while (code >= 48 && code <= 57); // 0 - 9 + + + return position; + } + + throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); +} +/** + * Reads a string token from the source file. + * + * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" + */ + + +function readString(source, start, line, col, prev) { + var body = source.body; + var position = start + 1; + var chunkStart = position; + var code = 0; + var value = ''; + + while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator + code !== 0x000a && code !== 0x000d) { + // Closing Quote (") + if (code === 34) { + value += body.slice(chunkStart, position); + return new _ast.Token(_tokenKind.TokenKind.STRING, start, position + 1, line, col, prev, value); + } // SourceCharacter + + + if (code < 0x0020 && code !== 0x0009) { + throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); + } + + ++position; + + if (code === 92) { + // \ + value += body.slice(chunkStart, position - 1); + code = body.charCodeAt(position); + + switch (code) { + case 34: + value += '"'; + break; + + case 47: + value += '/'; + break; + + case 92: + value += '\\'; + break; + + case 98: + value += '\b'; + break; + + case 102: + value += '\f'; + break; + + case 110: + value += '\n'; + break; + + case 114: + value += '\r'; + break; + + case 116: + value += '\t'; + break; + + case 117: + { + // uXXXX + var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); + + if (charCode < 0) { + var invalidSequence = body.slice(position + 1, position + 5); + throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); + } + + value += String.fromCharCode(charCode); + position += 4; + break; + } + + default: + throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); + } + + ++position; + chunkStart = position; + } + } + + throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); +} +/** + * Reads a block string token from the source file. + * + * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" + */ + + +function readBlockString(source, start, line, col, prev, lexer) { + var body = source.body; + var position = start + 3; + var chunkStart = position; + var code = 0; + var rawValue = ''; + + while (position < body.length && !isNaN(code = body.charCodeAt(position))) { + // Closing Triple-Quote (""") + if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { + rawValue += body.slice(chunkStart, position); + return new _ast.Token(_tokenKind.TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, (0, _blockString.dedentBlockStringValue)(rawValue)); + } // SourceCharacter + + + if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { + throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); + } + + if (code === 10) { + // new line + ++position; + ++lexer.line; + lexer.lineStart = position; + } else if (code === 13) { + // carriage return + if (body.charCodeAt(position + 1) === 10) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + } else if ( // Escape Triple-Quote (\""") + code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { + rawValue += body.slice(chunkStart, position) + '"""'; + position += 4; + chunkStart = position; + } else { + ++position; + } + } + + throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); +} +/** + * Converts four hexadecimal chars to the integer that the + * string represents. For example, uniCharCode('0','0','0','f') + * will return 15, and uniCharCode('0','0','f','f') returns 255. + * + * Returns a negative number on error, if a char was invalid. + * + * This is implemented by noting that char2hex() returns -1 on error, + * which means the result of ORing the char2hex() will also be negative. + */ + + +function uniCharCode(a, b, c, d) { + return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); +} +/** + * Converts a hex character to its integer value. + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 on error. + */ + + +function char2hex(a) { + return a >= 48 && a <= 57 ? a - 48 // 0-9 + : a >= 65 && a <= 70 ? a - 55 // A-F + : a >= 97 && a <= 102 ? a - 87 // a-f + : -1; +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * [_A-Za-z][_0-9A-Za-z]* + */ + + +function readName(source, start, line, col, prev) { + var body = source.body; + var bodyLength = body.length; + var position = start + 1; + var code = 0; + + while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ + code >= 48 && code <= 57 || // 0-9 + code >= 65 && code <= 90 || // A-Z + code >= 97 && code <= 122) // a-z + ) { + ++position; + } + + return new _ast.Token(_tokenKind.TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); +} // _ A-Z a-z + + +function isNameStart(code) { + return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; +} + + +/***/ }), + +/***/ 61922: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getLocation = getLocation; + +/** + * Represents a location in a Source. + */ + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +function getLocation(source, position) { + var lineRegexp = /\r\n|[\n\r]/g; + var line = 1; + var column = position + 1; + var match; + + while ((match = lineRegexp.exec(source.body)) && match.index < position) { + line += 1; + column = position + 1 - (match.index + match[0].length); + } + + return { + line: line, + column: column + }; +} + + +/***/ }), + +/***/ 50655: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.parse = parse; +exports.parseValue = parseValue; +exports.parseType = parseType; +exports.Parser = void 0; + +var _syntaxError = __nccwpck_require__(52295); + +var _kinds = __nccwpck_require__(11927); + +var _ast = __nccwpck_require__(45494); + +var _tokenKind = __nccwpck_require__(91565); + +var _source = __nccwpck_require__(65521); + +var _directiveLocation = __nccwpck_require__(81205); + +var _lexer = __nccwpck_require__(24605); + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +function parse(source, options) { + var parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ + + +function parseValue(source, options) { + var parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + var value = parser.parseValueLiteral(false); + parser.expectToken(_tokenKind.TokenKind.EOF); + return value; +} +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ + + +function parseType(source, options) { + var parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + var type = parser.parseTypeReference(); + parser.expectToken(_tokenKind.TokenKind.EOF); + return type; +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + + +var Parser = /*#__PURE__*/function () { + function Parser(source, options) { + var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); + this._lexer = new _lexer.Lexer(sourceObj); + this._options = options; + } + /** + * Converts a name lex token into a name parse node. + */ + + + var _proto = Parser.prototype; + + _proto.parseName = function parseName() { + var token = this.expectToken(_tokenKind.TokenKind.NAME); + return { + kind: _kinds.Kind.NAME, + value: token.value, + loc: this.loc(token) + }; + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + ; + + _proto.parseDocument = function parseDocument() { + var start = this._lexer.token; + return { + kind: _kinds.Kind.DOCUMENT, + definitions: this.many(_tokenKind.TokenKind.SOF, this.parseDefinition, _tokenKind.TokenKind.EOF), + loc: this.loc(start) + }; + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + */ + ; + + _proto.parseDefinition = function parseDefinition() { + if (this.peek(_tokenKind.TokenKind.NAME)) { + switch (this._lexer.token.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'schema': + case 'scalar': + case 'type': + case 'interface': + case 'union': + case 'enum': + case 'input': + case 'directive': + return this.parseTypeSystemDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } else if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } else if (this.peekDescription()) { + return this.parseTypeSystemDefinition(); + } + + throw this.unexpected(); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + ; + + _proto.parseOperationDefinition = function parseOperationDefinition() { + var start = this._lexer.token; + + if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation: 'query', + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + + var operation = this.parseOperationType(); + var name; + + if (this.peek(_tokenKind.TokenKind.NAME)) { + name = this.parseName(); + } + + return { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation: operation, + name: name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * OperationType : one of query mutation subscription + */ + ; + + _proto.parseOperationType = function parseOperationType() { + var operationToken = this.expectToken(_tokenKind.TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return 'query'; + + case 'mutation': + return 'mutation'; + + case 'subscription': + return 'subscription'; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + ; + + _proto.parseVariableDefinitions = function parseVariableDefinitions() { + return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseVariableDefinition, _tokenKind.TokenKind.PAREN_R); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + ; + + _proto.parseVariableDefinition = function parseVariableDefinition() { + var start = this._lexer.token; + return { + kind: _kinds.Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseTypeReference()), + defaultValue: this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined, + directives: this.parseDirectives(true), + loc: this.loc(start) + }; + } + /** + * Variable : $ Name + */ + ; + + _proto.parseVariable = function parseVariable() { + var start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.DOLLAR); + return { + kind: _kinds.Kind.VARIABLE, + name: this.parseName(), + loc: this.loc(start) + }; + } + /** + * SelectionSet : { Selection+ } + */ + ; + + _proto.parseSelectionSet = function parseSelectionSet() { + var start = this._lexer.token; + return { + kind: _kinds.Kind.SELECTION_SET, + selections: this.many(_tokenKind.TokenKind.BRACE_L, this.parseSelection, _tokenKind.TokenKind.BRACE_R), + loc: this.loc(start) + }; + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + ; + + _proto.parseSelection = function parseSelection() { + return this.peek(_tokenKind.TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + ; + + _proto.parseField = function parseField() { + var start = this._lexer.token; + var nameOrAlias = this.parseName(); + var alias; + var name; + + if (this.expectOptionalToken(_tokenKind.TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return { + kind: _kinds.Kind.FIELD, + alias: alias, + name: name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined, + loc: this.loc(start) + }; + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + ; + + _proto.parseArguments = function parseArguments(isConst) { + var item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany(_tokenKind.TokenKind.PAREN_L, item, _tokenKind.TokenKind.PAREN_R); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + ; + + _proto.parseArgument = function parseArgument() { + var start = this._lexer.token; + var name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return { + kind: _kinds.Kind.ARGUMENT, + name: name, + value: this.parseValueLiteral(false), + loc: this.loc(start) + }; + }; + + _proto.parseConstArgument = function parseConstArgument() { + var start = this._lexer.token; + return { + kind: _kinds.Kind.ARGUMENT, + name: this.parseName(), + value: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseValueLiteral(true)), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + ; + + _proto.parseFragment = function parseFragment() { + var start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.SPREAD); + var hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(_tokenKind.TokenKind.NAME)) { + return { + kind: _kinds.Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + loc: this.loc(start) + }; + } + + return { + kind: _kinds.Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + ; + + _proto.parseFragmentDefinition = function parseFragmentDefinition() { + var _this$_options; + + var start = this._lexer.token; + this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) { + return { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + + return { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * FragmentName : Name but not `on` + */ + ; + + _proto.parseFragmentName = function parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + ; + + _proto.parseValueLiteral = function parseValueLiteral(isConst) { + var token = this._lexer.token; + + switch (token.kind) { + case _tokenKind.TokenKind.BRACKET_L: + return this.parseList(isConst); + + case _tokenKind.TokenKind.BRACE_L: + return this.parseObject(isConst); + + case _tokenKind.TokenKind.INT: + this._lexer.advance(); + + return { + kind: _kinds.Kind.INT, + value: token.value, + loc: this.loc(token) + }; + + case _tokenKind.TokenKind.FLOAT: + this._lexer.advance(); + + return { + kind: _kinds.Kind.FLOAT, + value: token.value, + loc: this.loc(token) + }; + + case _tokenKind.TokenKind.STRING: + case _tokenKind.TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case _tokenKind.TokenKind.NAME: + this._lexer.advance(); + + switch (token.value) { + case 'true': + return { + kind: _kinds.Kind.BOOLEAN, + value: true, + loc: this.loc(token) + }; + + case 'false': + return { + kind: _kinds.Kind.BOOLEAN, + value: false, + loc: this.loc(token) + }; + + case 'null': + return { + kind: _kinds.Kind.NULL, + loc: this.loc(token) + }; + + default: + return { + kind: _kinds.Kind.ENUM, + value: token.value, + loc: this.loc(token) + }; + } + + case _tokenKind.TokenKind.DOLLAR: + if (!isConst) { + return this.parseVariable(); + } + + break; + } + + throw this.unexpected(); + }; + + _proto.parseStringLiteral = function parseStringLiteral() { + var token = this._lexer.token; + + this._lexer.advance(); + + return { + kind: _kinds.Kind.STRING, + value: token.value, + block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, + loc: this.loc(token) + }; + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + ; + + _proto.parseList = function parseList(isConst) { + var _this = this; + + var start = this._lexer.token; + + var item = function item() { + return _this.parseValueLiteral(isConst); + }; + + return { + kind: _kinds.Kind.LIST, + values: this.any(_tokenKind.TokenKind.BRACKET_L, item, _tokenKind.TokenKind.BRACKET_R), + loc: this.loc(start) + }; + } + /** + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + */ + ; + + _proto.parseObject = function parseObject(isConst) { + var _this2 = this; + + var start = this._lexer.token; + + var item = function item() { + return _this2.parseObjectField(isConst); + }; + + return { + kind: _kinds.Kind.OBJECT, + fields: this.any(_tokenKind.TokenKind.BRACE_L, item, _tokenKind.TokenKind.BRACE_R), + loc: this.loc(start) + }; + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + ; + + _proto.parseObjectField = function parseObjectField(isConst) { + var start = this._lexer.token; + var name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return { + kind: _kinds.Kind.OBJECT_FIELD, + name: name, + value: this.parseValueLiteral(isConst), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + ; + + _proto.parseDirectives = function parseDirectives(isConst) { + var directives = []; + + while (this.peek(_tokenKind.TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + /** + * Directive[Const] : @ Name Arguments[?Const]? + */ + ; + + _proto.parseDirective = function parseDirective(isConst) { + var start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.AT); + return { + kind: _kinds.Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + ; + + _proto.parseTypeReference = function parseTypeReference() { + var start = this._lexer.token; + var type; + + if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { + type = this.parseTypeReference(); + this.expectToken(_tokenKind.TokenKind.BRACKET_R); + type = { + kind: _kinds.Kind.LIST_TYPE, + type: type, + loc: this.loc(start) + }; + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { + return { + kind: _kinds.Kind.NON_NULL_TYPE, + type: type, + loc: this.loc(start) + }; + } + + return type; + } + /** + * NamedType : Name + */ + ; + + _proto.parseNamedType = function parseNamedType() { + var start = this._lexer.token; + return { + kind: _kinds.Kind.NAMED_TYPE, + name: this.parseName(), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Type Definition section. + + /** + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + ; + + _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() { + // Many definitions begin with a description and require a lookahead. + var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token; + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + + case 'scalar': + return this.parseScalarTypeDefinition(); + + case 'type': + return this.parseObjectTypeDefinition(); + + case 'interface': + return this.parseInterfaceTypeDefinition(); + + case 'union': + return this.parseUnionTypeDefinition(); + + case 'enum': + return this.parseEnumTypeDefinition(); + + case 'input': + return this.parseInputObjectTypeDefinition(); + + case 'directive': + return this.parseDirectiveDefinition(); + } + } + + throw this.unexpected(keywordToken); + }; + + _proto.peekDescription = function peekDescription() { + return this.peek(_tokenKind.TokenKind.STRING) || this.peek(_tokenKind.TokenKind.BLOCK_STRING); + } + /** + * Description : StringValue + */ + ; + + _proto.parseDescription = function parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + */ + ; + + _proto.parseSchemaDefinition = function parseSchemaDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('schema'); + var directives = this.parseDirectives(true); + var operationTypes = this.many(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); + return { + kind: _kinds.Kind.SCHEMA_DEFINITION, + description: description, + directives: directives, + operationTypes: operationTypes, + loc: this.loc(start) + }; + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + ; + + _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() { + var start = this._lexer.token; + var operation = this.parseOperationType(); + this.expectToken(_tokenKind.TokenKind.COLON); + var type = this.parseNamedType(); + return { + kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, + operation: operation, + type: type, + loc: this.loc(start) + }; + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + ; + + _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('scalar'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + return { + kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + ; + + _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('type'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + return { + kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, + description: description, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + ; + + _proto.parseImplementsInterfaces = function parseImplementsInterfaces() { + var _this$_options2; + + if (!this.expectOptionalKeyword('implements')) { + return []; + } + + if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) { + var types = []; // Optional leading ampersand + + this.expectOptionalToken(_tokenKind.TokenKind.AMP); + + do { + types.push(this.parseNamedType()); + } while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME)); + + return types; + } + + return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType); + } + /** + * FieldsDefinition : { FieldDefinition+ } + */ + ; + + _proto.parseFieldsDefinition = function parseFieldsDefinition() { + var _this$_options3; + + // Legacy support for the SDL? + if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(_tokenKind.TokenKind.BRACE_L) && this._lexer.lookahead().kind === _tokenKind.TokenKind.BRACE_R) { + this._lexer.advance(); + + this._lexer.advance(); + + return []; + } + + return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseFieldDefinition, _tokenKind.TokenKind.BRACE_R); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + ; + + _proto.parseFieldDefinition = function parseFieldDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + var args = this.parseArgumentDefs(); + this.expectToken(_tokenKind.TokenKind.COLON); + var type = this.parseTypeReference(); + var directives = this.parseDirectives(true); + return { + kind: _kinds.Kind.FIELD_DEFINITION, + description: description, + name: name, + arguments: args, + type: type, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + ; + + _proto.parseArgumentDefs = function parseArgumentDefs() { + return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseInputValueDef, _tokenKind.TokenKind.PAREN_R); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + ; + + _proto.parseInputValueDef = function parseInputValueDef() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + var type = this.parseTypeReference(); + var defaultValue; + + if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) { + defaultValue = this.parseValueLiteral(true); + } + + var directives = this.parseDirectives(true); + return { + kind: _kinds.Kind.INPUT_VALUE_DEFINITION, + description: description, + name: name, + type: type, + defaultValue: defaultValue, + directives: directives, + loc: this.loc(start) + }; + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + ; + + _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('interface'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + return { + kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, + description: description, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + ; + + _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('union'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var types = this.parseUnionMemberTypes(); + return { + kind: _kinds.Kind.UNION_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + types: types, + loc: this.loc(start) + }; + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + ; + + _proto.parseUnionMemberTypes = function parseUnionMemberTypes() { + return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + ; + + _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('enum'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var values = this.parseEnumValuesDefinition(); + return { + kind: _kinds.Kind.ENUM_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + values: values, + loc: this.loc(start) + }; + } + /** + * EnumValuesDefinition : { EnumValueDefinition+ } + */ + ; + + _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() { + return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseEnumValueDefinition, _tokenKind.TokenKind.BRACE_R); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + * + * EnumValue : Name + */ + ; + + _proto.parseEnumValueDefinition = function parseEnumValueDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + var directives = this.parseDirectives(true); + return { + kind: _kinds.Kind.ENUM_VALUE_DEFINITION, + description: description, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + ; + + _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('input'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var fields = this.parseInputFieldsDefinition(); + return { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * InputFieldsDefinition : { InputValueDefinition+ } + */ + ; + + _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() { + return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseInputValueDef, _tokenKind.TokenKind.BRACE_R); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + ; + + _proto.parseTypeSystemExtension = function parseTypeSystemExtension() { + var keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + + case 'scalar': + return this.parseScalarTypeExtension(); + + case 'type': + return this.parseObjectTypeExtension(); + + case 'interface': + return this.parseInterfaceTypeExtension(); + + case 'union': + return this.parseUnionTypeExtension(); + + case 'enum': + return this.parseEnumTypeExtension(); + + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + /** + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + */ + ; + + _proto.parseSchemaExtension = function parseSchemaExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + var directives = this.parseDirectives(true); + var operationTypes = this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.SCHEMA_EXTENSION, + directives: directives, + operationTypes: operationTypes, + loc: this.loc(start) + }; + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + ; + + _proto.parseScalarTypeExtension = function parseScalarTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + ; + + _proto.parseObjectTypeExtension = function parseObjectTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + + if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + ; + + _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + + if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + ; + + _proto.parseUnionTypeExtension = function parseUnionTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.UNION_TYPE_EXTENSION, + name: name, + directives: directives, + types: types, + loc: this.loc(start) + }; + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + ; + + _proto.parseEnumTypeExtension = function parseEnumTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.ENUM_TYPE_EXTENSION, + name: name, + directives: directives, + values: values, + loc: this.loc(start) + }; + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + ; + + _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, + name: name, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + */ + ; + + _proto.parseDirectiveDefinition = function parseDirectiveDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(_tokenKind.TokenKind.AT); + var name = this.parseName(); + var args = this.parseArgumentDefs(); + var repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + var locations = this.parseDirectiveLocations(); + return { + kind: _kinds.Kind.DIRECTIVE_DEFINITION, + description: description, + name: name, + arguments: args, + repeatable: repeatable, + locations: locations, + loc: this.loc(start) + }; + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + ; + + _proto.parseDirectiveLocations = function parseDirectiveLocations() { + return this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseDirectiveLocation); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + ; + + _proto.parseDirectiveLocation = function parseDirectiveLocation() { + var start = this._lexer.token; + var name = this.parseName(); + + if (_directiveLocation.DirectiveLocation[name.value] !== undefined) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a location object, used to identify the place in the source that created a given parsed object. + */ + ; + + _proto.loc = function loc(startToken) { + var _this$_options4; + + if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) { + return new _ast.Location(startToken, this._lexer.lastToken, this._lexer.source); + } + } + /** + * Determines if the next token is of a given kind + */ + ; + + _proto.peek = function peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + ; + + _proto.expectToken = function expectToken(kind) { + var token = this._lexer.token; + + if (token.kind === kind) { + this._lexer.advance(); + + return token; + } + + throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected ".concat(getTokenKindDesc(kind), ", found ").concat(getTokenDesc(token), ".")); + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and return undefined. + */ + ; + + _proto.expectOptionalToken = function expectOptionalToken(kind) { + var token = this._lexer.token; + + if (token.kind === kind) { + this._lexer.advance(); + + return token; + } + + return undefined; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + ; + + _proto.expectKeyword = function expectKeyword(value) { + var token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this._lexer.advance(); + } else { + throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat(getTokenDesc(token), ".")); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + ; + + _proto.expectOptionalKeyword = function expectOptionalKeyword(value) { + var token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this._lexer.advance(); + + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + ; + + _proto.unexpected = function unexpected(atToken) { + var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Unexpected ".concat(getTokenDesc(token), ".")); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.any = function any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + var nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.many = function many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + ; + + _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + }; + + return Parser; +}(); +/** + * A helper function to describe a token as a string for debugging. + */ + + +exports.Parser = Parser; + +function getTokenDesc(token) { + var value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? " \"".concat(value, "\"") : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + + +function getTokenKindDesc(kind) { + return (0, _lexer.isPunctuatorTokenKind)(kind) ? "\"".concat(kind, "\"") : kind; +} + + +/***/ }), + +/***/ 20535: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isDefinitionNode = isDefinitionNode; +exports.isExecutableDefinitionNode = isExecutableDefinitionNode; +exports.isSelectionNode = isSelectionNode; +exports.isValueNode = isValueNode; +exports.isTypeNode = isTypeNode; +exports.isTypeSystemDefinitionNode = isTypeSystemDefinitionNode; +exports.isTypeDefinitionNode = isTypeDefinitionNode; +exports.isTypeSystemExtensionNode = isTypeSystemExtensionNode; +exports.isTypeExtensionNode = isTypeExtensionNode; + +var _kinds = __nccwpck_require__(11927); + +function isDefinitionNode(node) { + return isExecutableDefinitionNode(node) || isTypeSystemDefinitionNode(node) || isTypeSystemExtensionNode(node); +} + +function isExecutableDefinitionNode(node) { + return node.kind === _kinds.Kind.OPERATION_DEFINITION || node.kind === _kinds.Kind.FRAGMENT_DEFINITION; +} + +function isSelectionNode(node) { + return node.kind === _kinds.Kind.FIELD || node.kind === _kinds.Kind.FRAGMENT_SPREAD || node.kind === _kinds.Kind.INLINE_FRAGMENT; +} + +function isValueNode(node) { + return node.kind === _kinds.Kind.VARIABLE || node.kind === _kinds.Kind.INT || node.kind === _kinds.Kind.FLOAT || node.kind === _kinds.Kind.STRING || node.kind === _kinds.Kind.BOOLEAN || node.kind === _kinds.Kind.NULL || node.kind === _kinds.Kind.ENUM || node.kind === _kinds.Kind.LIST || node.kind === _kinds.Kind.OBJECT; +} + +function isTypeNode(node) { + return node.kind === _kinds.Kind.NAMED_TYPE || node.kind === _kinds.Kind.LIST_TYPE || node.kind === _kinds.Kind.NON_NULL_TYPE; +} + +function isTypeSystemDefinitionNode(node) { + return node.kind === _kinds.Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(node) || node.kind === _kinds.Kind.DIRECTIVE_DEFINITION; +} + +function isTypeDefinitionNode(node) { + return node.kind === _kinds.Kind.SCALAR_TYPE_DEFINITION || node.kind === _kinds.Kind.OBJECT_TYPE_DEFINITION || node.kind === _kinds.Kind.INTERFACE_TYPE_DEFINITION || node.kind === _kinds.Kind.UNION_TYPE_DEFINITION || node.kind === _kinds.Kind.ENUM_TYPE_DEFINITION || node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION; +} + +function isTypeSystemExtensionNode(node) { + return node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); +} + +function isTypeExtensionNode(node) { + return node.kind === _kinds.Kind.SCALAR_TYPE_EXTENSION || node.kind === _kinds.Kind.OBJECT_TYPE_EXTENSION || node.kind === _kinds.Kind.INTERFACE_TYPE_EXTENSION || node.kind === _kinds.Kind.UNION_TYPE_EXTENSION || node.kind === _kinds.Kind.ENUM_TYPE_EXTENSION || node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; +} + + +/***/ }), + +/***/ 35250: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.printLocation = printLocation; +exports.printSourceLocation = printSourceLocation; + +var _location = __nccwpck_require__(61922); + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +function printLocation(location) { + return printSourceLocation(location.source, (0, _location.getLocation)(location.source, location.start)); +} +/** + * Render a helpful description of the location in the GraphQL Source document. + */ + + +function printSourceLocation(source, sourceLocation) { + var firstLineColumnOffset = source.locationOffset.column - 1; + var body = whitespace(firstLineColumnOffset) + source.body; + var lineIndex = sourceLocation.line - 1; + var lineOffset = source.locationOffset.line - 1; + var lineNum = sourceLocation.line + lineOffset; + var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + var columnNum = sourceLocation.column + columnOffset; + var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n"); + var lines = body.split(/\r\n|[\n\r]/g); + var locationLine = lines[lineIndex]; // Special case for minified documents + + if (locationLine.length > 120) { + var subLineIndex = Math.floor(columnNum / 80); + var subLineColumnNum = columnNum % 80; + var subLines = []; + + for (var i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) { + return ['', subLine]; + }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]])); + } + + return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], + ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); +} + +function printPrefixedLines(lines) { + var existingLines = lines.filter(function (_ref) { + var _ = _ref[0], + line = _ref[1]; + return line !== undefined; + }); + var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { + var prefix = _ref2[0]; + return prefix.length; + })); + return existingLines.map(function (_ref3) { + var prefix = _ref3[0], + line = _ref3[1]; + return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'); + }).join('\n'); +} + +function whitespace(len) { + return Array(len + 1).join(' '); +} + +function leftPad(len, str) { + return whitespace(len - str.length) + str; +} + + +/***/ }), + +/***/ 68203: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.print = print; + +var _visitor = __nccwpck_require__(5678); + +var _blockString = __nccwpck_require__(4515); + +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +function print(ast) { + return (0, _visitor.visit)(ast, { + leave: printDocASTReducer + }); +} + +var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future + +var printDocASTReducer = { + Name: function Name(node) { + return node.value; + }, + Variable: function Variable(node) { + return '$' + node.name; + }, + // Document + Document: function Document(node) { + return join(node.definitions, '\n\n') + '\n'; + }, + OperationDefinition: function OperationDefinition(node) { + var op = node.operation; + var name = node.name; + var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + var directives = join(node.directives, ' '); + var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); + }, + VariableDefinition: function VariableDefinition(_ref) { + var variable = _ref.variable, + type = _ref.type, + defaultValue = _ref.defaultValue, + directives = _ref.directives; + return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); + }, + SelectionSet: function SelectionSet(_ref2) { + var selections = _ref2.selections; + return block(selections); + }, + Field: function Field(_ref3) { + var alias = _ref3.alias, + name = _ref3.name, + args = _ref3.arguments, + directives = _ref3.directives, + selectionSet = _ref3.selectionSet; + var prefix = wrap('', alias, ': ') + name; + var argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + Argument: function Argument(_ref4) { + var name = _ref4.name, + value = _ref4.value; + return name + ': ' + value; + }, + // Fragments + FragmentSpread: function FragmentSpread(_ref5) { + var name = _ref5.name, + directives = _ref5.directives; + return '...' + name + wrap(' ', join(directives, ' ')); + }, + InlineFragment: function InlineFragment(_ref6) { + var typeCondition = _ref6.typeCondition, + directives = _ref6.directives, + selectionSet = _ref6.selectionSet; + return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); + }, + FragmentDefinition: function FragmentDefinition(_ref7) { + var name = _ref7.name, + typeCondition = _ref7.typeCondition, + variableDefinitions = _ref7.variableDefinitions, + directives = _ref7.directives, + selectionSet = _ref7.selectionSet; + return (// Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet + ); + }, + // Value + IntValue: function IntValue(_ref8) { + var value = _ref8.value; + return value; + }, + FloatValue: function FloatValue(_ref9) { + var value = _ref9.value; + return value; + }, + StringValue: function StringValue(_ref10, key) { + var value = _ref10.value, + isBlockString = _ref10.block; + return isBlockString ? (0, _blockString.printBlockString)(value, key === 'description' ? '' : ' ') : JSON.stringify(value); + }, + BooleanValue: function BooleanValue(_ref11) { + var value = _ref11.value; + return value ? 'true' : 'false'; + }, + NullValue: function NullValue() { + return 'null'; + }, + EnumValue: function EnumValue(_ref12) { + var value = _ref12.value; + return value; + }, + ListValue: function ListValue(_ref13) { + var values = _ref13.values; + return '[' + join(values, ', ') + ']'; + }, + ObjectValue: function ObjectValue(_ref14) { + var fields = _ref14.fields; + return '{' + join(fields, ', ') + '}'; + }, + ObjectField: function ObjectField(_ref15) { + var name = _ref15.name, + value = _ref15.value; + return name + ': ' + value; + }, + // Directive + Directive: function Directive(_ref16) { + var name = _ref16.name, + args = _ref16.arguments; + return '@' + name + wrap('(', join(args, ', '), ')'); + }, + // Type + NamedType: function NamedType(_ref17) { + var name = _ref17.name; + return name; + }, + ListType: function ListType(_ref18) { + var type = _ref18.type; + return '[' + type + ']'; + }, + NonNullType: function NonNullType(_ref19) { + var type = _ref19.type; + return type + '!'; + }, + // Type System Definitions + SchemaDefinition: addDescription(function (_ref20) { + var directives = _ref20.directives, + operationTypes = _ref20.operationTypes; + return join(['schema', join(directives, ' '), block(operationTypes)], ' '); + }), + OperationTypeDefinition: function OperationTypeDefinition(_ref21) { + var operation = _ref21.operation, + type = _ref21.type; + return operation + ': ' + type; + }, + ScalarTypeDefinition: addDescription(function (_ref22) { + var name = _ref22.name, + directives = _ref22.directives; + return join(['scalar', name, join(directives, ' ')], ' '); + }), + ObjectTypeDefinition: addDescription(function (_ref23) { + var name = _ref23.name, + interfaces = _ref23.interfaces, + directives = _ref23.directives, + fields = _ref23.fields; + return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }), + FieldDefinition: addDescription(function (_ref24) { + var name = _ref24.name, + args = _ref24.arguments, + type = _ref24.type, + directives = _ref24.directives; + return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); + }), + InputValueDefinition: addDescription(function (_ref25) { + var name = _ref25.name, + type = _ref25.type, + defaultValue = _ref25.defaultValue, + directives = _ref25.directives; + return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); + }), + InterfaceTypeDefinition: addDescription(function (_ref26) { + var name = _ref26.name, + interfaces = _ref26.interfaces, + directives = _ref26.directives, + fields = _ref26.fields; + return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }), + UnionTypeDefinition: addDescription(function (_ref27) { + var name = _ref27.name, + directives = _ref27.directives, + types = _ref27.types; + return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); + }), + EnumTypeDefinition: addDescription(function (_ref28) { + var name = _ref28.name, + directives = _ref28.directives, + values = _ref28.values; + return join(['enum', name, join(directives, ' '), block(values)], ' '); + }), + EnumValueDefinition: addDescription(function (_ref29) { + var name = _ref29.name, + directives = _ref29.directives; + return join([name, join(directives, ' ')], ' '); + }), + InputObjectTypeDefinition: addDescription(function (_ref30) { + var name = _ref30.name, + directives = _ref30.directives, + fields = _ref30.fields; + return join(['input', name, join(directives, ' '), block(fields)], ' '); + }), + DirectiveDefinition: addDescription(function (_ref31) { + var name = _ref31.name, + args = _ref31.arguments, + repeatable = _ref31.repeatable, + locations = _ref31.locations; + return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); + }), + SchemaExtension: function SchemaExtension(_ref32) { + var directives = _ref32.directives, + operationTypes = _ref32.operationTypes; + return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); + }, + ScalarTypeExtension: function ScalarTypeExtension(_ref33) { + var name = _ref33.name, + directives = _ref33.directives; + return join(['extend scalar', name, join(directives, ' ')], ' '); + }, + ObjectTypeExtension: function ObjectTypeExtension(_ref34) { + var name = _ref34.name, + interfaces = _ref34.interfaces, + directives = _ref34.directives, + fields = _ref34.fields; + return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }, + InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { + var name = _ref35.name, + interfaces = _ref35.interfaces, + directives = _ref35.directives, + fields = _ref35.fields; + return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }, + UnionTypeExtension: function UnionTypeExtension(_ref36) { + var name = _ref36.name, + directives = _ref36.directives, + types = _ref36.types; + return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); + }, + EnumTypeExtension: function EnumTypeExtension(_ref37) { + var name = _ref37.name, + directives = _ref37.directives, + values = _ref37.values; + return join(['extend enum', name, join(directives, ' '), block(values)], ' '); + }, + InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { + var name = _ref38.name, + directives = _ref38.directives, + fields = _ref38.fields; + return join(['extend input', name, join(directives, ' '), block(fields)], ' '); + } +}; + +function addDescription(cb) { + return function (node) { + return join([node.description, cb(node)], '\n'); + }; +} +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + + +function join(maybeArray) { + var _maybeArray$filter$jo; + + var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { + return x; + }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; +} +/** + * Given array, print each item on its own line, wrapped in an + * indented "{ }" block. + */ + + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + + +function wrap(start, maybeString) { + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function isMultiline(str) { + return str.indexOf('\n') !== -1; +} + +function hasMultilineItems(maybeArray) { + return maybeArray != null && maybeArray.some(isMultiline); +} + + +/***/ }), + +/***/ 65521: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isSource = isSource; +exports.Source = void 0; + +var _symbols = __nccwpck_require__(3255); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _instanceOf = _interopRequireDefault(__nccwpck_require__(93481)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +var Source = /*#__PURE__*/function () { + function Source(body) { + var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request'; + var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { + line: 1, + column: 1 + }; + typeof body === 'string' || (0, _devAssert.default)(0, "Body must be a string. Received: ".concat((0, _inspect.default)(body), ".")); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || (0, _devAssert.default)(0, 'line in locationOffset is 1-indexed and must be positive.'); + this.locationOffset.column > 0 || (0, _devAssert.default)(0, 'column in locationOffset is 1-indexed and must be positive.'); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + + + _createClass(Source, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'Source'; + } + }]); + + return Source; +}(); +/** + * Test if the given value is a Source object. + * + * @internal + */ + + +exports.Source = Source; + +// eslint-disable-next-line no-redeclare +function isSource(source) { + return (0, _instanceOf.default)(source, Source); +} + + +/***/ }), + +/***/ 91565: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.TokenKind = void 0; + +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind = Object.freeze({ + SOF: '', + EOF: '', + BANG: '!', + DOLLAR: '$', + AMP: '&', + PAREN_L: '(', + PAREN_R: ')', + SPREAD: '...', + COLON: ':', + EQUALS: '=', + AT: '@', + BRACKET_L: '[', + BRACKET_R: ']', + BRACE_L: '{', + PIPE: '|', + BRACE_R: '}', + NAME: 'Name', + INT: 'Int', + FLOAT: 'Float', + STRING: 'String', + BLOCK_STRING: 'BlockString', + COMMENT: 'Comment' +}); +/** + * The enum type representing the token kinds values. + */ + +exports.TokenKind = TokenKind; + + +/***/ }), + +/***/ 5678: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.visit = visit; +exports.visitInParallel = visitInParallel; +exports.getVisitFn = getVisitFn; +exports.BREAK = exports.QueryDocumentKeys = void 0; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _ast = __nccwpck_require__(45494); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var QueryDocumentKeys = { + Name: [], + Document: ['definitions'], + OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + Directive: ['name', 'arguments'], + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], + InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + SchemaExtension: ['directives', 'operationTypes'], + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'] +}; +exports.QueryDocumentKeys = QueryDocumentKeys; +var BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to four permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * + * 2) Named visitors that trigger upon entering and leaving a node of + * a specific kind. + * + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * + * 4) Parallel visitors for entering and leaving nodes of a specific kind. + * + * visit(ast, { + * enter: { + * Kind(node) { + * // enter the "Kind" node + * } + * }, + * leave: { + * Kind(node) { + * // leave the "Kind" node + * } + * } + * }) + */ + +exports.BREAK = BREAK; + +function visit(root, visitor) { + var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; + + /* eslint-disable no-undef-init */ + var stack = undefined; + var inArray = Array.isArray(root); + var keys = [root]; + var index = -1; + var edits = []; + var node = undefined; + var key = undefined; + var parent = undefined; + var path = []; + var ancestors = []; + var newRoot = root; + /* eslint-enable no-undef-init */ + + do { + index++; + var isLeaving = index === keys.length; + var isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + } else { + var clone = {}; + + for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { + var k = _Object$keys2[_i2]; + clone[k] = node[k]; + } + + node = clone; + } + + var editOffset = 0; + + for (var ii = 0; ii < edits.length; ii++) { + var editKey = edits[ii][0]; + var editValue = edits[ii][1]; + + if (inArray) { + editKey -= editOffset; + } + + if (inArray && editValue === null) { + node.splice(editKey, 1); + editOffset++; + } else { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else { + key = parent ? inArray ? index : keys[index] : undefined; + node = parent ? parent[key] : newRoot; + + if (node === null || node === undefined) { + continue; + } + + if (parent) { + path.push(key); + } + } + + var result = void 0; + + if (!Array.isArray(node)) { + if (!(0, _ast.isNode)(node)) { + throw new Error("Invalid AST Node: ".concat((0, _inspect.default)(node), ".")); + } + + var visitFn = getVisitFn(visitor, node.kind, isLeaving); + + if (visitFn) { + result = visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if ((0, _ast.isNode)(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _visitorKeys$node$kin; + + stack = { + inArray: inArray, + index: index, + keys: keys, + edits: edits, + prev: stack + }; + inArray = Array.isArray(node); + keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + newRoot = edits[edits.length - 1][1]; + } + + return newRoot; +} +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ + + +function visitInParallel(visitors) { + var skipping = new Array(visitors.length); + return { + enter: function enter(node) { + for (var i = 0; i < visitors.length; i++) { + if (skipping[i] == null) { + var fn = getVisitFn(visitors[i], node.kind, + /* isLeaving */ + false); + + if (fn) { + var result = fn.apply(visitors[i], arguments); + + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + } + }, + leave: function leave(node) { + for (var i = 0; i < visitors.length; i++) { + if (skipping[i] == null) { + var fn = getVisitFn(visitors[i], node.kind, + /* isLeaving */ + true); + + if (fn) { + var result = fn.apply(visitors[i], arguments); + + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + } + }; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + */ + + +function getVisitFn(visitor, kind, isLeaving) { + var kindVisitor = visitor[kind]; + + if (kindVisitor) { + if (!isLeaving && typeof kindVisitor === 'function') { + // { Kind() {} } + return kindVisitor; + } + + var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; + + if (typeof kindSpecificVisitor === 'function') { + // { Kind: { enter() {}, leave() {} } } + return kindSpecificVisitor; + } + } else { + var specificVisitor = isLeaving ? visitor.leave : visitor.enter; + + if (specificVisitor) { + if (typeof specificVisitor === 'function') { + // { enter() {}, leave() {} } + return specificVisitor; + } + + var specificKindVisitor = specificVisitor[kind]; + + if (typeof specificKindVisitor === 'function') { + // { enter: { Kind() {} }, leave: { Kind() {} } } + return specificKindVisitor; + } + } + } +} + + +/***/ }), + +/***/ 86839: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _symbols = __nccwpck_require__(3255); + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] +var arrayFrom = Array.from || function (obj, mapFn, thisArg) { + if (obj == null) { + throw new TypeError('Array.from requires an array-like object - not null or undefined'); + } // Is Iterable? + + + var iteratorMethod = obj[_symbols.SYMBOL_ITERATOR]; + + if (typeof iteratorMethod === 'function') { + var iterator = iteratorMethod.call(obj); + var result = []; + var step; + + for (var i = 0; !(step = iterator.next()).done; ++i) { + result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever. + // After a very large number of iterations, produce an error. + // istanbul ignore if (Too big to actually test) + + if (i > 9999999) { + throw new TypeError('Near-infinite iteration.'); + } + } + + return result; + } // Is Array like? + + + var length = obj.length; + + if (typeof length === 'number' && length >= 0 && length % 1 === 0) { + var _result = []; + + for (var _i = 0; _i < length; ++_i) { + if (Object.prototype.hasOwnProperty.call(obj, _i)) { + _result.push(mapFn.call(thisArg, obj[_i], _i)); + } + } + + return _result; + } + + return []; +}; + +var _default = arrayFrom; +exports.default = _default; + + +/***/ }), + +/***/ 57649: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] +var find = Array.prototype.find ? function (list, predicate) { + return Array.prototype.find.call(list, predicate); +} : function (list, predicate) { + for (var _i2 = 0; _i2 < list.length; _i2++) { + var value = list[_i2]; + + if (predicate(value)) { + return value; + } + } +}; +var _default = find; +exports.default = _default; + + +/***/ }), + +/***/ 78473: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 +var isFinitePolyfill = Number.isFinite || function (value) { + return typeof value === 'number' && isFinite(value); +}; + +var _default = isFinitePolyfill; +exports.default = _default; + + +/***/ }), + +/***/ 15813: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 +var isInteger = Number.isInteger || function (value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; +}; + +var _default = isInteger; +exports.default = _default; + + +/***/ }), + +/***/ 86422: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 +var objectEntries = Object.entries || function (obj) { + return Object.keys(obj).map(function (key) { + return [key, obj[key]]; + }); +}; + +var _default = objectEntries; +exports.default = _default; + + +/***/ }), + +/***/ 30026: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +/* eslint-disable no-redeclare */ +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 +var objectValues = Object.values || function (obj) { + return Object.keys(obj).map(function (key) { + return obj[key]; + }); +}; + +var _default = objectValues; +exports.default = _default; + + +/***/ }), + +/***/ 3255: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.SYMBOL_TO_STRING_TAG = exports.SYMBOL_ASYNC_ITERATOR = exports.SYMBOL_ITERATOR = void 0; +// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator +// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') +var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator +// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') + +exports.SYMBOL_ITERATOR = SYMBOL_ITERATOR; +var SYMBOL_ASYNC_ITERATOR = typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') + +exports.SYMBOL_ASYNC_ITERATOR = SYMBOL_ASYNC_ITERATOR; +var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag'; +exports.SYMBOL_TO_STRING_TAG = SYMBOL_TO_STRING_TAG; + + +/***/ }), + +/***/ 17575: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "subscribe", ({ + enumerable: true, + get: function get() { + return _subscribe.subscribe; + } +})); +Object.defineProperty(exports, "createSourceEventStream", ({ + enumerable: true, + get: function get() { + return _subscribe.createSourceEventStream; + } +})); + +var _subscribe = __nccwpck_require__(39217); + + +/***/ }), + +/***/ 11383: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = mapAsyncIterator; + +var _symbols = __nccwpck_require__(3255); + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +function mapAsyncIterator(iterable, callback, rejectCallback) { + // $FlowFixMe[prop-missing] + var iteratorMethod = iterable[_symbols.SYMBOL_ASYNC_ITERATOR]; + var iterator = iteratorMethod.call(iterable); + var $return; + var abruptClose; + + if (typeof iterator.return === 'function') { + $return = iterator.return; + + abruptClose = function abruptClose(error) { + var rethrow = function rethrow() { + return Promise.reject(error); + }; + + return $return.call(iterator).then(rethrow, rethrow); + }; + } + + function mapResult(result) { + return result.done ? result : asyncMapValue(result.value, callback).then(iteratorResult, abruptClose); + } + + var mapReject; + + if (rejectCallback) { + // Capture rejectCallback to ensure it cannot be null. + var reject = rejectCallback; + + mapReject = function mapReject(error) { + return asyncMapValue(error, reject).then(iteratorResult, abruptClose); + }; + } + /* TODO: Flow doesn't support symbols as keys: + https://github.com/facebook/flow/issues/3258 */ + + + return _defineProperty({ + next: function next() { + return iterator.next().then(mapResult, mapReject); + }, + return: function _return() { + return $return ? $return.call(iterator).then(mapResult, mapReject) : Promise.resolve({ + value: undefined, + done: true + }); + }, + throw: function _throw(error) { + if (typeof iterator.throw === 'function') { + return iterator.throw(error).then(mapResult, mapReject); + } + + return Promise.reject(error).catch(abruptClose); + } + }, _symbols.SYMBOL_ASYNC_ITERATOR, function () { + return this; + }); +} + +function asyncMapValue(value, callback) { + return new Promise(function (resolve) { + return resolve(callback(value)); + }); +} + +function iteratorResult(value) { + return { + value: value, + done: false + }; +} + + +/***/ }), + +/***/ 39217: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.subscribe = subscribe; +exports.createSourceEventStream = createSourceEventStream; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _isAsyncIterable = _interopRequireDefault(__nccwpck_require__(20626)); + +var _Path = __nccwpck_require__(11262); + +var _GraphQLError = __nccwpck_require__(4797); + +var _locatedError = __nccwpck_require__(16842); + +var _values = __nccwpck_require__(94834); + +var _execute = __nccwpck_require__(83677); + +var _getOperationRootType = __nccwpck_require__(81605); + +var _mapAsyncIterator = _interopRequireDefault(__nccwpck_require__(11383)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function subscribe(argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) { + /* eslint-enable no-redeclare */ + // Extract arguments from object args if provided. + return arguments.length === 1 ? subscribeImpl(argsOrSchema) : subscribeImpl({ + schema: argsOrSchema, + document: document, + rootValue: rootValue, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver, + subscribeFieldResolver: subscribeFieldResolver + }); +} +/** + * This function checks if the error is a GraphQLError. If it is, report it as + * an ExecutionResult, containing only errors and no data. Otherwise treat the + * error as a system-class error and re-throw it. + */ + + +function reportGraphQLError(error) { + if (error instanceof _GraphQLError.GraphQLError) { + return { + errors: [error] + }; + } + + throw error; +} + +function subscribeImpl(args) { + var schema = args.schema, + document = args.document, + rootValue = args.rootValue, + contextValue = args.contextValue, + variableValues = args.variableValues, + operationName = args.operationName, + fieldResolver = args.fieldResolver, + subscribeFieldResolver = args.subscribeFieldResolver; + var sourcePromise = createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, subscribeFieldResolver); // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + var mapSourceToResponse = function mapSourceToResponse(payload) { + return (0, _execute.execute)({ + schema: schema, + document: document, + rootValue: payload, + contextValue: contextValue, + variableValues: variableValues, + operationName: operationName, + fieldResolver: fieldResolver + }); + }; // Resolve the Source Stream, then map every source value to a + // ExecutionResult value as described above. + + + return sourcePromise.then(function (resultOrStream) { + return (// Note: Flow can't refine isAsyncIterable, so explicit casts are used. + (0, _isAsyncIterable.default)(resultOrStream) ? (0, _mapAsyncIterator.default)(resultOrStream, mapSourceToResponse, reportGraphQLError) : resultOrStream + ); + }); +} +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + + +function createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver) { + // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); + return new Promise(function (resolve) { + // If a valid context cannot be created due to incorrect arguments, + // this will throw an error. + var exeContext = (0, _execute.buildExecutionContext)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver); + resolve( // Return early errors if execution context failed. + Array.isArray(exeContext) ? { + errors: exeContext + } : executeSubscription(exeContext)); + }).catch(reportGraphQLError); +} + +function executeSubscription(exeContext) { + var schema = exeContext.schema, + operation = exeContext.operation, + variableValues = exeContext.variableValues, + rootValue = exeContext.rootValue; + var type = (0, _getOperationRootType.getOperationRootType)(schema, operation); + var fields = (0, _execute.collectFields)(exeContext, type, operation.selectionSet, Object.create(null), Object.create(null)); + var responseNames = Object.keys(fields); + var responseName = responseNames[0]; + var fieldNodes = fields[responseName]; + var fieldNode = fieldNodes[0]; + var fieldName = fieldNode.name.value; + var fieldDef = (0, _execute.getFieldDef)(schema, type, fieldName); + + if (!fieldDef) { + throw new _GraphQLError.GraphQLError("The subscription field \"".concat(fieldName, "\" is not defined."), fieldNodes); + } + + var path = (0, _Path.addPath)(undefined, responseName, type.name); + var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path); // Coerce to Promise for easier error handling and consistent return type. + + return new Promise(function (resolveResult) { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + var contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver; + resolveResult(resolveFn(rootValue, args, contextValue, info)); + }).then(function (eventStream) { + if (eventStream instanceof Error) { + throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path)); + } // Assert field returned an event stream, otherwise yield an error. + + + if (!(0, _isAsyncIterable.default)(eventStream)) { + throw new Error('Subscription field must return Async Iterable. ' + "Received: ".concat((0, _inspect.default)(eventStream), ".")); + } + + return eventStream; + }, function (error) { + throw (0, _locatedError.locatedError)(error, fieldNodes, (0, _Path.pathToArray)(path)); + }); +} + + +/***/ }), + +/***/ 5821: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isType = isType; +exports.assertType = assertType; +exports.isScalarType = isScalarType; +exports.assertScalarType = assertScalarType; +exports.isObjectType = isObjectType; +exports.assertObjectType = assertObjectType; +exports.isInterfaceType = isInterfaceType; +exports.assertInterfaceType = assertInterfaceType; +exports.isUnionType = isUnionType; +exports.assertUnionType = assertUnionType; +exports.isEnumType = isEnumType; +exports.assertEnumType = assertEnumType; +exports.isInputObjectType = isInputObjectType; +exports.assertInputObjectType = assertInputObjectType; +exports.isListType = isListType; +exports.assertListType = assertListType; +exports.isNonNullType = isNonNullType; +exports.assertNonNullType = assertNonNullType; +exports.isInputType = isInputType; +exports.assertInputType = assertInputType; +exports.isOutputType = isOutputType; +exports.assertOutputType = assertOutputType; +exports.isLeafType = isLeafType; +exports.assertLeafType = assertLeafType; +exports.isCompositeType = isCompositeType; +exports.assertCompositeType = assertCompositeType; +exports.isAbstractType = isAbstractType; +exports.assertAbstractType = assertAbstractType; +exports.GraphQLList = GraphQLList; +exports.GraphQLNonNull = GraphQLNonNull; +exports.isWrappingType = isWrappingType; +exports.assertWrappingType = assertWrappingType; +exports.isNullableType = isNullableType; +exports.assertNullableType = assertNullableType; +exports.getNullableType = getNullableType; +exports.isNamedType = isNamedType; +exports.assertNamedType = assertNamedType; +exports.getNamedType = getNamedType; +exports.argsToArgsConfig = argsToArgsConfig; +exports.isRequiredArgument = isRequiredArgument; +exports.isRequiredInputField = isRequiredInputField; +exports.GraphQLInputObjectType = exports.GraphQLEnumType = exports.GraphQLUnionType = exports.GraphQLInterfaceType = exports.GraphQLObjectType = exports.GraphQLScalarType = void 0; + +var _objectEntries = _interopRequireDefault(__nccwpck_require__(86422)); + +var _symbols = __nccwpck_require__(3255); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _mapValue = _interopRequireDefault(__nccwpck_require__(32223)); + +var _toObjMap = _interopRequireDefault(__nccwpck_require__(74728)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _keyValMap = _interopRequireDefault(__nccwpck_require__(49268)); + +var _instanceOf = _interopRequireDefault(__nccwpck_require__(93481)); + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _identityFunc = _interopRequireDefault(__nccwpck_require__(51188)); + +var _defineInspect = _interopRequireDefault(__nccwpck_require__(73965)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _printer = __nccwpck_require__(68203); + +var _valueFromASTUntyped = __nccwpck_require__(86699); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function isType(type) { + return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type); +} + +function assertType(type) { + if (!isType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL type.")); + } + + return type; +} +/** + * There are predicates for each kind of GraphQL type. + */ + + +// eslint-disable-next-line no-redeclare +function isScalarType(type) { + return (0, _instanceOf.default)(type, GraphQLScalarType); +} + +function assertScalarType(type) { + if (!isScalarType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isObjectType(type) { + return (0, _instanceOf.default)(type, GraphQLObjectType); +} + +function assertObjectType(type) { + if (!isObjectType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isInterfaceType(type) { + return (0, _instanceOf.default)(type, GraphQLInterfaceType); +} + +function assertInterfaceType(type) { + if (!isInterfaceType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Interface type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isUnionType(type) { + return (0, _instanceOf.default)(type, GraphQLUnionType); +} + +function assertUnionType(type) { + if (!isUnionType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Union type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isEnumType(type) { + return (0, _instanceOf.default)(type, GraphQLEnumType); +} + +function assertEnumType(type) { + if (!isEnumType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isInputObjectType(type) { + return (0, _instanceOf.default)(type, GraphQLInputObjectType); +} + +function assertInputObjectType(type) { + if (!isInputObjectType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isListType(type) { + return (0, _instanceOf.default)(type, GraphQLList); +} + +function assertListType(type) { + if (!isListType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL List type.")); + } + + return type; +} + +// eslint-disable-next-line no-redeclare +function isNonNullType(type) { + return (0, _instanceOf.default)(type, GraphQLNonNull); +} + +function assertNonNullType(type) { + if (!isNonNullType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Non-Null type.")); + } + + return type; +} +/** + * These types may be used as input types for arguments and directives. + */ + + +function isInputType(type) { + return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); +} + +function assertInputType(type) { + if (!isInputType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL input type.")); + } + + return type; +} +/** + * These types may be used as output types as the result of fields. + */ + + +function isOutputType(type) { + return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); +} + +function assertOutputType(type) { + if (!isOutputType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL output type.")); + } + + return type; +} +/** + * These types may describe types which may be leaf values. + */ + + +function isLeafType(type) { + return isScalarType(type) || isEnumType(type); +} + +function assertLeafType(type) { + if (!isLeafType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL leaf type.")); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + + +function isCompositeType(type) { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} + +function assertCompositeType(type) { + if (!isCompositeType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL composite type.")); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + + +function isAbstractType(type) { + return isInterfaceType(type) || isUnionType(type); +} + +function assertAbstractType(type) { + if (!isAbstractType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type.")); + } + + return type; +} +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * + */ +// FIXME: workaround to fix issue with Babel parser + +/* :: +declare class GraphQLList<+T: GraphQLType> { + +ofType: T; + static (ofType: T): GraphQLList; + // Note: constructors cannot be used for covariant types. Drop the "new". + constructor(ofType: GraphQLType): void; +} +*/ + + +function GraphQLList(ofType) { + // istanbul ignore else (to be removed in v16.0.0) + if (this instanceof GraphQLList) { + this.ofType = assertType(ofType); + } else { + return new GraphQLList(ofType); + } +} // Need to cast through any to alter the prototype. + + +GraphQLList.prototype.toString = function toString() { + return '[' + String(this.ofType) + ']'; +}; + +GraphQLList.prototype.toJSON = function toJSON() { + return this.toString(); +}; + +Object.defineProperty(GraphQLList.prototype, _symbols.SYMBOL_TO_STRING_TAG, { + get: function get() { + return 'GraphQLList'; + } +}); // Print a simplified form when appearing in `inspect` and `util.inspect`. + +(0, _defineInspect.default)(GraphQLList); +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * + * Note: the enforcement of non-nullability occurs within the executor. + */ +// FIXME: workaround to fix issue with Babel parser + +/* :: +declare class GraphQLNonNull<+T: GraphQLNullableType> { + +ofType: T; + static (ofType: T): GraphQLNonNull; + // Note: constructors cannot be used for covariant types. Drop the "new". + constructor(ofType: GraphQLType): void; +} +*/ + +function GraphQLNonNull(ofType) { + // istanbul ignore else (to be removed in v16.0.0) + if (this instanceof GraphQLNonNull) { + this.ofType = assertNullableType(ofType); + } else { + return new GraphQLNonNull(ofType); + } +} // Need to cast through any to alter the prototype. + + +GraphQLNonNull.prototype.toString = function toString() { + return String(this.ofType) + '!'; +}; + +GraphQLNonNull.prototype.toJSON = function toJSON() { + return this.toString(); +}; + +Object.defineProperty(GraphQLNonNull.prototype, _symbols.SYMBOL_TO_STRING_TAG, { + get: function get() { + return 'GraphQLNonNull'; + } +}); // Print a simplified form when appearing in `inspect` and `util.inspect`. + +(0, _defineInspect.default)(GraphQLNonNull); +/** + * These types wrap and modify other types + */ + +function isWrappingType(type) { + return isListType(type) || isNonNullType(type); +} + +function assertWrappingType(type) { + if (!isWrappingType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL wrapping type.")); + } + + return type; +} +/** + * These types can all accept null as a value. + */ + + +function isNullableType(type) { + return isType(type) && !isNonNullType(type); +} + +function assertNullableType(type) { + if (!isNullableType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL nullable type.")); + } + + return type; +} +/* eslint-disable no-redeclare */ + + +function getNullableType(type) { + /* eslint-enable no-redeclare */ + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} +/** + * These named types do not include modifiers like List or NonNull. + */ + + +function isNamedType(type) { + return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); +} + +function assertNamedType(type) { + if (!isNamedType(type)) { + throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL named type.")); + } + + return type; +} +/* eslint-disable no-redeclare */ + + +function getNamedType(type) { + /* eslint-enable no-redeclare */ + if (type) { + var unwrappedType = type; + + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + + return unwrappedType; + } +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + + +function resolveThunk(thunk) { + // $FlowFixMe[incompatible-use] + return typeof thunk === 'function' ? thunk() : thunk; +} + +function undefineIfEmpty(arr) { + return arr && arr.length > 0 ? arr : undefined; +} +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function does not return a value (i.e. it returns + * `undefined`) then an error will be raised and a `null` value will be returned + * in the response. If the serialize function returns `null`, then no error will + * be included in the response. + * + * Example: + * + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (value % 2 === 1) { + * return value; + * } + * } + * }); + * + */ + + +var GraphQLScalarType = /*#__PURE__*/function () { + function GraphQLScalarType(config) { + var _config$parseValue, _config$serialize, _config$parseLiteral; + + var parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : _identityFunc.default; + this.name = config.name; + this.description = config.description; + this.specifiedByUrl = config.specifiedByUrl; + this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : _identityFunc.default; + this.parseValue = parseValue; + this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node, variables) { + return parseValue((0, _valueFromASTUntyped.valueFromASTUntyped)(node, variables)); + }; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + config.specifiedByUrl == null || typeof config.specifiedByUrl === 'string' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"specifiedByUrl\" as a string, ") + "but got: ".concat((0, _inspect.default)(config.specifiedByUrl), ".")); + config.serialize == null || typeof config.serialize === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.")); + + if (config.parseLiteral) { + typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide both \"parseValue\" and \"parseLiteral\" functions.")); + } + } + + var _proto = GraphQLScalarType.prototype; + + _proto.toConfig = function toConfig() { + var _this$extensionASTNod; + + return { + name: this.name, + description: this.description, + specifiedByUrl: this.specifiedByUrl, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [] + }; + }; + + _proto.toString = function toString() { + return this.name; + }; + + _proto.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLScalarType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLScalarType'; + } + }]); + + return GraphQLScalarType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLScalarType = GraphQLScalarType; +(0, _defineInspect.default)(GraphQLScalarType); + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * + */ +var GraphQLObjectType = /*#__PURE__*/function () { + function GraphQLObjectType(config) { + this.name = config.name; + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + config.isTypeOf == null || typeof config.isTypeOf === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"isTypeOf\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.isTypeOf), ".")); + } + + var _proto2 = GraphQLObjectType.prototype; + + _proto2.getFields = function getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + }; + + _proto2.getInterfaces = function getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + }; + + _proto2.toConfig = function toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes || [] + }; + }; + + _proto2.toString = function toString() { + return this.name; + }; + + _proto2.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLObjectType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLObjectType'; + } + }]); + + return GraphQLObjectType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLObjectType = GraphQLObjectType; +(0, _defineInspect.default)(GraphQLObjectType); + +function defineInterfaces(config) { + var _resolveThunk; + + var interfaces = (_resolveThunk = resolveThunk(config.interfaces)) !== null && _resolveThunk !== void 0 ? _resolveThunk : []; + Array.isArray(interfaces) || (0, _devAssert.default)(0, "".concat(config.name, " interfaces must be an Array or a function which returns an Array.")); + return interfaces; +} + +function defineFieldMap(config) { + var fieldMap = resolveThunk(config.fields); + isPlainObj(fieldMap) || (0, _devAssert.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); + return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) { + var _fieldConfig$args; + + isPlainObj(fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object.")); + !('isDeprecated' in fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); + fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function' || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat((0, _inspect.default)(fieldConfig.resolve), ".")); + var argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {}; + isPlainObj(argsConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument names as keys.")); + var args = (0, _objectEntries.default)(argsConfig).map(function (_ref) { + var argName = _ref[0], + argConfig = _ref[1]; + return { + name: argName, + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: argConfig.extensions && (0, _toObjMap.default)(argConfig.extensions), + astNode: argConfig.astNode + }; + }); + return { + name: fieldName, + description: fieldConfig.description, + type: fieldConfig.type, + args: args, + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + isDeprecated: fieldConfig.deprecationReason != null, + deprecationReason: fieldConfig.deprecationReason, + extensions: fieldConfig.extensions && (0, _toObjMap.default)(fieldConfig.extensions), + astNode: fieldConfig.astNode + }; + }); +} + +function isPlainObj(obj) { + return (0, _isObjectLike.default)(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig(fields) { + return (0, _mapValue.default)(fields, function (field) { + return { + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode + }; + }); +} +/** + * @internal + */ + + +function argsToArgsConfig(args) { + return (0, _keyValMap.default)(args, function (arg) { + return arg.name; + }, function (arg) { + return { + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode + }; + }); +} + +function isRequiredArgument(arg) { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * + */ +var GraphQLInterfaceType = /*#__PURE__*/function () { + function GraphQLInterfaceType(config) { + this.name = config.name; + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.resolveType), ".")); + } + + var _proto3 = GraphQLInterfaceType.prototype; + + _proto3.getFields = function getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + }; + + _proto3.getInterfaces = function getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + }; + + _proto3.toConfig = function toConfig() { + var _this$extensionASTNod2; + + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod2 = this.extensionASTNodes) !== null && _this$extensionASTNod2 !== void 0 ? _this$extensionASTNod2 : [] + }; + }; + + _proto3.toString = function toString() { + return this.name; + }; + + _proto3.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLInterfaceType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLInterfaceType'; + } + }]); + + return GraphQLInterfaceType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLInterfaceType = GraphQLInterfaceType; +(0, _defineInspect.default)(GraphQLInterfaceType); + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * + */ +var GraphQLUnionType = /*#__PURE__*/function () { + function GraphQLUnionType(config) { + this.name = config.name; + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + this._types = defineTypes.bind(undefined, config); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat((0, _inspect.default)(config.resolveType), ".")); + } + + var _proto4 = GraphQLUnionType.prototype; + + _proto4.getTypes = function getTypes() { + if (typeof this._types === 'function') { + this._types = this._types(); + } + + return this._types; + }; + + _proto4.toConfig = function toConfig() { + var _this$extensionASTNod3; + + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod3 = this.extensionASTNodes) !== null && _this$extensionASTNod3 !== void 0 ? _this$extensionASTNod3 : [] + }; + }; + + _proto4.toString = function toString() { + return this.name; + }; + + _proto4.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLUnionType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLUnionType'; + } + }]); + + return GraphQLUnionType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLUnionType = GraphQLUnionType; +(0, _defineInspect.default)(GraphQLUnionType); + +function defineTypes(config) { + var types = resolveThunk(config.types); + Array.isArray(types) || (0, _devAssert.default)(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config.name, ".")); + return types; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +var GraphQLEnumType +/* */ += /*#__PURE__*/function () { + function GraphQLEnumType(config) { + this.name = config.name; + this.description = config.description; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map(this._values.map(function (enumValue) { + return [enumValue.value, enumValue]; + })); + this._nameLookup = (0, _keyMap.default)(this._values, function (value) { + return value.name; + }); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + } + + var _proto5 = GraphQLEnumType.prototype; + + _proto5.getValues = function getValues() { + return this._values; + }; + + _proto5.getValue = function getValue(name) { + return this._nameLookup[name]; + }; + + _proto5.serialize = function serialize(outputValue) { + var enumValue = this._valueLookup.get(outputValue); + + if (enumValue === undefined) { + throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent value: ").concat((0, _inspect.default)(outputValue))); + } + + return enumValue.name; + }; + + _proto5.parseValue = function parseValue(inputValue) + /* T */ + { + if (typeof inputValue !== 'string') { + var valueStr = (0, _inspect.default)(inputValue); + throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-string value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr)); + } + + var enumValue = this.getValue(inputValue); + + if (enumValue == null) { + throw new _GraphQLError.GraphQLError("Value \"".concat(inputValue, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, inputValue)); + } + + return enumValue.value; + }; + + _proto5.parseLiteral = function parseLiteral(valueNode, _variables) + /* T */ + { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== _kinds.Kind.ENUM) { + var valueStr = (0, _printer.print)(valueNode); + throw new _GraphQLError.GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-enum value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr), valueNode); + } + + var enumValue = this.getValue(valueNode.value); + + if (enumValue == null) { + var _valueStr = (0, _printer.print)(valueNode); + + throw new _GraphQLError.GraphQLError("Value \"".concat(_valueStr, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, _valueStr), valueNode); + } + + return enumValue.value; + }; + + _proto5.toConfig = function toConfig() { + var _this$extensionASTNod4; + + var values = (0, _keyValMap.default)(this.getValues(), function (value) { + return value.name; + }, function (value) { + return { + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode + }; + }); + return { + name: this.name, + description: this.description, + values: values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod4 = this.extensionASTNodes) !== null && _this$extensionASTNod4 !== void 0 ? _this$extensionASTNod4 : [] + }; + }; + + _proto5.toString = function toString() { + return this.name; + }; + + _proto5.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLEnumType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLEnumType'; + } + }]); + + return GraphQLEnumType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLEnumType = GraphQLEnumType; +(0, _defineInspect.default)(GraphQLEnumType); + +function didYouMeanEnumValue(enumType, unknownValueStr) { + var allNames = enumType.getValues().map(function (value) { + return value.name; + }); + var suggestedValues = (0, _suggestionList.default)(unknownValueStr, allNames); + return (0, _didYouMean.default)('the enum value', suggestedValues); +} + +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || (0, _devAssert.default)(0, "".concat(typeName, " values must be an object with value names as keys.")); + return (0, _objectEntries.default)(valueMap).map(function (_ref2) { + var valueName = _ref2[0], + valueConfig = _ref2[1]; + isPlainObj(valueConfig) || (0, _devAssert.default)(0, "".concat(typeName, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat((0, _inspect.default)(valueConfig), ".")); + !('isDeprecated' in valueConfig) || (0, _devAssert.default)(0, "".concat(typeName, ".").concat(valueName, " should provide \"deprecationReason\" instead of \"isDeprecated\".")); + return { + name: valueName, + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + isDeprecated: valueConfig.deprecationReason != null, + deprecationReason: valueConfig.deprecationReason, + extensions: valueConfig.extensions && (0, _toObjMap.default)(valueConfig.extensions), + astNode: valueConfig.astNode + }; + }); +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * + */ +var GraphQLInputObjectType = /*#__PURE__*/function () { + function GraphQLInputObjectType(config) { + this.name = config.name; + this.description = config.description; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); + this._fields = defineInputFieldMap.bind(undefined, config); + typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.'); + } + + var _proto6 = GraphQLInputObjectType.prototype; + + _proto6.getFields = function getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + }; + + _proto6.toConfig = function toConfig() { + var _this$extensionASTNod5; + + var fields = (0, _mapValue.default)(this.getFields(), function (field) { + return { + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + extensions: field.extensions, + astNode: field.astNode + }; + }); + return { + name: this.name, + description: this.description, + fields: fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod5 = this.extensionASTNodes) !== null && _this$extensionASTNod5 !== void 0 ? _this$extensionASTNod5 : [] + }; + }; + + _proto6.toString = function toString() { + return this.name; + }; + + _proto6.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLInputObjectType, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLInputObjectType'; + } + }]); + + return GraphQLInputObjectType; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLInputObjectType = GraphQLInputObjectType; +(0, _defineInspect.default)(GraphQLInputObjectType); + +function defineInputFieldMap(config) { + var fieldMap = resolveThunk(config.fields); + isPlainObj(fieldMap) || (0, _devAssert.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object.")); + return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) { + !('resolve' in fieldConfig) || (0, _devAssert.default)(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but Input Types cannot define resolvers.")); + return { + name: fieldName, + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: fieldConfig.extensions && (0, _toObjMap.default)(fieldConfig.extensions), + astNode: fieldConfig.astNode + }; + }); +} + +function isRequiredInputField(field) { + return isNonNullType(field.type) && field.defaultValue === undefined; +} + + +/***/ }), + +/***/ 83614: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isDirective = isDirective; +exports.assertDirective = assertDirective; +exports.isSpecifiedDirective = isSpecifiedDirective; +exports.specifiedDirectives = exports.GraphQLSpecifiedByDirective = exports.GraphQLDeprecatedDirective = exports.DEFAULT_DEPRECATION_REASON = exports.GraphQLSkipDirective = exports.GraphQLIncludeDirective = exports.GraphQLDirective = void 0; + +var _objectEntries = _interopRequireDefault(__nccwpck_require__(86422)); + +var _symbols = __nccwpck_require__(3255); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _toObjMap = _interopRequireDefault(__nccwpck_require__(74728)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _instanceOf = _interopRequireDefault(__nccwpck_require__(93481)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _defineInspect = _interopRequireDefault(__nccwpck_require__(73965)); + +var _directiveLocation = __nccwpck_require__(81205); + +var _scalars = __nccwpck_require__(93145); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +// eslint-disable-next-line no-redeclare +function isDirective(directive) { + return (0, _instanceOf.default)(directive, GraphQLDirective); +} + +function assertDirective(directive) { + if (!isDirective(directive)) { + throw new Error("Expected ".concat((0, _inspect.default)(directive), " to be a GraphQL directive.")); + } + + return directive; +} +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ + + +var GraphQLDirective = /*#__PURE__*/function () { + function GraphQLDirective(config) { + var _config$isRepeatable, _config$args; + + this.name = config.name; + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + config.name || (0, _devAssert.default)(0, 'Directive must be named.'); + Array.isArray(config.locations) || (0, _devAssert.default)(0, "@".concat(config.name, " locations must be an Array.")); + var args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {}; + (0, _isObjectLike.default)(args) && !Array.isArray(args) || (0, _devAssert.default)(0, "@".concat(config.name, " args must be an object with argument names as keys.")); + this.args = (0, _objectEntries.default)(args).map(function (_ref) { + var argName = _ref[0], + argConfig = _ref[1]; + return { + name: argName, + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: argConfig.extensions && (0, _toObjMap.default)(argConfig.extensions), + astNode: argConfig.astNode + }; + }); + } + + var _proto = GraphQLDirective.prototype; + + _proto.toConfig = function toConfig() { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: (0, _definition.argsToArgsConfig)(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode + }; + }; + + _proto.toString = function toString() { + return '@' + this.name; + }; + + _proto.toJSON = function toJSON() { + return this.toString(); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLDirective, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLDirective'; + } + }]); + + return GraphQLDirective; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + + +exports.GraphQLDirective = GraphQLDirective; +(0, _defineInspect.default)(GraphQLDirective); + +/** + * Used to conditionally include fields or fragments. + */ +var GraphQLIncludeDirective = new GraphQLDirective({ + name: 'include', + description: 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Included when true.' + } + } +}); +/** + * Used to conditionally skip (exclude) fields or fragments. + */ + +exports.GraphQLIncludeDirective = GraphQLIncludeDirective; +var GraphQLSkipDirective = new GraphQLDirective({ + name: 'skip', + description: 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Skipped when true.' + } + } +}); +/** + * Constant string used for default reason for a deprecation. + */ + +exports.GraphQLSkipDirective = GraphQLSkipDirective; +var DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ + +exports.DEFAULT_DEPRECATION_REASON = DEFAULT_DEPRECATION_REASON; +var GraphQLDeprecatedDirective = new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [_directiveLocation.DirectiveLocation.FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ENUM_VALUE], + args: { + reason: { + type: _scalars.GraphQLString, + description: 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON + } + } +}); +/** + * Used to provide a URL for specifying the behaviour of custom scalar definitions. + */ + +exports.GraphQLDeprecatedDirective = GraphQLDeprecatedDirective; +var GraphQLSpecifiedByDirective = new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behaviour of this scalar.', + locations: [_directiveLocation.DirectiveLocation.SCALAR], + args: { + url: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The URL that specifies the behaviour of this scalar.' + } + } +}); +/** + * The full list of specified directives. + */ + +exports.GraphQLSpecifiedByDirective = GraphQLSpecifiedByDirective; +var specifiedDirectives = Object.freeze([GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective]); +exports.specifiedDirectives = specifiedDirectives; + +function isSpecifiedDirective(directive) { + return specifiedDirectives.some(function (_ref2) { + var name = _ref2.name; + return name === directive.name; + }); +} + + +/***/ }), + +/***/ 63280: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "isSchema", ({ + enumerable: true, + get: function get() { + return _schema.isSchema; + } +})); +Object.defineProperty(exports, "assertSchema", ({ + enumerable: true, + get: function get() { + return _schema.assertSchema; + } +})); +Object.defineProperty(exports, "GraphQLSchema", ({ + enumerable: true, + get: function get() { + return _schema.GraphQLSchema; + } +})); +Object.defineProperty(exports, "isType", ({ + enumerable: true, + get: function get() { + return _definition.isType; + } +})); +Object.defineProperty(exports, "isScalarType", ({ + enumerable: true, + get: function get() { + return _definition.isScalarType; + } +})); +Object.defineProperty(exports, "isObjectType", ({ + enumerable: true, + get: function get() { + return _definition.isObjectType; + } +})); +Object.defineProperty(exports, "isInterfaceType", ({ + enumerable: true, + get: function get() { + return _definition.isInterfaceType; + } +})); +Object.defineProperty(exports, "isUnionType", ({ + enumerable: true, + get: function get() { + return _definition.isUnionType; + } +})); +Object.defineProperty(exports, "isEnumType", ({ + enumerable: true, + get: function get() { + return _definition.isEnumType; + } +})); +Object.defineProperty(exports, "isInputObjectType", ({ + enumerable: true, + get: function get() { + return _definition.isInputObjectType; + } +})); +Object.defineProperty(exports, "isListType", ({ + enumerable: true, + get: function get() { + return _definition.isListType; + } +})); +Object.defineProperty(exports, "isNonNullType", ({ + enumerable: true, + get: function get() { + return _definition.isNonNullType; + } +})); +Object.defineProperty(exports, "isInputType", ({ + enumerable: true, + get: function get() { + return _definition.isInputType; + } +})); +Object.defineProperty(exports, "isOutputType", ({ + enumerable: true, + get: function get() { + return _definition.isOutputType; + } +})); +Object.defineProperty(exports, "isLeafType", ({ + enumerable: true, + get: function get() { + return _definition.isLeafType; + } +})); +Object.defineProperty(exports, "isCompositeType", ({ + enumerable: true, + get: function get() { + return _definition.isCompositeType; + } +})); +Object.defineProperty(exports, "isAbstractType", ({ + enumerable: true, + get: function get() { + return _definition.isAbstractType; + } +})); +Object.defineProperty(exports, "isWrappingType", ({ + enumerable: true, + get: function get() { + return _definition.isWrappingType; + } +})); +Object.defineProperty(exports, "isNullableType", ({ + enumerable: true, + get: function get() { + return _definition.isNullableType; + } +})); +Object.defineProperty(exports, "isNamedType", ({ + enumerable: true, + get: function get() { + return _definition.isNamedType; + } +})); +Object.defineProperty(exports, "isRequiredArgument", ({ + enumerable: true, + get: function get() { + return _definition.isRequiredArgument; + } +})); +Object.defineProperty(exports, "isRequiredInputField", ({ + enumerable: true, + get: function get() { + return _definition.isRequiredInputField; + } +})); +Object.defineProperty(exports, "assertType", ({ + enumerable: true, + get: function get() { + return _definition.assertType; + } +})); +Object.defineProperty(exports, "assertScalarType", ({ + enumerable: true, + get: function get() { + return _definition.assertScalarType; + } +})); +Object.defineProperty(exports, "assertObjectType", ({ + enumerable: true, + get: function get() { + return _definition.assertObjectType; + } +})); +Object.defineProperty(exports, "assertInterfaceType", ({ + enumerable: true, + get: function get() { + return _definition.assertInterfaceType; + } +})); +Object.defineProperty(exports, "assertUnionType", ({ + enumerable: true, + get: function get() { + return _definition.assertUnionType; + } +})); +Object.defineProperty(exports, "assertEnumType", ({ + enumerable: true, + get: function get() { + return _definition.assertEnumType; + } +})); +Object.defineProperty(exports, "assertInputObjectType", ({ + enumerable: true, + get: function get() { + return _definition.assertInputObjectType; + } +})); +Object.defineProperty(exports, "assertListType", ({ + enumerable: true, + get: function get() { + return _definition.assertListType; + } +})); +Object.defineProperty(exports, "assertNonNullType", ({ + enumerable: true, + get: function get() { + return _definition.assertNonNullType; + } +})); +Object.defineProperty(exports, "assertInputType", ({ + enumerable: true, + get: function get() { + return _definition.assertInputType; + } +})); +Object.defineProperty(exports, "assertOutputType", ({ + enumerable: true, + get: function get() { + return _definition.assertOutputType; + } +})); +Object.defineProperty(exports, "assertLeafType", ({ + enumerable: true, + get: function get() { + return _definition.assertLeafType; + } +})); +Object.defineProperty(exports, "assertCompositeType", ({ + enumerable: true, + get: function get() { + return _definition.assertCompositeType; + } +})); +Object.defineProperty(exports, "assertAbstractType", ({ + enumerable: true, + get: function get() { + return _definition.assertAbstractType; + } +})); +Object.defineProperty(exports, "assertWrappingType", ({ + enumerable: true, + get: function get() { + return _definition.assertWrappingType; + } +})); +Object.defineProperty(exports, "assertNullableType", ({ + enumerable: true, + get: function get() { + return _definition.assertNullableType; + } +})); +Object.defineProperty(exports, "assertNamedType", ({ + enumerable: true, + get: function get() { + return _definition.assertNamedType; + } +})); +Object.defineProperty(exports, "getNullableType", ({ + enumerable: true, + get: function get() { + return _definition.getNullableType; + } +})); +Object.defineProperty(exports, "getNamedType", ({ + enumerable: true, + get: function get() { + return _definition.getNamedType; + } +})); +Object.defineProperty(exports, "GraphQLScalarType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLScalarType; + } +})); +Object.defineProperty(exports, "GraphQLObjectType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLObjectType; + } +})); +Object.defineProperty(exports, "GraphQLInterfaceType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLInterfaceType; + } +})); +Object.defineProperty(exports, "GraphQLUnionType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLUnionType; + } +})); +Object.defineProperty(exports, "GraphQLEnumType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLEnumType; + } +})); +Object.defineProperty(exports, "GraphQLInputObjectType", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLInputObjectType; + } +})); +Object.defineProperty(exports, "GraphQLList", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLList; + } +})); +Object.defineProperty(exports, "GraphQLNonNull", ({ + enumerable: true, + get: function get() { + return _definition.GraphQLNonNull; + } +})); +Object.defineProperty(exports, "isDirective", ({ + enumerable: true, + get: function get() { + return _directives.isDirective; + } +})); +Object.defineProperty(exports, "assertDirective", ({ + enumerable: true, + get: function get() { + return _directives.assertDirective; + } +})); +Object.defineProperty(exports, "GraphQLDirective", ({ + enumerable: true, + get: function get() { + return _directives.GraphQLDirective; + } +})); +Object.defineProperty(exports, "isSpecifiedDirective", ({ + enumerable: true, + get: function get() { + return _directives.isSpecifiedDirective; + } +})); +Object.defineProperty(exports, "specifiedDirectives", ({ + enumerable: true, + get: function get() { + return _directives.specifiedDirectives; + } +})); +Object.defineProperty(exports, "GraphQLIncludeDirective", ({ + enumerable: true, + get: function get() { + return _directives.GraphQLIncludeDirective; + } +})); +Object.defineProperty(exports, "GraphQLSkipDirective", ({ + enumerable: true, + get: function get() { + return _directives.GraphQLSkipDirective; + } +})); +Object.defineProperty(exports, "GraphQLDeprecatedDirective", ({ + enumerable: true, + get: function get() { + return _directives.GraphQLDeprecatedDirective; + } +})); +Object.defineProperty(exports, "GraphQLSpecifiedByDirective", ({ + enumerable: true, + get: function get() { + return _directives.GraphQLSpecifiedByDirective; + } +})); +Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", ({ + enumerable: true, + get: function get() { + return _directives.DEFAULT_DEPRECATION_REASON; + } +})); +Object.defineProperty(exports, "isSpecifiedScalarType", ({ + enumerable: true, + get: function get() { + return _scalars.isSpecifiedScalarType; + } +})); +Object.defineProperty(exports, "specifiedScalarTypes", ({ + enumerable: true, + get: function get() { + return _scalars.specifiedScalarTypes; + } +})); +Object.defineProperty(exports, "GraphQLInt", ({ + enumerable: true, + get: function get() { + return _scalars.GraphQLInt; + } +})); +Object.defineProperty(exports, "GraphQLFloat", ({ + enumerable: true, + get: function get() { + return _scalars.GraphQLFloat; + } +})); +Object.defineProperty(exports, "GraphQLString", ({ + enumerable: true, + get: function get() { + return _scalars.GraphQLString; + } +})); +Object.defineProperty(exports, "GraphQLBoolean", ({ + enumerable: true, + get: function get() { + return _scalars.GraphQLBoolean; + } +})); +Object.defineProperty(exports, "GraphQLID", ({ + enumerable: true, + get: function get() { + return _scalars.GraphQLID; + } +})); +Object.defineProperty(exports, "isIntrospectionType", ({ + enumerable: true, + get: function get() { + return _introspection.isIntrospectionType; + } +})); +Object.defineProperty(exports, "introspectionTypes", ({ + enumerable: true, + get: function get() { + return _introspection.introspectionTypes; + } +})); +Object.defineProperty(exports, "__Schema", ({ + enumerable: true, + get: function get() { + return _introspection.__Schema; + } +})); +Object.defineProperty(exports, "__Directive", ({ + enumerable: true, + get: function get() { + return _introspection.__Directive; + } +})); +Object.defineProperty(exports, "__DirectiveLocation", ({ + enumerable: true, + get: function get() { + return _introspection.__DirectiveLocation; + } +})); +Object.defineProperty(exports, "__Type", ({ + enumerable: true, + get: function get() { + return _introspection.__Type; + } +})); +Object.defineProperty(exports, "__Field", ({ + enumerable: true, + get: function get() { + return _introspection.__Field; + } +})); +Object.defineProperty(exports, "__InputValue", ({ + enumerable: true, + get: function get() { + return _introspection.__InputValue; + } +})); +Object.defineProperty(exports, "__EnumValue", ({ + enumerable: true, + get: function get() { + return _introspection.__EnumValue; + } +})); +Object.defineProperty(exports, "__TypeKind", ({ + enumerable: true, + get: function get() { + return _introspection.__TypeKind; + } +})); +Object.defineProperty(exports, "TypeKind", ({ + enumerable: true, + get: function get() { + return _introspection.TypeKind; + } +})); +Object.defineProperty(exports, "SchemaMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _introspection.SchemaMetaFieldDef; + } +})); +Object.defineProperty(exports, "TypeMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _introspection.TypeMetaFieldDef; + } +})); +Object.defineProperty(exports, "TypeNameMetaFieldDef", ({ + enumerable: true, + get: function get() { + return _introspection.TypeNameMetaFieldDef; + } +})); +Object.defineProperty(exports, "validateSchema", ({ + enumerable: true, + get: function get() { + return _validate.validateSchema; + } +})); +Object.defineProperty(exports, "assertValidSchema", ({ + enumerable: true, + get: function get() { + return _validate.assertValidSchema; + } +})); + +var _schema = __nccwpck_require__(8505); + +var _definition = __nccwpck_require__(5821); + +var _directives = __nccwpck_require__(83614); + +var _scalars = __nccwpck_require__(93145); + +var _introspection = __nccwpck_require__(28344); + +var _validate = __nccwpck_require__(22430); + + +/***/ }), + +/***/ 28344: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isIntrospectionType = isIntrospectionType; +exports.introspectionTypes = exports.TypeNameMetaFieldDef = exports.TypeMetaFieldDef = exports.SchemaMetaFieldDef = exports.__TypeKind = exports.TypeKind = exports.__EnumValue = exports.__InputValue = exports.__Field = exports.__Type = exports.__DirectiveLocation = exports.__Directive = exports.__Schema = void 0; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _printer = __nccwpck_require__(68203); + +var _directiveLocation = __nccwpck_require__(81205); + +var _astFromValue = __nccwpck_require__(12653); + +var _scalars = __nccwpck_require__(93145); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __Schema = new _definition.GraphQLObjectType({ + name: '__Schema', + description: 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: function fields() { + return { + description: { + type: _scalars.GraphQLString, + resolve: function resolve(schema) { + return schema.description; + } + }, + types: { + description: 'A list of all types supported by this server.', + type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type))), + resolve: function resolve(schema) { + return (0, _objectValues.default)(schema.getTypeMap()); + } + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new _definition.GraphQLNonNull(__Type), + resolve: function resolve(schema) { + return schema.getQueryType(); + } + }, + mutationType: { + description: 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: function resolve(schema) { + return schema.getMutationType(); + } + }, + subscriptionType: { + description: 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: function resolve(schema) { + return schema.getSubscriptionType(); + } + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Directive))), + resolve: function resolve(schema) { + return schema.getDirectives(); + } + } + }; + } +}); + +exports.__Schema = __Schema; + +var __Directive = new _definition.GraphQLObjectType({ + name: '__Directive', + description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: function fields() { + return { + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: function resolve(directive) { + return directive.name; + } + }, + description: { + type: _scalars.GraphQLString, + resolve: function resolve(directive) { + return directive.description; + } + }, + isRepeatable: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: function resolve(directive) { + return directive.isRepeatable; + } + }, + locations: { + type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__DirectiveLocation))), + resolve: function resolve(directive) { + return directive.locations; + } + }, + args: { + type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))), + resolve: function resolve(directive) { + return directive.args; + } + } + }; + } +}); + +exports.__Directive = __Directive; + +var __DirectiveLocation = new _definition.GraphQLEnumType({ + name: '__DirectiveLocation', + description: 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: _directiveLocation.DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.' + }, + MUTATION: { + value: _directiveLocation.DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.' + }, + SUBSCRIPTION: { + value: _directiveLocation.DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.' + }, + FIELD: { + value: _directiveLocation.DirectiveLocation.FIELD, + description: 'Location adjacent to a field.' + }, + FRAGMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.' + }, + FRAGMENT_SPREAD: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.' + }, + INLINE_FRAGMENT: { + value: _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.' + }, + VARIABLE_DEFINITION: { + value: _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.' + }, + SCHEMA: { + value: _directiveLocation.DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.' + }, + SCALAR: { + value: _directiveLocation.DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.' + }, + OBJECT: { + value: _directiveLocation.DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.' + }, + FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.' + }, + ARGUMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.' + }, + INTERFACE: { + value: _directiveLocation.DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.' + }, + UNION: { + value: _directiveLocation.DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.' + }, + ENUM: { + value: _directiveLocation.DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.' + }, + ENUM_VALUE: { + value: _directiveLocation.DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.' + }, + INPUT_OBJECT: { + value: _directiveLocation.DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.' + }, + INPUT_FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.' + } + } +}); + +exports.__DirectiveLocation = __DirectiveLocation; + +var __Type = new _definition.GraphQLObjectType({ + name: '__Type', + description: 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: function fields() { + return { + kind: { + type: new _definition.GraphQLNonNull(__TypeKind), + resolve: function resolve(type) { + if ((0, _definition.isScalarType)(type)) { + return TypeKind.SCALAR; + } + + if ((0, _definition.isObjectType)(type)) { + return TypeKind.OBJECT; + } + + if ((0, _definition.isInterfaceType)(type)) { + return TypeKind.INTERFACE; + } + + if ((0, _definition.isUnionType)(type)) { + return TypeKind.UNION; + } + + if ((0, _definition.isEnumType)(type)) { + return TypeKind.ENUM; + } + + if ((0, _definition.isInputObjectType)(type)) { + return TypeKind.INPUT_OBJECT; + } + + if ((0, _definition.isListType)(type)) { + return TypeKind.LIST; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isNonNullType)(type)) { + return TypeKind.NON_NULL; + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, "Unexpected type: \"".concat((0, _inspect.default)(type), "\".")); + } + }, + name: { + type: _scalars.GraphQLString, + resolve: function resolve(type) { + return type.name !== undefined ? type.name : undefined; + } + }, + description: { + type: _scalars.GraphQLString, + resolve: function resolve(type) { + return type.description !== undefined ? type.description : undefined; + } + }, + specifiedByUrl: { + type: _scalars.GraphQLString, + resolve: function resolve(obj) { + return obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined; + } + }, + fields: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Field)), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false + } + }, + resolve: function resolve(type, _ref) { + var includeDeprecated = _ref.includeDeprecated; + + if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { + var fields = (0, _objectValues.default)(type.getFields()); + return includeDeprecated ? fields : fields.filter(function (field) { + return field.deprecationReason == null; + }); + } + } + }, + interfaces: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + resolve: function resolve(type) { + if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { + return type.getInterfaces(); + } + } + }, + possibleTypes: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + resolve: function resolve(type, _args, _context, _ref2) { + var schema = _ref2.schema; + + if ((0, _definition.isAbstractType)(type)) { + return schema.getPossibleTypes(type); + } + } + }, + enumValues: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__EnumValue)), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false + } + }, + resolve: function resolve(type, _ref3) { + var includeDeprecated = _ref3.includeDeprecated; + + if ((0, _definition.isEnumType)(type)) { + var values = type.getValues(); + return includeDeprecated ? values : values.filter(function (field) { + return field.deprecationReason == null; + }); + } + } + }, + inputFields: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue)), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false + } + }, + resolve: function resolve(type, _ref4) { + var includeDeprecated = _ref4.includeDeprecated; + + if ((0, _definition.isInputObjectType)(type)) { + var values = (0, _objectValues.default)(type.getFields()); + return includeDeprecated ? values : values.filter(function (field) { + return field.deprecationReason == null; + }); + } + } + }, + ofType: { + type: __Type, + resolve: function resolve(type) { + return type.ofType !== undefined ? type.ofType : undefined; + } + } + }; + } +}); + +exports.__Type = __Type; + +var __Field = new _definition.GraphQLObjectType({ + name: '__Field', + description: 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: function fields() { + return { + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: function resolve(field) { + return field.name; + } + }, + description: { + type: _scalars.GraphQLString, + resolve: function resolve(field) { + return field.description; + } + }, + args: { + type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false + } + }, + resolve: function resolve(field, _ref5) { + var includeDeprecated = _ref5.includeDeprecated; + return includeDeprecated ? field.args : field.args.filter(function (arg) { + return arg.deprecationReason == null; + }); + } + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: function resolve(field) { + return field.type; + } + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: function resolve(field) { + return field.deprecationReason != null; + } + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: function resolve(field) { + return field.deprecationReason; + } + } + }; + } +}); + +exports.__Field = __Field; + +var __InputValue = new _definition.GraphQLObjectType({ + name: '__InputValue', + description: 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: function fields() { + return { + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: function resolve(inputValue) { + return inputValue.name; + } + }, + description: { + type: _scalars.GraphQLString, + resolve: function resolve(inputValue) { + return inputValue.description; + } + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: function resolve(inputValue) { + return inputValue.type; + } + }, + defaultValue: { + type: _scalars.GraphQLString, + description: 'A GraphQL-formatted string representing the default value for this input value.', + resolve: function resolve(inputValue) { + var type = inputValue.type, + defaultValue = inputValue.defaultValue; + var valueAST = (0, _astFromValue.astFromValue)(defaultValue, type); + return valueAST ? (0, _printer.print)(valueAST) : null; + } + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: function resolve(field) { + return field.deprecationReason != null; + } + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: function resolve(obj) { + return obj.deprecationReason; + } + } + }; + } +}); + +exports.__InputValue = __InputValue; + +var __EnumValue = new _definition.GraphQLObjectType({ + name: '__EnumValue', + description: 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: function fields() { + return { + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: function resolve(enumValue) { + return enumValue.name; + } + }, + description: { + type: _scalars.GraphQLString, + resolve: function resolve(enumValue) { + return enumValue.description; + } + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: function resolve(enumValue) { + return enumValue.deprecationReason != null; + } + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: function resolve(enumValue) { + return enumValue.deprecationReason; + } + } + }; + } +}); + +exports.__EnumValue = __EnumValue; +var TypeKind = Object.freeze({ + SCALAR: 'SCALAR', + OBJECT: 'OBJECT', + INTERFACE: 'INTERFACE', + UNION: 'UNION', + ENUM: 'ENUM', + INPUT_OBJECT: 'INPUT_OBJECT', + LIST: 'LIST', + NON_NULL: 'NON_NULL' +}); +exports.TypeKind = TypeKind; + +var __TypeKind = new _definition.GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.' + }, + OBJECT: { + value: TypeKind.OBJECT, + description: 'Indicates this type is an object. `fields` and `interfaces` are valid fields.' + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.' + }, + UNION: { + value: TypeKind.UNION, + description: 'Indicates this type is a union. `possibleTypes` is a valid field.' + }, + ENUM: { + value: TypeKind.ENUM, + description: 'Indicates this type is an enum. `enumValues` is a valid field.' + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: 'Indicates this type is an input object. `inputFields` is a valid field.' + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.' + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: 'Indicates this type is a non-null. `ofType` is a valid field.' + } + } +}); +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + + +exports.__TypeKind = __TypeKind; +var SchemaMetaFieldDef = { + name: '__schema', + type: new _definition.GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: function resolve(_source, _args, _context, _ref6) { + var schema = _ref6.schema; + return schema; + }, + isDeprecated: false, + deprecationReason: undefined, + extensions: undefined, + astNode: undefined +}; +exports.SchemaMetaFieldDef = SchemaMetaFieldDef; +var TypeMetaFieldDef = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [{ + name: 'name', + description: undefined, + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: undefined, + astNode: undefined + }], + resolve: function resolve(_source, _ref7, _context, _ref8) { + var name = _ref7.name; + var schema = _ref8.schema; + return schema.getType(name); + }, + isDeprecated: false, + deprecationReason: undefined, + extensions: undefined, + astNode: undefined +}; +exports.TypeMetaFieldDef = TypeMetaFieldDef; +var TypeNameMetaFieldDef = { + name: '__typename', + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: function resolve(_source, _args, _context, _ref9) { + var parentType = _ref9.parentType; + return parentType.name; + }, + isDeprecated: false, + deprecationReason: undefined, + extensions: undefined, + astNode: undefined +}; +exports.TypeNameMetaFieldDef = TypeNameMetaFieldDef; +var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind]); +exports.introspectionTypes = introspectionTypes; + +function isIntrospectionType(type) { + return introspectionTypes.some(function (_ref10) { + var name = _ref10.name; + return type.name === name; + }); +} + + +/***/ }), + +/***/ 93145: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isSpecifiedScalarType = isSpecifiedScalarType; +exports.specifiedScalarTypes = exports.GraphQLID = exports.GraphQLBoolean = exports.GraphQLString = exports.GraphQLFloat = exports.GraphQLInt = void 0; + +var _isFinite = _interopRequireDefault(__nccwpck_require__(78473)); + +var _isInteger = _interopRequireDefault(__nccwpck_require__(15813)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _kinds = __nccwpck_require__(11927); + +var _printer = __nccwpck_require__(68203); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// As per the GraphQL Spec, Integers are only treated as valid when a valid +// 32-bit signed integer, providing the broadest support across platforms. +// +// n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because +// they are internally represented as IEEE 754 doubles. +var MAX_INT = 2147483647; +var MIN_INT = -2147483648; + +function serializeInt(outputValue) { + var coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + var num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (!(0, _isInteger.default)(num)) { + throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _inspect.default)(coercedValue))); + } + + if (num > MAX_INT || num < MIN_INT) { + throw new _GraphQLError.GraphQLError('Int cannot represent non 32-bit signed integer value: ' + (0, _inspect.default)(coercedValue)); + } + + return num; +} + +function coerceInt(inputValue) { + if (!(0, _isInteger.default)(inputValue)) { + throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _inspect.default)(inputValue))); + } + + if (inputValue > MAX_INT || inputValue < MIN_INT) { + throw new _GraphQLError.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(inputValue)); + } + + return inputValue; +} + +var GraphQLInt = new _definition.GraphQLScalarType({ + name: 'Int', + description: 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + serialize: serializeInt, + parseValue: coerceInt, + parseLiteral: function parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.INT) { + throw new _GraphQLError.GraphQLError("Int cannot represent non-integer value: ".concat((0, _printer.print)(valueNode)), valueNode); + } + + var num = parseInt(valueNode.value, 10); + + if (num > MAX_INT || num < MIN_INT) { + throw new _GraphQLError.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(valueNode.value), valueNode); + } + + return num; + } +}); +exports.GraphQLInt = GraphQLInt; + +function serializeFloat(outputValue) { + var coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + var num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (!(0, _isFinite.default)(num)) { + throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _inspect.default)(coercedValue))); + } + + return num; +} + +function coerceFloat(inputValue) { + if (!(0, _isFinite.default)(inputValue)) { + throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _inspect.default)(inputValue))); + } + + return inputValue; +} + +var GraphQLFloat = new _definition.GraphQLScalarType({ + name: 'Float', + description: 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + serialize: serializeFloat, + parseValue: coerceFloat, + parseLiteral: function parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.FLOAT && valueNode.kind !== _kinds.Kind.INT) { + throw new _GraphQLError.GraphQLError("Float cannot represent non numeric value: ".concat((0, _printer.print)(valueNode)), valueNode); + } + + return parseFloat(valueNode.value); + } +}); // Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). + +exports.GraphQLFloat = GraphQLFloat; + +function serializeObject(outputValue) { + if ((0, _isObjectLike.default)(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + var valueOfResult = outputValue.valueOf(); + + if (!(0, _isObjectLike.default)(valueOfResult)) { + return valueOfResult; + } + } + + if (typeof outputValue.toJSON === 'function') { + // $FlowFixMe[incompatible-use] + return outputValue.toJSON(); + } + } + + return outputValue; +} + +function serializeString(outputValue) { + var coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + + if ((0, _isFinite.default)(coercedValue)) { + return coercedValue.toString(); + } + + throw new _GraphQLError.GraphQLError("String cannot represent value: ".concat((0, _inspect.default)(outputValue))); +} + +function coerceString(inputValue) { + if (typeof inputValue !== 'string') { + throw new _GraphQLError.GraphQLError("String cannot represent a non string value: ".concat((0, _inspect.default)(inputValue))); + } + + return inputValue; +} + +var GraphQLString = new _definition.GraphQLScalarType({ + name: 'String', + description: 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + serialize: serializeString, + parseValue: coerceString, + parseLiteral: function parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.STRING) { + throw new _GraphQLError.GraphQLError("String cannot represent a non string value: ".concat((0, _printer.print)(valueNode)), valueNode); + } + + return valueNode.value; + } +}); +exports.GraphQLString = GraphQLString; + +function serializeBoolean(outputValue) { + var coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + + if ((0, _isFinite.default)(coercedValue)) { + return coercedValue !== 0; + } + + throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _inspect.default)(coercedValue))); +} + +function coerceBoolean(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _inspect.default)(inputValue))); + } + + return inputValue; +} + +var GraphQLBoolean = new _definition.GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + serialize: serializeBoolean, + parseValue: coerceBoolean, + parseLiteral: function parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.BOOLEAN) { + throw new _GraphQLError.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0, _printer.print)(valueNode)), valueNode); + } + + return valueNode.value; + } +}); +exports.GraphQLBoolean = GraphQLBoolean; + +function serializeID(outputValue) { + var coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if ((0, _isInteger.default)(coercedValue)) { + return String(coercedValue); + } + + throw new _GraphQLError.GraphQLError("ID cannot represent value: ".concat((0, _inspect.default)(outputValue))); +} + +function coerceID(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + + if ((0, _isInteger.default)(inputValue)) { + return inputValue.toString(); + } + + throw new _GraphQLError.GraphQLError("ID cannot represent value: ".concat((0, _inspect.default)(inputValue))); +} + +var GraphQLID = new _definition.GraphQLScalarType({ + name: 'ID', + description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + serialize: serializeID, + parseValue: coerceID, + parseLiteral: function parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.STRING && valueNode.kind !== _kinds.Kind.INT) { + throw new _GraphQLError.GraphQLError('ID cannot represent a non-string and non-integer value: ' + (0, _printer.print)(valueNode), valueNode); + } + + return valueNode.value; + } +}); +exports.GraphQLID = GraphQLID; +var specifiedScalarTypes = Object.freeze([GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID]); +exports.specifiedScalarTypes = specifiedScalarTypes; + +function isSpecifiedScalarType(type) { + return specifiedScalarTypes.some(function (_ref) { + var name = _ref.name; + return type.name === name; + }); +} + + +/***/ }), + +/***/ 8505: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isSchema = isSchema; +exports.assertSchema = assertSchema; +exports.GraphQLSchema = void 0; + +var _find = _interopRequireDefault(__nccwpck_require__(57649)); + +var _arrayFrom3 = _interopRequireDefault(__nccwpck_require__(86839)); + +var _objectValues5 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _symbols = __nccwpck_require__(3255); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _toObjMap = _interopRequireDefault(__nccwpck_require__(74728)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _instanceOf = _interopRequireDefault(__nccwpck_require__(93481)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _introspection = __nccwpck_require__(28344); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +// eslint-disable-next-line no-redeclare +function isSchema(schema) { + return (0, _instanceOf.default)(schema, GraphQLSchema); +} + +function assertSchema(schema) { + if (!isSchema(schema)) { + throw new Error("Expected ".concat((0, _inspect.default)(schema), " to be a GraphQL schema.")); + } + + return schema; +} +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. @include and + * @skip) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * + */ + + +var GraphQLSchema = /*#__PURE__*/function () { + // Used as a cache for validateSchema(). + function GraphQLSchema(config) { + var _config$directives; + + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + (0, _isObjectLike.default)(config) || (0, _devAssert.default)(0, 'Must provide configuration object.'); + !config.types || Array.isArray(config.types) || (0, _devAssert.default)(0, "\"types\" must be Array if provided but got: ".concat((0, _inspect.default)(config.types), ".")); + !config.directives || Array.isArray(config.directives) || (0, _devAssert.default)(0, '"directives" must be Array if provided but got: ' + "".concat((0, _inspect.default)(config.directives), ".")); + this.description = config.description; + this.extensions = config.extensions && (0, _toObjMap.default)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes; + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : _directives.specifiedDirectives; // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + + var allReferencedTypes = new Set(config.types); + + if (config.types != null) { + for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { + var type = _config$types2[_i2]; + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (var _i4 = 0, _this$_directives2 = this._directives; _i4 < _this$_directives2.length; _i4++) { + var directive = _this$_directives2[_i4]; + + // Directives are not validated until validateSchema() is called. + if ((0, _directives.isDirective)(directive)) { + for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { + var arg = _directive$args2[_i6]; + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + + collectReferencedTypes(_introspection.__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + + this._implementationsMap = Object.create(null); + + for (var _i8 = 0, _arrayFrom2 = (0, _arrayFrom3.default)(allReferencedTypes); _i8 < _arrayFrom2.length; _i8++) { + var namedType = _arrayFrom2[_i8]; + + if (namedType == null) { + continue; + } + + var typeName = namedType.name; + typeName || (0, _devAssert.default)(0, 'One of the provided types for building the Schema is missing a name.'); + + if (this._typeMap[typeName] !== undefined) { + throw new Error("Schema must contain uniquely named types but contains multiple types named \"".concat(typeName, "\".")); + } + + this._typeMap[typeName] = namedType; + + if ((0, _definition.isInterfaceType)(namedType)) { + // Store implementations by interface. + for (var _i10 = 0, _namedType$getInterfa2 = namedType.getInterfaces(); _i10 < _namedType$getInterfa2.length; _i10++) { + var iface = _namedType$getInterfa2[_i10]; + + if ((0, _definition.isInterfaceType)(iface)) { + var implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [] + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if ((0, _definition.isObjectType)(namedType)) { + // Store implementations by objects. + for (var _i12 = 0, _namedType$getInterfa4 = namedType.getInterfaces(); _i12 < _namedType$getInterfa4.length; _i12++) { + var _iface = _namedType$getInterfa4[_i12]; + + if ((0, _definition.isInterfaceType)(_iface)) { + var _implementations = this._implementationsMap[_iface.name]; + + if (_implementations === undefined) { + _implementations = this._implementationsMap[_iface.name] = { + objects: [], + interfaces: [] + }; + } + + _implementations.objects.push(namedType); + } + } + } + } + } + + var _proto = GraphQLSchema.prototype; + + _proto.getQueryType = function getQueryType() { + return this._queryType; + }; + + _proto.getMutationType = function getMutationType() { + return this._mutationType; + }; + + _proto.getSubscriptionType = function getSubscriptionType() { + return this._subscriptionType; + }; + + _proto.getTypeMap = function getTypeMap() { + return this._typeMap; + }; + + _proto.getType = function getType(name) { + return this.getTypeMap()[name]; + }; + + _proto.getPossibleTypes = function getPossibleTypes(abstractType) { + return (0, _definition.isUnionType)(abstractType) ? abstractType.getTypes() : this.getImplementations(abstractType).objects; + }; + + _proto.getImplementations = function getImplementations(interfaceType) { + var implementations = this._implementationsMap[interfaceType.name]; + return implementations !== null && implementations !== void 0 ? implementations : { + objects: [], + interfaces: [] + }; + } // @deprecated: use isSubType instead - will be removed in v16. + ; + + _proto.isPossibleType = function isPossibleType(abstractType, possibleType) { + return this.isSubType(abstractType, possibleType); + }; + + _proto.isSubType = function isSubType(abstractType, maybeSubType) { + var map = this._subTypeMap[abstractType.name]; + + if (map === undefined) { + map = Object.create(null); + + if ((0, _definition.isUnionType)(abstractType)) { + for (var _i14 = 0, _abstractType$getType2 = abstractType.getTypes(); _i14 < _abstractType$getType2.length; _i14++) { + var type = _abstractType$getType2[_i14]; + map[type.name] = true; + } + } else { + var implementations = this.getImplementations(abstractType); + + for (var _i16 = 0, _implementations$obje2 = implementations.objects; _i16 < _implementations$obje2.length; _i16++) { + var _type = _implementations$obje2[_i16]; + map[_type.name] = true; + } + + for (var _i18 = 0, _implementations$inte2 = implementations.interfaces; _i18 < _implementations$inte2.length; _i18++) { + var _type2 = _implementations$inte2[_i18]; + map[_type2.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + + return map[maybeSubType.name] !== undefined; + }; + + _proto.getDirectives = function getDirectives() { + return this._directives; + }; + + _proto.getDirective = function getDirective(name) { + return (0, _find.default)(this.getDirectives(), function (directive) { + return directive.name === name; + }); + }; + + _proto.toConfig = function toConfig() { + var _this$extensionASTNod; + + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: (0, _objectValues5.default)(this.getTypeMap()), + directives: this.getDirectives().slice(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : [], + assumeValid: this.__validationErrors !== undefined + }; + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + ; + + _createClass(GraphQLSchema, [{ + key: _symbols.SYMBOL_TO_STRING_TAG, + get: function get() { + return 'GraphQLSchema'; + } + }]); + + return GraphQLSchema; +}(); + +exports.GraphQLSchema = GraphQLSchema; + +function collectReferencedTypes(type, typeSet) { + var namedType = (0, _definition.getNamedType)(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + + if ((0, _definition.isUnionType)(namedType)) { + for (var _i20 = 0, _namedType$getTypes2 = namedType.getTypes(); _i20 < _namedType$getTypes2.length; _i20++) { + var memberType = _namedType$getTypes2[_i20]; + collectReferencedTypes(memberType, typeSet); + } + } else if ((0, _definition.isObjectType)(namedType) || (0, _definition.isInterfaceType)(namedType)) { + for (var _i22 = 0, _namedType$getInterfa6 = namedType.getInterfaces(); _i22 < _namedType$getInterfa6.length; _i22++) { + var interfaceType = _namedType$getInterfa6[_i22]; + collectReferencedTypes(interfaceType, typeSet); + } + + for (var _i24 = 0, _objectValues2 = (0, _objectValues5.default)(namedType.getFields()); _i24 < _objectValues2.length; _i24++) { + var field = _objectValues2[_i24]; + collectReferencedTypes(field.type, typeSet); + + for (var _i26 = 0, _field$args2 = field.args; _i26 < _field$args2.length; _i26++) { + var arg = _field$args2[_i26]; + collectReferencedTypes(arg.type, typeSet); + } + } + } else if ((0, _definition.isInputObjectType)(namedType)) { + for (var _i28 = 0, _objectValues4 = (0, _objectValues5.default)(namedType.getFields()); _i28 < _objectValues4.length; _i28++) { + var _field = _objectValues4[_i28]; + collectReferencedTypes(_field.type, typeSet); + } + } + } + + return typeSet; +} + + +/***/ }), + +/***/ 22430: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.validateSchema = validateSchema; +exports.assertValidSchema = assertValidSchema; + +var _find = _interopRequireDefault(__nccwpck_require__(57649)); + +var _objectValues5 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _locatedError = __nccwpck_require__(16842); + +var _assertValidName = __nccwpck_require__(25780); + +var _typeComparators = __nccwpck_require__(10333); + +var _schema = __nccwpck_require__(8505); + +var _introspection = __nccwpck_require__(28344); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +function validateSchema(schema) { + // First check to ensure the provided value is in fact a GraphQLSchema. + (0, _schema.assertSchema)(schema); // If this Schema has already been validated, return the previous results. + + if (schema.__validationErrors) { + return schema.__validationErrors; + } // Validate the schema, producing a list of errors. + + + var context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + + var errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ + + +function assertValidSchema(schema) { + var errors = validateSchema(schema); + + if (errors.length !== 0) { + throw new Error(errors.map(function (error) { + return error.message; + }).join('\n\n')); + } +} + +var SchemaValidationContext = /*#__PURE__*/function () { + function SchemaValidationContext(schema) { + this._errors = []; + this.schema = schema; + } + + var _proto = SchemaValidationContext.prototype; + + _proto.reportError = function reportError(message, nodes) { + var _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; + + this.addError(new _GraphQLError.GraphQLError(message, _nodes)); + }; + + _proto.addError = function addError(error) { + this._errors.push(error); + }; + + _proto.getErrors = function getErrors() { + return this._errors; + }; + + return SchemaValidationContext; +}(); + +function validateRootTypes(context) { + var schema = context.schema; + var queryType = schema.getQueryType(); + + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!(0, _definition.isObjectType)(queryType)) { + var _getOperationTypeNode; + + context.reportError("Query root type must be Object type, it cannot be ".concat((0, _inspect.default)(queryType), "."), (_getOperationTypeNode = getOperationTypeNode(schema, 'query')) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode); + } + + var mutationType = schema.getMutationType(); + + if (mutationType && !(0, _definition.isObjectType)(mutationType)) { + var _getOperationTypeNode2; + + context.reportError('Mutation root type must be Object type if provided, it cannot be ' + "".concat((0, _inspect.default)(mutationType), "."), (_getOperationTypeNode2 = getOperationTypeNode(schema, 'mutation')) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode); + } + + var subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && !(0, _definition.isObjectType)(subscriptionType)) { + var _getOperationTypeNode3; + + context.reportError('Subscription root type must be Object type if provided, it cannot be ' + "".concat((0, _inspect.default)(subscriptionType), "."), (_getOperationTypeNode3 = getOperationTypeNode(schema, 'subscription')) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode); + } +} + +function getOperationTypeNode(schema, operation) { + var operationNodes = getAllSubNodes(schema, function (node) { + return node.operationTypes; + }); + + for (var _i2 = 0; _i2 < operationNodes.length; _i2++) { + var node = operationNodes[_i2]; + + if (node.operation === operation) { + return node.type; + } + } + + return undefined; +} + +function validateDirectives(context) { + for (var _i4 = 0, _context$schema$getDi2 = context.schema.getDirectives(); _i4 < _context$schema$getDi2.length; _i4++) { + var directive = _context$schema$getDi2[_i4]; + + // Ensure all directives are in fact GraphQL directives. + if (!(0, _directives.isDirective)(directive)) { + context.reportError("Expected directive but got: ".concat((0, _inspect.default)(directive), "."), directive === null || directive === void 0 ? void 0 : directive.astNode); + continue; + } // Ensure they are named correctly. + + + validateName(context, directive); // TODO: Ensure proper locations. + // Ensure the arguments are valid. + + for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) { + var arg = _directive$args2[_i6]; + // Ensure they are named correctly. + validateName(context, arg); // Ensure the type is an input type. + + if (!(0, _definition.isInputType)(arg.type)) { + context.reportError("The type of @".concat(directive.name, "(").concat(arg.name, ":) must be Input Type ") + "but got: ".concat((0, _inspect.default)(arg.type), "."), arg.astNode); + } + + if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) { + var _arg$astNode; + + context.reportError("Required argument @".concat(directive.name, "(").concat(arg.name, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) + (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 ? void 0 : _arg$astNode.type]); + } + } + } +} + +function validateName(context, node) { + // Ensure names are valid, however introspection types opt out. + var error = (0, _assertValidName.isValidNameError)(node.name); + + if (error) { + context.addError((0, _locatedError.locatedError)(error, node.astNode)); + } +} + +function validateTypes(context) { + var validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context); + var typeMap = context.schema.getTypeMap(); + + for (var _i8 = 0, _objectValues2 = (0, _objectValues5.default)(typeMap); _i8 < _objectValues2.length; _i8++) { + var type = _objectValues2[_i8]; + + // Ensure all provided types are in fact GraphQL type. + if (!(0, _definition.isNamedType)(type)) { + context.reportError("Expected GraphQL named type but got: ".concat((0, _inspect.default)(type), "."), type.astNode); + continue; + } // Ensure it is named correctly (excluding introspection types). + + + if (!(0, _introspection.isIntrospectionType)(type)) { + validateName(context, type); + } + + if ((0, _definition.isObjectType)(type)) { + // Ensure fields are valid + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isInterfaceType)(type)) { + // Ensure fields are valid. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isUnionType)(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if ((0, _definition.isEnumType)(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if ((0, _definition.isInputObjectType)(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields(context, type) { + var fields = (0, _objectValues5.default)(type.getFields()); // Objects and Interfaces both must define one or more fields. + + if (fields.length === 0) { + context.reportError("Type ".concat(type.name, " must define one or more fields."), getAllNodes(type)); + } + + for (var _i10 = 0; _i10 < fields.length; _i10++) { + var field = fields[_i10]; + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an output type + + if (!(0, _definition.isOutputType)(field.type)) { + var _field$astNode; + + context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat((0, _inspect.default)(field.type), "."), (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type); + } // Ensure the arguments are valid + + + for (var _i12 = 0, _field$args2 = field.args; _i12 < _field$args2.length; _i12++) { + var arg = _field$args2[_i12]; + var argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(arg.type)) { + var _arg$astNode2; + + context.reportError("The type of ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) must be Input ") + "Type but got: ".concat((0, _inspect.default)(arg.type), "."), (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type); + } + + if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) { + var _arg$astNode3; + + context.reportError("Required argument ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) cannot be deprecated."), [getDeprecatedDirectiveNode(arg.astNode), // istanbul ignore next (TODO need to write coverage tests) + (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type]); + } + } + } +} + +function validateInterfaces(context, type) { + var ifaceTypeNames = Object.create(null); + + for (var _i14 = 0, _type$getInterfaces2 = type.getInterfaces(); _i14 < _type$getInterfaces2.length; _i14++) { + var iface = _type$getInterfaces2[_i14]; + + if (!(0, _definition.isInterfaceType)(iface)) { + context.reportError("Type ".concat((0, _inspect.default)(type), " must only implement Interface types, ") + "it cannot implement ".concat((0, _inspect.default)(iface), "."), getAllImplementsInterfaceNodes(type, iface)); + continue; + } + + if (type === iface) { + context.reportError("Type ".concat(type.name, " cannot implement itself because it would create a circular reference."), getAllImplementsInterfaceNodes(type, iface)); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError("Type ".concat(type.name, " can only implement ").concat(iface.name, " once."), getAllImplementsInterfaceNodes(type, iface)); + continue; + } + + ifaceTypeNames[iface.name] = true; + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface(context, type, iface) { + var typeFieldMap = type.getFields(); // Assert each interface field is implemented. + + for (var _i16 = 0, _objectValues4 = (0, _objectValues5.default)(iface.getFields()); _i16 < _objectValues4.length; _i16++) { + var ifaceField = _objectValues4[_i16]; + var fieldName = ifaceField.name; + var typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { + context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ").concat(type.name, " does not provide it."), [ifaceField.astNode].concat(getAllNodes(type))); + continue; + } // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + + + if (!(0, _typeComparators.isTypeSubTypeOf)(context.schema, typeField.type, ifaceField.type)) { + var _ifaceField$astNode, _typeField$astNode; + + context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expects type ") + "".concat((0, _inspect.default)(ifaceField.type), " but ").concat(type.name, ".").concat(fieldName, " ") + "is type ".concat((0, _inspect.default)(typeField.type), "."), [// istanbul ignore next (TODO need to write coverage tests) + (_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type, // istanbul ignore next (TODO need to write coverage tests) + (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type]); + } // Assert each interface field arg is implemented. + + + var _loop = function _loop(_i18, _ifaceField$args2) { + var ifaceArg = _ifaceField$args2[_i18]; + var argName = ifaceArg.name; + var typeArg = (0, _find.default)(typeField.args, function (arg) { + return arg.name === argName; + }); // Assert interface field arg exists on object field. + + if (!typeArg) { + context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) expected but ").concat(type.name, ".").concat(fieldName, " does not provide it."), [ifaceArg.astNode, typeField.astNode]); + return "continue"; + } // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + + + if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) { + var _ifaceArg$astNode, _typeArg$astNode; + + context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expects type ".concat((0, _inspect.default)(ifaceArg.type), " but ") + "".concat(type.name, ".").concat(fieldName, "(").concat(argName, ":) is type ") + "".concat((0, _inspect.default)(typeArg.type), "."), [// istanbul ignore next (TODO need to write coverage tests) + (_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type, // istanbul ignore next (TODO need to write coverage tests) + (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type]); + } // TODO: validate default values? + + }; + + for (var _i18 = 0, _ifaceField$args2 = ifaceField.args; _i18 < _ifaceField$args2.length; _i18++) { + var _ret = _loop(_i18, _ifaceField$args2); + + if (_ret === "continue") continue; + } // Assert additional arguments must not be required. + + + var _loop2 = function _loop2(_i20, _typeField$args2) { + var typeArg = _typeField$args2[_i20]; + var argName = typeArg.name; + var ifaceArg = (0, _find.default)(ifaceField.args, function (arg) { + return arg.name === argName; + }); + + if (!ifaceArg && (0, _definition.isRequiredArgument)(typeArg)) { + context.reportError("Object field ".concat(type.name, ".").concat(fieldName, " includes required argument ").concat(argName, " that is missing from the Interface field ").concat(iface.name, ".").concat(fieldName, "."), [typeArg.astNode, ifaceField.astNode]); + } + }; + + for (var _i20 = 0, _typeField$args2 = typeField.args; _i20 < _typeField$args2.length; _i20++) { + _loop2(_i20, _typeField$args2); + } + } +} + +function validateTypeImplementsAncestors(context, type, iface) { + var ifaceInterfaces = type.getInterfaces(); + + for (var _i22 = 0, _iface$getInterfaces2 = iface.getInterfaces(); _i22 < _iface$getInterfaces2.length; _i22++) { + var transitive = _iface$getInterfaces2[_i22]; + + if (ifaceInterfaces.indexOf(transitive) === -1) { + context.reportError(transitive === type ? "Type ".concat(type.name, " cannot implement ").concat(iface.name, " because it would create a circular reference.") : "Type ".concat(type.name, " must implement ").concat(transitive.name, " because it is implemented by ").concat(iface.name, "."), [].concat(getAllImplementsInterfaceNodes(iface, transitive), getAllImplementsInterfaceNodes(type, iface))); + } + } +} + +function validateUnionMembers(context, union) { + var memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError("Union type ".concat(union.name, " must define one or more member types."), getAllNodes(union)); + } + + var includedTypeNames = Object.create(null); + + for (var _i24 = 0; _i24 < memberTypes.length; _i24++) { + var memberType = memberTypes[_i24]; + + if (includedTypeNames[memberType.name]) { + context.reportError("Union type ".concat(union.name, " can only include type ").concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name)); + continue; + } + + includedTypeNames[memberType.name] = true; + + if (!(0, _definition.isObjectType)(memberType)) { + context.reportError("Union type ".concat(union.name, " can only include Object types, ") + "it cannot include ".concat((0, _inspect.default)(memberType), "."), getUnionMemberTypeNodes(union, String(memberType))); + } + } +} + +function validateEnumValues(context, enumType) { + var enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError("Enum type ".concat(enumType.name, " must define one or more values."), getAllNodes(enumType)); + } + + for (var _i26 = 0; _i26 < enumValues.length; _i26++) { + var enumValue = enumValues[_i26]; + var valueName = enumValue.name; // Ensure valid name. + + validateName(context, enumValue); + + if (valueName === 'true' || valueName === 'false' || valueName === 'null') { + context.reportError("Enum type ".concat(enumType.name, " cannot include value: ").concat(valueName, "."), enumValue.astNode); + } + } +} + +function validateInputFields(context, inputObj) { + var fields = (0, _objectValues5.default)(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError("Input Object type ".concat(inputObj.name, " must define one or more fields."), getAllNodes(inputObj)); + } // Ensure the arguments are valid + + + for (var _i28 = 0; _i28 < fields.length; _i28++) { + var field = fields[_i28]; + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(field.type)) { + var _field$astNode2; + + context.reportError("The type of ".concat(inputObj.name, ".").concat(field.name, " must be Input Type ") + "but got: ".concat((0, _inspect.default)(field.type), "."), (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type); + } + + if ((0, _definition.isRequiredInputField)(field) && field.deprecationReason != null) { + var _field$astNode3; + + context.reportError("Required input field ".concat(inputObj.name, ".").concat(field.name, " cannot be deprecated."), [getDeprecatedDirectiveNode(field.astNode), // istanbul ignore next (TODO need to write coverage tests) + (_field$astNode3 = field.astNode) === null || _field$astNode3 === void 0 ? void 0 : _field$astNode3.type]); + } + } +} + +function createInputObjectCircularRefsValidator(context) { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + var visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + var fieldPath = []; // Position in the type path + + var fieldPathIndexByTypeName = Object.create(null); + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(inputObj) { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + var fields = (0, _objectValues5.default)(inputObj.getFields()); + + for (var _i30 = 0; _i30 < fields.length; _i30++) { + var field = fields[_i30]; + + if ((0, _definition.isNonNullType)(field.type) && (0, _definition.isInputObjectType)(field.type.ofType)) { + var fieldType = field.type.ofType; + var cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + fieldPath.push(field); + + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + var cyclePath = fieldPath.slice(cycleIndex); + var pathStr = cyclePath.map(function (fieldObj) { + return fieldObj.name; + }).join('.'); + context.reportError("Cannot reference Input Object \"".concat(fieldType.name, "\" within itself through a series of non-null fields: \"").concat(pathStr, "\"."), cyclePath.map(function (fieldObj) { + return fieldObj.astNode; + })); + } + + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllNodes(object) { + var astNode = object.astNode, + extensionASTNodes = object.extensionASTNodes; + return astNode ? extensionASTNodes ? [astNode].concat(extensionASTNodes) : [astNode] : extensionASTNodes !== null && extensionASTNodes !== void 0 ? extensionASTNodes : []; +} + +function getAllSubNodes(object, getter) { + var subNodes = []; + + for (var _i32 = 0, _getAllNodes2 = getAllNodes(object); _i32 < _getAllNodes2.length; _i32++) { + var _getter; + + var node = _getAllNodes2[_i32]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + subNodes = subNodes.concat((_getter = getter(node)) !== null && _getter !== void 0 ? _getter : []); + } + + return subNodes; +} + +function getAllImplementsInterfaceNodes(type, iface) { + return getAllSubNodes(type, function (typeNode) { + return typeNode.interfaces; + }).filter(function (ifaceNode) { + return ifaceNode.name.value === iface.name; + }); +} + +function getUnionMemberTypeNodes(union, typeName) { + return getAllSubNodes(union, function (unionNode) { + return unionNode.types; + }).filter(function (typeNode) { + return typeNode.name.value === typeName; + }); +} + +function getDeprecatedDirectiveNode(definitionNode) { + var _definitionNode$direc; + + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + return definitionNode === null || definitionNode === void 0 ? void 0 : (_definitionNode$direc = definitionNode.directives) === null || _definitionNode$direc === void 0 ? void 0 : _definitionNode$direc.find(function (node) { + return node.name.value === _directives.GraphQLDeprecatedDirective.name; + }); +} + + +/***/ }), + +/***/ 76625: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.visitWithTypeInfo = visitWithTypeInfo; +exports.TypeInfo = void 0; + +var _find = _interopRequireDefault(__nccwpck_require__(57649)); + +var _kinds = __nccwpck_require__(11927); + +var _ast = __nccwpck_require__(45494); + +var _visitor = __nccwpck_require__(5678); + +var _definition = __nccwpck_require__(5821); + +var _introspection = __nccwpck_require__(28344); + +var _typeFromAST = __nccwpck_require__(27664); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +var TypeInfo = /*#__PURE__*/function () { + function TypeInfo(schema, // NOTE: this experimental optional second parameter is only needed in order + // to support non-spec-compliant code bases. You should never need to use it. + // It may disappear in the future. + getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals + // beginning somewhere other than documents. + initialType) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = getFieldDefFn !== null && getFieldDefFn !== void 0 ? getFieldDefFn : getFieldDef; + + if (initialType) { + if ((0, _definition.isInputType)(initialType)) { + this._inputTypeStack.push(initialType); + } + + if ((0, _definition.isCompositeType)(initialType)) { + this._parentTypeStack.push(initialType); + } + + if ((0, _definition.isOutputType)(initialType)) { + this._typeStack.push(initialType); + } + } + } + + var _proto = TypeInfo.prototype; + + _proto.getType = function getType() { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + }; + + _proto.getParentType = function getParentType() { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + }; + + _proto.getInputType = function getInputType() { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + }; + + _proto.getParentInputType = function getParentInputType() { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + }; + + _proto.getFieldDef = function getFieldDef() { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + }; + + _proto.getDefaultValue = function getDefaultValue() { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + }; + + _proto.getDirective = function getDirective() { + return this._directive; + }; + + _proto.getArgument = function getArgument() { + return this._argument; + }; + + _proto.getEnumValue = function getEnumValue() { + return this._enumValue; + }; + + _proto.enter = function enter(node) { + var schema = this._schema; // Note: many of the types below are explicitly typed as "mixed" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: + { + var namedType = (0, _definition.getNamedType)(this.getType()); + + this._parentTypeStack.push((0, _definition.isCompositeType)(namedType) ? namedType : undefined); + + break; + } + + case _kinds.Kind.FIELD: + { + var parentType = this.getParentType(); + var fieldDef; + var fieldType; + + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + + if (fieldDef) { + fieldType = fieldDef.type; + } + } + + this._fieldDefStack.push(fieldDef); + + this._typeStack.push((0, _definition.isOutputType)(fieldType) ? fieldType : undefined); + + break; + } + + case _kinds.Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + + case _kinds.Kind.OPERATION_DEFINITION: + { + var type; + + switch (node.operation) { + case 'query': + type = schema.getQueryType(); + break; + + case 'mutation': + type = schema.getMutationType(); + break; + + case 'subscription': + type = schema.getSubscriptionType(); + break; + } + + this._typeStack.push((0, _definition.isObjectType)(type) ? type : undefined); + + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: + { + var typeConditionAST = node.typeCondition; + var outputType = typeConditionAST ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) : (0, _definition.getNamedType)(this.getType()); + + this._typeStack.push((0, _definition.isOutputType)(outputType) ? outputType : undefined); + + break; + } + + case _kinds.Kind.VARIABLE_DEFINITION: + { + var inputType = (0, _typeFromAST.typeFromAST)(schema, node.type); + + this._inputTypeStack.push((0, _definition.isInputType)(inputType) ? inputType : undefined); + + break; + } + + case _kinds.Kind.ARGUMENT: + { + var _this$getDirective; + + var argDef; + var argType; + var fieldOrDirective = (_this$getDirective = this.getDirective()) !== null && _this$getDirective !== void 0 ? _this$getDirective : this.getFieldDef(); + + if (fieldOrDirective) { + argDef = (0, _find.default)(fieldOrDirective.args, function (arg) { + return arg.name === node.name.value; + }); + + if (argDef) { + argType = argDef.type; + } + } + + this._argument = argDef; + + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + + this._inputTypeStack.push((0, _definition.isInputType)(argType) ? argType : undefined); + + break; + } + + case _kinds.Kind.LIST: + { + var listType = (0, _definition.getNullableType)(this.getInputType()); + var itemType = (0, _definition.isListType)(listType) ? listType.ofType : listType; // List positions never have a default value. + + this._defaultValueStack.push(undefined); + + this._inputTypeStack.push((0, _definition.isInputType)(itemType) ? itemType : undefined); + + break; + } + + case _kinds.Kind.OBJECT_FIELD: + { + var objectType = (0, _definition.getNamedType)(this.getInputType()); + var inputFieldType; + var inputField; + + if ((0, _definition.isInputObjectType)(objectType)) { + inputField = objectType.getFields()[node.name.value]; + + if (inputField) { + inputFieldType = inputField.type; + } + } + + this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined); + + this._inputTypeStack.push((0, _definition.isInputType)(inputFieldType) ? inputFieldType : undefined); + + break; + } + + case _kinds.Kind.ENUM: + { + var enumType = (0, _definition.getNamedType)(this.getInputType()); + var enumValue; + + if ((0, _definition.isEnumType)(enumType)) { + enumValue = enumType.getValue(node.value); + } + + this._enumValue = enumValue; + break; + } + } + }; + + _proto.leave = function leave(node) { + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: + this._parentTypeStack.pop(); + + break; + + case _kinds.Kind.FIELD: + this._fieldDefStack.pop(); + + this._typeStack.pop(); + + break; + + case _kinds.Kind.DIRECTIVE: + this._directive = null; + break; + + case _kinds.Kind.OPERATION_DEFINITION: + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + + break; + + case _kinds.Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ARGUMENT: + this._argument = null; + + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.LIST: + case _kinds.Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ENUM: + this._enumValue = null; + break; + } + }; + + return TypeInfo; +}(); +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ + + +exports.TypeInfo = TypeInfo; + +function getFieldDef(schema, parentType, fieldNode) { + var name = fieldNode.name.value; + + if (name === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.SchemaMetaFieldDef; + } + + if (name === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.TypeMetaFieldDef; + } + + if (name === _introspection.TypeNameMetaFieldDef.name && (0, _definition.isCompositeType)(parentType)) { + return _introspection.TypeNameMetaFieldDef; + } + + if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { + return parentType.getFields()[name]; + } +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ + + +function visitWithTypeInfo(typeInfo, visitor) { + return { + enter: function enter(node) { + typeInfo.enter(node); + var fn = (0, _visitor.getVisitFn)(visitor, node.kind, + /* isLeaving */ + false); + + if (fn) { + var result = fn.apply(visitor, arguments); + + if (result !== undefined) { + typeInfo.leave(node); + + if ((0, _ast.isNode)(result)) { + typeInfo.enter(result); + } + } + + return result; + } + }, + leave: function leave(node) { + var fn = (0, _visitor.getVisitFn)(visitor, node.kind, + /* isLeaving */ + true); + var result; + + if (fn) { + result = fn.apply(visitor, arguments); + } + + typeInfo.leave(node); + return result; + } + }; +} + + +/***/ }), + +/***/ 25780: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.assertValidName = assertValidName; +exports.isValidNameError = isValidNameError; + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _GraphQLError = __nccwpck_require__(4797); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/; +/** + * Upholds the spec rules about naming. + */ + +function assertValidName(name) { + var error = isValidNameError(name); + + if (error) { + throw error; + } + + return name; +} +/** + * Returns an Error if a name is invalid. + */ + + +function isValidNameError(name) { + typeof name === 'string' || (0, _devAssert.default)(0, 'Expected name to be a string.'); + + if (name.length > 1 && name[0] === '_' && name[1] === '_') { + return new _GraphQLError.GraphQLError("Name \"".concat(name, "\" must not begin with \"__\", which is reserved by GraphQL introspection.")); + } + + if (!NAME_RX.test(name)) { + return new _GraphQLError.GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not.")); + } +} + + +/***/ }), + +/***/ 12653: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.astFromValue = astFromValue; + +var _isFinite = _interopRequireDefault(__nccwpck_require__(78473)); + +var _arrayFrom3 = _interopRequireDefault(__nccwpck_require__(86839)); + +var _objectValues3 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _isCollection = _interopRequireDefault(__nccwpck_require__(54363)); + +var _kinds = __nccwpck_require__(11927); + +var _scalars = __nccwpck_require__(93145); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Mixed | Enum Value | + * | null | NullValue | + * + */ +function astFromValue(value, type) { + if ((0, _definition.isNonNullType)(type)) { + var astValue = astFromValue(value, type.ofType); + + if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) { + return null; + } + + return astValue; + } // only explicit null, not undefined, NaN + + + if (value === null) { + return { + kind: _kinds.Kind.NULL + }; + } // undefined + + + if (value === undefined) { + return null; + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + + + if ((0, _definition.isListType)(type)) { + var itemType = type.ofType; + + if ((0, _isCollection.default)(value)) { + var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators + // and it's required to first convert iteratable into array + + for (var _i2 = 0, _arrayFrom2 = (0, _arrayFrom3.default)(value); _i2 < _arrayFrom2.length; _i2++) { + var item = _arrayFrom2[_i2]; + var itemNode = astFromValue(item, itemType); + + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + + return { + kind: _kinds.Kind.LIST, + values: valuesNodes + }; + } + + return astFromValue(value, itemType); + } // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.default)(value)) { + return null; + } + + var fieldNodes = []; + + for (var _i4 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) { + var field = _objectValues2[_i4]; + var fieldValue = astFromValue(value[field.name], field.type); + + if (fieldValue) { + fieldNodes.push({ + kind: _kinds.Kind.OBJECT_FIELD, + name: { + kind: _kinds.Kind.NAME, + value: field.name + }, + value: fieldValue + }); + } + } + + return { + kind: _kinds.Kind.OBJECT, + fields: fieldNodes + }; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isLeafType)(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + var serialized = type.serialize(value); + + if (serialized == null) { + return null; + } // Others serialize based on their corresponding JavaScript scalar types. + + + if (typeof serialized === 'boolean') { + return { + kind: _kinds.Kind.BOOLEAN, + value: serialized + }; + } // JavaScript numbers can be Int or Float values. + + + if (typeof serialized === 'number' && (0, _isFinite.default)(serialized)) { + var stringNum = String(serialized); + return integerStringRegExp.test(stringNum) ? { + kind: _kinds.Kind.INT, + value: stringNum + } : { + kind: _kinds.Kind.FLOAT, + value: stringNum + }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if ((0, _definition.isEnumType)(type)) { + return { + kind: _kinds.Kind.ENUM, + value: serialized + }; + } // ID types can use Int literals. + + + if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) { + return { + kind: _kinds.Kind.INT, + value: serialized + }; + } + + return { + kind: _kinds.Kind.STRING, + value: serialized + }; + } + + throw new TypeError("Cannot convert value to AST: ".concat((0, _inspect.default)(serialized), ".")); + } // istanbul ignore next (Not reachable. All possible input types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); +} +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ + + +var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; + + +/***/ }), + +/***/ 9337: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.buildASTSchema = buildASTSchema; +exports.buildSchema = buildSchema; + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _kinds = __nccwpck_require__(11927); + +var _parser = __nccwpck_require__(50655); + +var _validate = __nccwpck_require__(14193); + +var _schema = __nccwpck_require__(8505); + +var _directives = __nccwpck_require__(83614); + +var _extendSchema = __nccwpck_require__(51832); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query + * and Mutation. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + * + * Accepts options as a second argument: + * + * - commentDescriptions: + * Provide true to use preceding comments as the description. + * + */ +function buildASTSchema(documentAST, options) { + documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.default)(0, 'Must provide valid Document AST.'); + + if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { + (0, _validate.assertValidSDL)(documentAST); + } + + var emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: undefined, + extensionASTNodes: [], + assumeValid: false + }; + var config = (0, _extendSchema.extendSchemaImpl)(emptySchemaConfig, documentAST, options); + + if (config.astNode == null) { + for (var _i2 = 0, _config$types2 = config.types; _i2 < _config$types2.length; _i2++) { + var type = _config$types2[_i2]; + + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + config.query = type; + break; + + case 'Mutation': + config.mutation = type; + break; + + case 'Subscription': + config.subscription = type; + break; + } + } + } + + var directives = config.directives; // If specified directives were not explicitly declared, add them. + + var _loop = function _loop(_i4) { + var stdDirective = _directives.specifiedDirectives[_i4]; + + if (directives.every(function (directive) { + return directive.name !== stdDirective.name; + })) { + directives.push(stdDirective); + } + }; + + for (var _i4 = 0; _i4 < _directives.specifiedDirectives.length; _i4++) { + _loop(_i4); + } + + return new _schema.GraphQLSchema(config); +} +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + + +function buildSchema(source, options) { + var document = (0, _parser.parse)(source, { + noLocation: options === null || options === void 0 ? void 0 : options.noLocation, + allowLegacySDLEmptyFields: options === null || options === void 0 ? void 0 : options.allowLegacySDLEmptyFields, + allowLegacySDLImplementsInterfaces: options === null || options === void 0 ? void 0 : options.allowLegacySDLImplementsInterfaces, + experimentalFragmentVariables: options === null || options === void 0 ? void 0 : options.experimentalFragmentVariables + }); + return buildASTSchema(document, { + commentDescriptions: options === null || options === void 0 ? void 0 : options.commentDescriptions, + assumeValidSDL: options === null || options === void 0 ? void 0 : options.assumeValidSDL, + assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid + }); +} + + +/***/ }), + +/***/ 9352: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.buildClientSchema = buildClientSchema; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _keyValMap = _interopRequireDefault(__nccwpck_require__(49268)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _parser = __nccwpck_require__(50655); + +var _schema = __nccwpck_require__(8505); + +var _directives = __nccwpck_require__(83614); + +var _scalars = __nccwpck_require__(93145); + +var _introspection = __nccwpck_require__(28344); + +var _definition = __nccwpck_require__(5821); + +var _valueFromAST = __nccwpck_require__(83181); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +function buildClientSchema(introspection, options) { + (0, _isObjectLike.default)(introspection) && (0, _isObjectLike.default)(introspection.__schema) || (0, _devAssert.default)(0, "Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: ".concat((0, _inspect.default)(introspection), ".")); // Get the schema from the introspection result. + + var schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + var typeMap = (0, _keyValMap.default)(schemaIntrospection.types, function (typeIntrospection) { + return typeIntrospection.name; + }, function (typeIntrospection) { + return buildType(typeIntrospection); + }); // Include standard types only if they are used. + + for (var _i2 = 0, _ref2 = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes); _i2 < _ref2.length; _i2++) { + var stdType = _ref2[_i2]; + + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } // Get the root Query, Mutation, and Subscription types. + + + var queryType = schemaIntrospection.queryType ? getObjectType(schemaIntrospection.queryType) : null; + var mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; + var subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + + var directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; // Then produce and return a Schema with these types. + + return new _schema.GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: (0, _objectValues.default)(typeMap), + directives: directives, + assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid + }); // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + + function getType(typeRef) { + if (typeRef.kind === _introspection.TypeKind.LIST) { + var itemRef = typeRef.ofType; + + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + return new _definition.GraphQLList(getType(itemRef)); + } + + if (typeRef.kind === _introspection.TypeKind.NON_NULL) { + var nullableRef = typeRef.ofType; + + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + var nullableType = getType(nullableRef); + return new _definition.GraphQLNonNull((0, _definition.assertNullableType)(nullableType)); + } + + return getNamedType(typeRef); + } + + function getNamedType(typeRef) { + var typeName = typeRef.name; + + if (!typeName) { + throw new Error("Unknown type reference: ".concat((0, _inspect.default)(typeRef), ".")); + } + + var type = typeMap[typeName]; + + if (!type) { + throw new Error("Invalid or incomplete schema, unknown type: ".concat(typeName, ". Ensure that a full introspection query is used in order to build a client schema.")); + } + + return type; + } + + function getObjectType(typeRef) { + return (0, _definition.assertObjectType)(getNamedType(typeRef)); + } + + function getInterfaceType(typeRef) { + return (0, _definition.assertInterfaceType)(getNamedType(typeRef)); + } // Given a type's introspection result, construct the correct + // GraphQLType instance. + + + function buildType(type) { + if (type != null && type.name != null && type.kind != null) { + switch (type.kind) { + case _introspection.TypeKind.SCALAR: + return buildScalarDef(type); + + case _introspection.TypeKind.OBJECT: + return buildObjectDef(type); + + case _introspection.TypeKind.INTERFACE: + return buildInterfaceDef(type); + + case _introspection.TypeKind.UNION: + return buildUnionDef(type); + + case _introspection.TypeKind.ENUM: + return buildEnumDef(type); + + case _introspection.TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + + var typeStr = (0, _inspect.default)(type); + throw new Error("Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ".concat(typeStr, ".")); + } + + function buildScalarDef(scalarIntrospection) { + return new _definition.GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByUrl: scalarIntrospection.specifiedByUrl + }); + } + + function buildImplementationsList(implementingIntrospection) { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if (implementingIntrospection.interfaces === null && implementingIntrospection.kind === _introspection.TypeKind.INTERFACE) { + return []; + } + + if (!implementingIntrospection.interfaces) { + var implementingIntrospectionStr = (0, _inspect.default)(implementingIntrospection); + throw new Error("Introspection result missing interfaces: ".concat(implementingIntrospectionStr, ".")); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef(objectIntrospection) { + return new _definition.GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: function interfaces() { + return buildImplementationsList(objectIntrospection); + }, + fields: function fields() { + return buildFieldDefMap(objectIntrospection); + } + }); + } + + function buildInterfaceDef(interfaceIntrospection) { + return new _definition.GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: function interfaces() { + return buildImplementationsList(interfaceIntrospection); + }, + fields: function fields() { + return buildFieldDefMap(interfaceIntrospection); + } + }); + } + + function buildUnionDef(unionIntrospection) { + if (!unionIntrospection.possibleTypes) { + var unionIntrospectionStr = (0, _inspect.default)(unionIntrospection); + throw new Error("Introspection result missing possibleTypes: ".concat(unionIntrospectionStr, ".")); + } + + return new _definition.GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: function types() { + return unionIntrospection.possibleTypes.map(getObjectType); + } + }); + } + + function buildEnumDef(enumIntrospection) { + if (!enumIntrospection.enumValues) { + var enumIntrospectionStr = (0, _inspect.default)(enumIntrospection); + throw new Error("Introspection result missing enumValues: ".concat(enumIntrospectionStr, ".")); + } + + return new _definition.GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: (0, _keyValMap.default)(enumIntrospection.enumValues, function (valueIntrospection) { + return valueIntrospection.name; + }, function (valueIntrospection) { + return { + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason + }; + }) + }); + } + + function buildInputObjectDef(inputObjectIntrospection) { + if (!inputObjectIntrospection.inputFields) { + var inputObjectIntrospectionStr = (0, _inspect.default)(inputObjectIntrospection); + throw new Error("Introspection result missing inputFields: ".concat(inputObjectIntrospectionStr, ".")); + } + + return new _definition.GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: function fields() { + return buildInputValueDefMap(inputObjectIntrospection.inputFields); + } + }); + } + + function buildFieldDefMap(typeIntrospection) { + if (!typeIntrospection.fields) { + throw new Error("Introspection result missing fields: ".concat((0, _inspect.default)(typeIntrospection), ".")); + } + + return (0, _keyValMap.default)(typeIntrospection.fields, function (fieldIntrospection) { + return fieldIntrospection.name; + }, buildField); + } + + function buildField(fieldIntrospection) { + var type = getType(fieldIntrospection.type); + + if (!(0, _definition.isOutputType)(type)) { + var typeStr = (0, _inspect.default)(type); + throw new Error("Introspection must provide output type for fields, but received: ".concat(typeStr, ".")); + } + + if (!fieldIntrospection.args) { + var fieldIntrospectionStr = (0, _inspect.default)(fieldIntrospection); + throw new Error("Introspection result missing field args: ".concat(fieldIntrospectionStr, ".")); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type: type, + args: buildInputValueDefMap(fieldIntrospection.args) + }; + } + + function buildInputValueDefMap(inputValueIntrospections) { + return (0, _keyValMap.default)(inputValueIntrospections, function (inputValue) { + return inputValue.name; + }, buildInputValue); + } + + function buildInputValue(inputValueIntrospection) { + var type = getType(inputValueIntrospection.type); + + if (!(0, _definition.isInputType)(type)) { + var typeStr = (0, _inspect.default)(type); + throw new Error("Introspection must provide input type for arguments, but received: ".concat(typeStr, ".")); + } + + var defaultValue = inputValueIntrospection.defaultValue != null ? (0, _valueFromAST.valueFromAST)((0, _parser.parseValue)(inputValueIntrospection.defaultValue), type) : undefined; + return { + description: inputValueIntrospection.description, + type: type, + defaultValue: defaultValue + }; + } + + function buildDirective(directiveIntrospection) { + if (!directiveIntrospection.args) { + var directiveIntrospectionStr = (0, _inspect.default)(directiveIntrospection); + throw new Error("Introspection result missing directive args: ".concat(directiveIntrospectionStr, ".")); + } + + if (!directiveIntrospection.locations) { + var _directiveIntrospectionStr = (0, _inspect.default)(directiveIntrospection); + + throw new Error("Introspection result missing directive locations: ".concat(_directiveIntrospectionStr, ".")); + } + + return new _directives.GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args) + }); + } +} + + +/***/ }), + +/***/ 39603: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.coerceInputValue = coerceInputValue; + +var _arrayFrom = _interopRequireDefault(__nccwpck_require__(86839)); + +var _objectValues3 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _isObjectLike = _interopRequireDefault(__nccwpck_require__(95865)); + +var _isCollection = _interopRequireDefault(__nccwpck_require__(54363)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _printPathArray = _interopRequireDefault(__nccwpck_require__(94281)); + +var _Path = __nccwpck_require__(11262); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +function coerceInputValue(inputValue, type) { + var onError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultOnError; + return coerceInputValueImpl(inputValue, type, onError); +} + +function defaultOnError(path, invalidValue, error) { + var errorPrefix = 'Invalid value ' + (0, _inspect.default)(invalidValue); + + if (path.length > 0) { + errorPrefix += " at \"value".concat((0, _printPathArray.default)(path), "\""); + } + + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl(inputValue, type, onError, path) { + if ((0, _definition.isNonNullType)(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected non-nullable type \"".concat((0, _inspect.default)(type), "\" not to be null."))); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + var itemType = type.ofType; + + if ((0, _isCollection.default)(inputValue)) { + return (0, _arrayFrom.default)(inputValue, function (itemValue, index) { + var itemPath = (0, _Path.addPath)(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } // Lists accept a non-list value as a list of one. + + + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.default)(inputValue)) { + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\" to be an object."))); + return; + } + + var coercedValue = {}; + var fieldDefs = type.getFields(); + + for (var _i2 = 0, _objectValues2 = (0, _objectValues3.default)(fieldDefs); _i2 < _objectValues2.length; _i2++) { + var field = _objectValues2[_i2]; + var fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + var typeStr = (0, _inspect.default)(field.type); + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Field \"".concat(field.name, "\" of required type \"").concat(typeStr, "\" was not provided."))); + } + + continue; + } + + coercedValue[field.name] = coerceInputValueImpl(fieldValue, field.type, onError, (0, _Path.addPath)(path, field.name, type.name)); + } // Ensure every provided field is defined. + + + for (var _i4 = 0, _Object$keys2 = Object.keys(inputValue); _i4 < _Object$keys2.length; _i4++) { + var fieldName = _Object$keys2[_i4]; + + if (!fieldDefs[fieldName]) { + var suggestions = (0, _suggestionList.default)(fieldName, Object.keys(type.getFields())); + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Field \"".concat(fieldName, "\" is not defined by type \"").concat(type.name, "\".") + (0, _didYouMean.default)(suggestions))); + } + } + + return coercedValue; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isLeafType)(type)) { + var parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof _GraphQLError.GraphQLError) { + onError((0, _Path.pathToArray)(path), inputValue, error); + } else { + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\". ") + error.message, undefined, undefined, undefined, undefined, error)); + } + + return; + } + + if (parseResult === undefined) { + onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError("Expected type \"".concat(type.name, "\"."))); + } + + return parseResult; + } // istanbul ignore next (Not reachable. All possible input types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); +} + + +/***/ }), + +/***/ 17232: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.concatAST = concatAST; + +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +function concatAST(documents) { + var definitions = []; + + for (var _i2 = 0; _i2 < documents.length; _i2++) { + var doc = documents[_i2]; + definitions = definitions.concat(doc.definitions); + } + + return { + kind: 'Document', + definitions: definitions + }; +} + + +/***/ }), + +/***/ 51832: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.extendSchema = extendSchema; +exports.extendSchemaImpl = extendSchemaImpl; +exports.getDescription = getDescription; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _mapValue = _interopRequireDefault(__nccwpck_require__(32223)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _kinds = __nccwpck_require__(11927); + +var _tokenKind = __nccwpck_require__(91565); + +var _blockString = __nccwpck_require__(4515); + +var _predicates = __nccwpck_require__(20535); + +var _validate = __nccwpck_require__(14193); + +var _values = __nccwpck_require__(94834); + +var _schema = __nccwpck_require__(8505); + +var _scalars = __nccwpck_require__(93145); + +var _introspection = __nccwpck_require__(28344); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +var _valueFromAST = __nccwpck_require__(83181); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + * + * Accepts options as a third argument: + * + * - commentDescriptions: + * Provide true to use preceding comments as the description. + * + */ +function extendSchema(schema, documentAST, options) { + (0, _schema.assertSchema)(schema); + documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.default)(0, 'Must provide valid Document AST.'); + + if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { + (0, _validate.assertValidSDLExtension)(documentAST, schema); + } + + var schemaConfig = schema.toConfig(); + var extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig ? schema : new _schema.GraphQLSchema(extendedConfig); +} +/** + * @internal + */ + + +function extendSchemaImpl(schemaConfig, documentAST, options) { + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + + // Collect the type definitions and extensions found in the document. + var typeDefs = []; + var typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + + var directiveDefs = []; + var schemaDef; // Schema extensions are collected which may add additional operation types. + + var schemaExtensions = []; + + for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { + var def = _documentAST$definiti2[_i2]; + + if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if ((0, _predicates.isTypeDefinitionNode)(def)) { + typeDefs.push(def); + } else if ((0, _predicates.isTypeExtensionNode)(def)) { + var extendedTypeName = def.name.value; + var existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def]; + } else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + + + if (Object.keys(typeExtensionsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExtensions.length === 0 && schemaDef == null) { + return schemaConfig; + } + + var typeMap = Object.create(null); + + for (var _i4 = 0, _schemaConfig$types2 = schemaConfig.types; _i4 < _schemaConfig$types2.length; _i4++) { + var existingType = _schemaConfig$types2[_i4]; + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (var _i6 = 0; _i6 < typeDefs.length; _i6++) { + var _stdTypeMap$name; + + var typeNode = typeDefs[_i6]; + var name = typeNode.name.value; + typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode); + } + + var operationTypes = _objectSpread(_objectSpread({ + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: schemaConfig.subscription && replaceNamedType(schemaConfig.subscription) + }, schemaDef && getOperationTypes([schemaDef])), getOperationTypes(schemaExtensions)); // Then produce and return a Schema config with these types. + + + return _objectSpread(_objectSpread({ + description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value + }, operationTypes), {}, { + types: (0, _objectValues.default)(typeMap), + directives: [].concat(schemaConfig.directives.map(replaceDirective), directiveDefs.map(buildDirective)), + extensions: undefined, + astNode: (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 ? _schemaDef2 : schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false + }); // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // $FlowFixMe[incompatible-return] + return new _definition.GraphQLList(replaceType(type.ofType)); + } + + if ((0, _definition.isNonNullType)(type)) { + // $FlowFixMe[incompatible-return] + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive) { + var config = directive.toConfig(); + return new _directives.GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { + args: (0, _mapValue.default)(config.args, extendArg) + })); + } + + function extendNamedType(type) { + if ((0, _introspection.isIntrospectionType)(type) || (0, _scalars.isSpecifiedScalarType)(type)) { + // Builtin types are not extended. + return type; + } + + if ((0, _definition.isScalarType)(type)) { + return extendScalarType(type); + } + + if ((0, _definition.isObjectType)(type)) { + return extendObjectType(type); + } + + if ((0, _definition.isInterfaceType)(type)) { + return extendInterfaceType(type); + } + + if ((0, _definition.isUnionType)(type)) { + return extendUnionType(type); + } + + if ((0, _definition.isEnumType)(type)) { + return extendEnumType(type); + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isInputObjectType)(type)) { + return extendInputObjectType(type); + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); + } + + function extendInputObjectType(type) { + var _typeExtensionsMap$co; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : []; + return new _definition.GraphQLInputObjectType(_objectSpread(_objectSpread({}, config), {}, { + fields: function fields() { + return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, function (field) { + return _objectSpread(_objectSpread({}, field), {}, { + type: replaceType(field.type) + }); + })), buildInputFieldMap(extensions)); + }, + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendEnumType(type) { + var _typeExtensionsMap$ty; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : []; + return new _definition.GraphQLEnumType(_objectSpread(_objectSpread({}, config), {}, { + values: _objectSpread(_objectSpread({}, config.values), buildEnumValueMap(extensions)), + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendScalarType(type) { + var _typeExtensionsMap$co2; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : []; + var specifiedByUrl = config.specifiedByUrl; + + for (var _i8 = 0; _i8 < extensions.length; _i8++) { + var _getSpecifiedByUrl; + + var extensionNode = extensions[_i8]; + specifiedByUrl = (_getSpecifiedByUrl = getSpecifiedByUrl(extensionNode)) !== null && _getSpecifiedByUrl !== void 0 ? _getSpecifiedByUrl : specifiedByUrl; + } + + return new _definition.GraphQLScalarType(_objectSpread(_objectSpread({}, config), {}, { + specifiedByUrl: specifiedByUrl, + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendObjectType(type) { + var _typeExtensionsMap$co3; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : []; + return new _definition.GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { + interfaces: function interfaces() { + return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); + }, + fields: function fields() { + return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, extendField)), buildFieldMap(extensions)); + }, + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendInterfaceType(type) { + var _typeExtensionsMap$co4; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : []; + return new _definition.GraphQLInterfaceType(_objectSpread(_objectSpread({}, config), {}, { + interfaces: function interfaces() { + return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions)); + }, + fields: function fields() { + return _objectSpread(_objectSpread({}, (0, _mapValue.default)(config.fields, extendField)), buildFieldMap(extensions)); + }, + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendUnionType(type) { + var _typeExtensionsMap$co5; + + var config = type.toConfig(); + var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : []; + return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config), {}, { + types: function types() { + return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions)); + }, + extensionASTNodes: config.extensionASTNodes.concat(extensions) + })); + } + + function extendField(field) { + return _objectSpread(_objectSpread({}, field), {}, { + type: replaceType(field.type), + // $FlowFixMe[incompatible-call] + args: (0, _mapValue.default)(field.args, extendArg) + }); + } + + function extendArg(arg) { + return _objectSpread(_objectSpread({}, arg), {}, { + type: replaceType(arg.type) + }); + } + + function getOperationTypes(nodes) { + var opTypes = {}; + + for (var _i10 = 0; _i10 < nodes.length; _i10++) { + var _node$operationTypes; + + var node = nodes[_i10]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; + + for (var _i12 = 0; _i12 < operationTypesNodes.length; _i12++) { + var operationType = operationTypesNodes[_i12]; + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + + + return opTypes; + } + + function getNamedType(node) { + var _stdTypeMap$name2; + + var name = node.name.value; + var type = (_stdTypeMap$name2 = stdTypeMap[name]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name]; + + if (type === undefined) { + throw new Error("Unknown type: \"".concat(name, "\".")); + } + + return type; + } + + function getWrappedType(node) { + if (node.kind === _kinds.Kind.LIST_TYPE) { + return new _definition.GraphQLList(getWrappedType(node.type)); + } + + if (node.kind === _kinds.Kind.NON_NULL_TYPE) { + return new _definition.GraphQLNonNull(getWrappedType(node.type)); + } + + return getNamedType(node); + } + + function buildDirective(node) { + var locations = node.locations.map(function (_ref) { + var value = _ref.value; + return value; + }); + return new _directives.GraphQLDirective({ + name: node.name.value, + description: getDescription(node, options), + locations: locations, + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node + }); + } + + function buildFieldMap(nodes) { + var fieldConfigMap = Object.create(null); + + for (var _i14 = 0; _i14 < nodes.length; _i14++) { + var _node$fields; + + var node = nodes[_i14]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var nodeFields = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; + + for (var _i16 = 0; _i16 < nodeFields.length; _i16++) { + var field = nodeFields[_i16]; + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: getDescription(field, options), + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field + }; + } + } + + return fieldConfigMap; + } + + function buildArgumentMap(args) { + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var argsNodes = args !== null && args !== void 0 ? args : []; + var argConfigMap = Object.create(null); + + for (var _i18 = 0; _i18 < argsNodes.length; _i18++) { + var arg = argsNodes[_i18]; + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + var type = getWrappedType(arg.type); + argConfigMap[arg.name.value] = { + type: type, + description: getDescription(arg, options), + defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg + }; + } + + return argConfigMap; + } + + function buildInputFieldMap(nodes) { + var inputFieldMap = Object.create(null); + + for (var _i20 = 0; _i20 < nodes.length; _i20++) { + var _node$fields2; + + var node = nodes[_i20]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var fieldsNodes = (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : []; + + for (var _i22 = 0; _i22 < fieldsNodes.length; _i22++) { + var field = fieldsNodes[_i22]; + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + var type = getWrappedType(field.type); + inputFieldMap[field.name.value] = { + type: type, + description: getDescription(field, options), + defaultValue: (0, _valueFromAST.valueFromAST)(field.defaultValue, type), + deprecationReason: getDeprecationReason(field), + astNode: field + }; + } + } + + return inputFieldMap; + } + + function buildEnumValueMap(nodes) { + var enumValueMap = Object.create(null); + + for (var _i24 = 0; _i24 < nodes.length; _i24++) { + var _node$values; + + var node = nodes[_i24]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var valuesNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; + + for (var _i26 = 0; _i26 < valuesNodes.length; _i26++) { + var value = valuesNodes[_i26]; + enumValueMap[value.name.value] = { + description: getDescription(value, options), + deprecationReason: getDeprecationReason(value), + astNode: value + }; + } + } + + return enumValueMap; + } + + function buildInterfaces(nodes) { + var interfaces = []; + + for (var _i28 = 0; _i28 < nodes.length; _i28++) { + var _node$interfaces; + + var node = nodes[_i28]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var interfacesNodes = (_node$interfaces = node.interfaces) !== null && _node$interfaces !== void 0 ? _node$interfaces : []; + + for (var _i30 = 0; _i30 < interfacesNodes.length; _i30++) { + var type = interfacesNodes[_i30]; + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable + // results. + interfaces.push(getNamedType(type)); + } + } + + return interfaces; + } + + function buildUnionTypes(nodes) { + var types = []; + + for (var _i32 = 0; _i32 < nodes.length; _i32++) { + var _node$types; + + var node = nodes[_i32]; + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : []; + + for (var _i34 = 0; _i34 < typeNodes.length; _i34++) { + var type = typeNodes[_i34]; + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable + // results. + types.push(getNamedType(type)); + } + } + + return types; + } + + function buildType(astNode) { + var _typeExtensionsMap$na; + + var name = astNode.name.value; + var description = getDescription(astNode, options); + var extensionNodes = (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && _typeExtensionsMap$na !== void 0 ? _typeExtensionsMap$na : []; + + switch (astNode.kind) { + case _kinds.Kind.OBJECT_TYPE_DEFINITION: + { + var extensionASTNodes = extensionNodes; + var allNodes = [astNode].concat(extensionASTNodes); + return new _definition.GraphQLObjectType({ + name: name, + description: description, + interfaces: function interfaces() { + return buildInterfaces(allNodes); + }, + fields: function fields() { + return buildFieldMap(allNodes); + }, + astNode: astNode, + extensionASTNodes: extensionASTNodes + }); + } + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: + { + var _extensionASTNodes = extensionNodes; + + var _allNodes = [astNode].concat(_extensionASTNodes); + + return new _definition.GraphQLInterfaceType({ + name: name, + description: description, + interfaces: function interfaces() { + return buildInterfaces(_allNodes); + }, + fields: function fields() { + return buildFieldMap(_allNodes); + }, + astNode: astNode, + extensionASTNodes: _extensionASTNodes + }); + } + + case _kinds.Kind.ENUM_TYPE_DEFINITION: + { + var _extensionASTNodes2 = extensionNodes; + + var _allNodes2 = [astNode].concat(_extensionASTNodes2); + + return new _definition.GraphQLEnumType({ + name: name, + description: description, + values: buildEnumValueMap(_allNodes2), + astNode: astNode, + extensionASTNodes: _extensionASTNodes2 + }); + } + + case _kinds.Kind.UNION_TYPE_DEFINITION: + { + var _extensionASTNodes3 = extensionNodes; + + var _allNodes3 = [astNode].concat(_extensionASTNodes3); + + return new _definition.GraphQLUnionType({ + name: name, + description: description, + types: function types() { + return buildUnionTypes(_allNodes3); + }, + astNode: astNode, + extensionASTNodes: _extensionASTNodes3 + }); + } + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: + { + var _extensionASTNodes4 = extensionNodes; + return new _definition.GraphQLScalarType({ + name: name, + description: description, + specifiedByUrl: getSpecifiedByUrl(astNode), + astNode: astNode, + extensionASTNodes: _extensionASTNodes4 + }); + } + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: + { + var _extensionASTNodes5 = extensionNodes; + + var _allNodes4 = [astNode].concat(_extensionASTNodes5); + + return new _definition.GraphQLInputObjectType({ + name: name, + description: description, + fields: function fields() { + return buildInputFieldMap(_allNodes4); + }, + astNode: astNode, + extensionASTNodes: _extensionASTNodes5 + }); + } + } // istanbul ignore next (Not reachable. All possible type definition nodes have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type definition node: ' + (0, _inspect.default)(astNode)); + } +} + +var stdTypeMap = (0, _keyMap.default)(_scalars.specifiedScalarTypes.concat(_introspection.introspectionTypes), function (type) { + return type.name; +}); +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ + +function getDeprecationReason(node) { + var deprecated = (0, _values.getDirectiveValues)(_directives.GraphQLDeprecatedDirective, node); + return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason; +} +/** + * Given a scalar node, returns the string value for the specifiedByUrl. + */ + + +function getSpecifiedByUrl(node) { + var specifiedBy = (0, _values.getDirectiveValues)(_directives.GraphQLSpecifiedByDirective, node); + return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url; +} +/** + * Given an ast node, returns its string description. + * @deprecated: provided to ease adoption and will be removed in v16. + * + * Accepts options as a second argument: + * + * - commentDescriptions: + * Provide true to use preceding comments as the description. + * + */ + + +function getDescription(node, options) { + if (node.description) { + return node.description.value; + } + + if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { + var rawValue = getLeadingCommentBlock(node); + + if (rawValue !== undefined) { + return (0, _blockString.dedentBlockStringValue)('\n' + rawValue); + } + } +} + +function getLeadingCommentBlock(node) { + var loc = node.loc; + + if (!loc) { + return; + } + + var comments = []; + var token = loc.startToken.prev; + + while (token != null && token.kind === _tokenKind.TokenKind.COMMENT && token.next && token.prev && token.line + 1 === token.next.line && token.line !== token.prev.line) { + var value = String(token.value); + comments.push(value); + token = token.prev; + } + + return comments.length > 0 ? comments.reverse().join('\n') : undefined; +} + + +/***/ }), + +/***/ 59366: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.findBreakingChanges = findBreakingChanges; +exports.findDangerousChanges = findDangerousChanges; +exports.DangerousChangeType = exports.BreakingChangeType = void 0; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _printer = __nccwpck_require__(68203); + +var _visitor = __nccwpck_require__(5678); + +var _scalars = __nccwpck_require__(93145); + +var _definition = __nccwpck_require__(5821); + +var _astFromValue = __nccwpck_require__(12653); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var BreakingChangeType = Object.freeze({ + TYPE_REMOVED: 'TYPE_REMOVED', + TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', + TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', + VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', + REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED', + IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED', + FIELD_REMOVED: 'FIELD_REMOVED', + FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', + REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED', + ARG_REMOVED: 'ARG_REMOVED', + ARG_CHANGED_KIND: 'ARG_CHANGED_KIND', + DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED', + DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED', + REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED', + DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED', + DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' +}); +exports.BreakingChangeType = BreakingChangeType; +var DangerousChangeType = Object.freeze({ + VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM', + TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION', + OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED', + OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED', + IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED', + ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' +}); +exports.DangerousChangeType = DangerousChangeType; + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +function findBreakingChanges(oldSchema, newSchema) { + var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { + return change.type in BreakingChangeType; + }); + return breakingChanges; +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ + + +function findDangerousChanges(oldSchema, newSchema) { + var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) { + return change.type in DangerousChangeType; + }); + return dangerousChanges; +} + +function findSchemaChanges(oldSchema, newSchema) { + return [].concat(findTypeChanges(oldSchema, newSchema), findDirectiveChanges(oldSchema, newSchema)); +} + +function findDirectiveChanges(oldSchema, newSchema) { + var schemaChanges = []; + var directivesDiff = diff(oldSchema.getDirectives(), newSchema.getDirectives()); + + for (var _i2 = 0, _directivesDiff$remov2 = directivesDiff.removed; _i2 < _directivesDiff$remov2.length; _i2++) { + var oldDirective = _directivesDiff$remov2[_i2]; + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: "".concat(oldDirective.name, " was removed.") + }); + } + + for (var _i4 = 0, _directivesDiff$persi2 = directivesDiff.persisted; _i4 < _directivesDiff$persi2.length; _i4++) { + var _ref2 = _directivesDiff$persi2[_i4]; + var _oldDirective = _ref2[0]; + var newDirective = _ref2[1]; + var argsDiff = diff(_oldDirective.args, newDirective.args); + + for (var _i6 = 0, _argsDiff$added2 = argsDiff.added; _i6 < _argsDiff$added2.length; _i6++) { + var newArg = _argsDiff$added2[_i6]; + + if ((0, _definition.isRequiredArgument)(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: "A required arg ".concat(newArg.name, " on directive ").concat(_oldDirective.name, " was added.") + }); + } + } + + for (var _i8 = 0, _argsDiff$removed2 = argsDiff.removed; _i8 < _argsDiff$removed2.length; _i8++) { + var oldArg = _argsDiff$removed2[_i8]; + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: "".concat(oldArg.name, " was removed from ").concat(_oldDirective.name, ".") + }); + } + + if (_oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: "Repeatable flag was removed from ".concat(_oldDirective.name, ".") + }); + } + + for (var _i10 = 0, _oldDirective$locatio2 = _oldDirective.locations; _i10 < _oldDirective$locatio2.length; _i10++) { + var location = _oldDirective$locatio2[_i10]; + + if (newDirective.locations.indexOf(location) === -1) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: "".concat(location, " was removed from ").concat(_oldDirective.name, ".") + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges(oldSchema, newSchema) { + var schemaChanges = []; + var typesDiff = diff((0, _objectValues.default)(oldSchema.getTypeMap()), (0, _objectValues.default)(newSchema.getTypeMap())); + + for (var _i12 = 0, _typesDiff$removed2 = typesDiff.removed; _i12 < _typesDiff$removed2.length; _i12++) { + var oldType = _typesDiff$removed2[_i12]; + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: (0, _scalars.isSpecifiedScalarType)(oldType) ? "Standard scalar ".concat(oldType.name, " was removed because it is not referenced anymore.") : "".concat(oldType.name, " was removed.") + }); + } + + for (var _i14 = 0, _typesDiff$persisted2 = typesDiff.persisted; _i14 < _typesDiff$persisted2.length; _i14++) { + var _ref4 = _typesDiff$persisted2[_i14]; + var _oldType = _ref4[0]; + var newType = _ref4[1]; + + if ((0, _definition.isEnumType)(_oldType) && (0, _definition.isEnumType)(newType)) { + schemaChanges.push.apply(schemaChanges, findEnumTypeChanges(_oldType, newType)); + } else if ((0, _definition.isUnionType)(_oldType) && (0, _definition.isUnionType)(newType)) { + schemaChanges.push.apply(schemaChanges, findUnionTypeChanges(_oldType, newType)); + } else if ((0, _definition.isInputObjectType)(_oldType) && (0, _definition.isInputObjectType)(newType)) { + schemaChanges.push.apply(schemaChanges, findInputObjectTypeChanges(_oldType, newType)); + } else if ((0, _definition.isObjectType)(_oldType) && (0, _definition.isObjectType)(newType)) { + schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); + } else if ((0, _definition.isInterfaceType)(_oldType) && (0, _definition.isInterfaceType)(newType)) { + schemaChanges.push.apply(schemaChanges, findFieldChanges(_oldType, newType).concat(findImplementedInterfacesChanges(_oldType, newType))); + } else if (_oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: "".concat(_oldType.name, " changed from ") + "".concat(typeKindName(_oldType), " to ").concat(typeKindName(newType), ".") + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges(oldType, newType) { + var schemaChanges = []; + var fieldsDiff = diff((0, _objectValues.default)(oldType.getFields()), (0, _objectValues.default)(newType.getFields())); + + for (var _i16 = 0, _fieldsDiff$added2 = fieldsDiff.added; _i16 < _fieldsDiff$added2.length; _i16++) { + var newField = _fieldsDiff$added2[_i16]; + + if ((0, _definition.isRequiredInputField)(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: "A required field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: "An optional field ".concat(newField.name, " on input type ").concat(oldType.name, " was added.") + }); + } + } + + for (var _i18 = 0, _fieldsDiff$removed2 = fieldsDiff.removed; _i18 < _fieldsDiff$removed2.length; _i18++) { + var oldField = _fieldsDiff$removed2[_i18]; + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") + }); + } + + for (var _i20 = 0, _fieldsDiff$persisted2 = fieldsDiff.persisted; _i20 < _fieldsDiff$persisted2.length; _i20++) { + var _ref6 = _fieldsDiff$persisted2[_i20]; + var _oldField = _ref6[0]; + var _newField = _ref6[1]; + var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldField.type, _newField.type); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: "".concat(oldType.name, ".").concat(_oldField.name, " changed type from ") + "".concat(String(_oldField.type), " to ").concat(String(_newField.type), ".") + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges(oldType, newType) { + var schemaChanges = []; + var possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (var _i22 = 0, _possibleTypesDiff$ad2 = possibleTypesDiff.added; _i22 < _possibleTypesDiff$ad2.length; _i22++) { + var newPossibleType = _possibleTypesDiff$ad2[_i22]; + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: "".concat(newPossibleType.name, " was added to union type ").concat(oldType.name, ".") + }); + } + + for (var _i24 = 0, _possibleTypesDiff$re2 = possibleTypesDiff.removed; _i24 < _possibleTypesDiff$re2.length; _i24++) { + var oldPossibleType = _possibleTypesDiff$re2[_i24]; + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: "".concat(oldPossibleType.name, " was removed from union type ").concat(oldType.name, ".") + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges(oldType, newType) { + var schemaChanges = []; + var valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (var _i26 = 0, _valuesDiff$added2 = valuesDiff.added; _i26 < _valuesDiff$added2.length; _i26++) { + var newValue = _valuesDiff$added2[_i26]; + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: "".concat(newValue.name, " was added to enum type ").concat(oldType.name, ".") + }); + } + + for (var _i28 = 0, _valuesDiff$removed2 = valuesDiff.removed; _i28 < _valuesDiff$removed2.length; _i28++) { + var oldValue = _valuesDiff$removed2[_i28]; + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: "".concat(oldValue.name, " was removed from enum type ").concat(oldType.name, ".") + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges(oldType, newType) { + var schemaChanges = []; + var interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (var _i30 = 0, _interfacesDiff$added2 = interfacesDiff.added; _i30 < _interfacesDiff$added2.length; _i30++) { + var newInterface = _interfacesDiff$added2[_i30]; + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: "".concat(newInterface.name, " added to interfaces implemented by ").concat(oldType.name, ".") + }); + } + + for (var _i32 = 0, _interfacesDiff$remov2 = interfacesDiff.removed; _i32 < _interfacesDiff$remov2.length; _i32++) { + var oldInterface = _interfacesDiff$remov2[_i32]; + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: "".concat(oldType.name, " no longer implements interface ").concat(oldInterface.name, ".") + }); + } + + return schemaChanges; +} + +function findFieldChanges(oldType, newType) { + var schemaChanges = []; + var fieldsDiff = diff((0, _objectValues.default)(oldType.getFields()), (0, _objectValues.default)(newType.getFields())); + + for (var _i34 = 0, _fieldsDiff$removed4 = fieldsDiff.removed; _i34 < _fieldsDiff$removed4.length; _i34++) { + var oldField = _fieldsDiff$removed4[_i34]; + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: "".concat(oldType.name, ".").concat(oldField.name, " was removed.") + }); + } + + for (var _i36 = 0, _fieldsDiff$persisted4 = fieldsDiff.persisted; _i36 < _fieldsDiff$persisted4.length; _i36++) { + var _ref8 = _fieldsDiff$persisted4[_i36]; + var _oldField2 = _ref8[0]; + var newField = _ref8[1]; + schemaChanges.push.apply(schemaChanges, findArgChanges(oldType, _oldField2, newField)); + var isSafe = isChangeSafeForObjectOrInterfaceField(_oldField2.type, newField.type); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: "".concat(oldType.name, ".").concat(_oldField2.name, " changed type from ") + "".concat(String(_oldField2.type), " to ").concat(String(newField.type), ".") + }); + } + } + + return schemaChanges; +} + +function findArgChanges(oldType, oldField, newField) { + var schemaChanges = []; + var argsDiff = diff(oldField.args, newField.args); + + for (var _i38 = 0, _argsDiff$removed4 = argsDiff.removed; _i38 < _argsDiff$removed4.length; _i38++) { + var oldArg = _argsDiff$removed4[_i38]; + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(oldArg.name, " was removed.") + }); + } + + for (var _i40 = 0, _argsDiff$persisted2 = argsDiff.persisted; _i40 < _argsDiff$persisted2.length; _i40++) { + var _ref10 = _argsDiff$persisted2[_i40]; + var _oldArg = _ref10[0]; + var newArg = _ref10[1]; + var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(_oldArg.type, newArg.type); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed type from ") + "".concat(String(_oldArg.type), " to ").concat(String(newArg.type), ".") + }); + } else if (_oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " defaultValue was removed.") + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + var oldValueStr = stringifyValue(_oldArg.defaultValue, _oldArg.type); + var newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " has changed defaultValue from ").concat(oldValueStr, " to ").concat(newValueStr, ".") + }); + } + } + } + } + + for (var _i42 = 0, _argsDiff$added4 = argsDiff.added; _i42 < _argsDiff$added4.length; _i42++) { + var _newArg = _argsDiff$added4[_i42]; + + if ((0, _definition.isRequiredArgument)(_newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: "A required arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: "An optional arg ".concat(_newArg.name, " on ").concat(oldType.name, ".").concat(oldField.name, " was added.") + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + return (// if they're both lists, make sure the underlying types are compatible + (0, _definition.isListType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) || // moving from nullable to non-null of the same underlying type is safe + (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) + ); + } + + if ((0, _definition.isNonNullType)(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType); + } + + return (// if they're both named types, see if their names are equivalent + (0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe + (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return (0, _definition.isListType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType); + } + + if ((0, _definition.isNonNullType)(oldType)) { + return (// if they're both non-null, make sure the underlying types are + // compatible + (0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) || // moving from non-null to nullable of the same underlying type is safe + !(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType) + ); + } // if they're both named types, see if their names are equivalent + + + return (0, _definition.isNamedType)(newType) && oldType.name === newType.name; +} + +function typeKindName(type) { + if ((0, _definition.isScalarType)(type)) { + return 'a Scalar type'; + } + + if ((0, _definition.isObjectType)(type)) { + return 'an Object type'; + } + + if ((0, _definition.isInterfaceType)(type)) { + return 'an Interface type'; + } + + if ((0, _definition.isUnionType)(type)) { + return 'a Union type'; + } + + if ((0, _definition.isEnumType)(type)) { + return 'an Enum type'; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isInputObjectType)(type)) { + return 'an Input type'; + } // istanbul ignore next (Not reachable. All possible named types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); +} + +function stringifyValue(value, type) { + var ast = (0, _astFromValue.astFromValue)(value, type); + ast != null || (0, _invariant.default)(0); + var sortedAST = (0, _visitor.visit)(ast, { + ObjectValue: function ObjectValue(objectNode) { + var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) { + return fieldA.name.value.localeCompare(fieldB.name.value); + }); + return _objectSpread(_objectSpread({}, objectNode), {}, { + fields: fields + }); + } + }); + return (0, _printer.print)(sortedAST); +} + +function diff(oldArray, newArray) { + var added = []; + var removed = []; + var persisted = []; + var oldMap = (0, _keyMap.default)(oldArray, function (_ref11) { + var name = _ref11.name; + return name; + }); + var newMap = (0, _keyMap.default)(newArray, function (_ref12) { + var name = _ref12.name; + return name; + }); + + for (var _i44 = 0; _i44 < oldArray.length; _i44++) { + var oldItem = oldArray[_i44]; + var newItem = newMap[oldItem.name]; + + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (var _i46 = 0; _i46 < newArray.length; _i46++) { + var _newItem = newArray[_i46]; + + if (oldMap[_newItem.name] === undefined) { + added.push(_newItem); + } + } + + return { + added: added, + persisted: persisted, + removed: removed + }; +} + + +/***/ }), + +/***/ 26461: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.findDeprecatedUsages = findDeprecatedUsages; + +var _validate = __nccwpck_require__(14193); + +var _NoDeprecatedCustomRule = __nccwpck_require__(33915); + +/** + * A validation rule which reports deprecated usages. + * + * Returns a list of GraphQLError instances describing each deprecated use. + * + * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead: + * + * ``` + * import { validate, NoDeprecatedCustomRule } from 'graphql' + * + * const errors = validate(schema, document, [NoDeprecatedCustomRule]) + * ``` + */ +function findDeprecatedUsages(schema, ast) { + return (0, _validate.validate)(schema, ast, [_NoDeprecatedCustomRule.NoDeprecatedCustomRule]); +} + + +/***/ }), + +/***/ 747: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getIntrospectionQuery = getIntrospectionQuery; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function getIntrospectionQuery(options) { + var optionsWithDefault = _objectSpread({ + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false + }, options); + + var descriptions = optionsWithDefault.descriptions ? 'description' : ''; + var specifiedByUrl = optionsWithDefault.specifiedByUrl ? 'specifiedByUrl' : ''; + var directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : ''; + var schemaDescription = optionsWithDefault.schemaDescription ? descriptions : ''; + return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n ").concat(specifiedByUrl, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n "); +} + + +/***/ }), + +/***/ 92854: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getOperationAST = getOperationAST; + +var _kinds = __nccwpck_require__(11927); + +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +function getOperationAST(documentAST, operationName) { + var operation = null; + + for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) { + var definition = _documentAST$definiti2[_i2]; + + if (definition.kind === _kinds.Kind.OPERATION_DEFINITION) { + var _definition$name; + + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + + operation = definition; + } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { + return definition; + } + } + } + + return operation; +} + + +/***/ }), + +/***/ 81605: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getOperationRootType = getOperationRootType; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Extracts the root type of the operation from the schema. + */ +function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + var queryType = schema.getQueryType(); + + if (!queryType) { + throw new _GraphQLError.GraphQLError('Schema does not define the required query root type.', operation); + } + + return queryType; + } + + if (operation.operation === 'mutation') { + var mutationType = schema.getMutationType(); + + if (!mutationType) { + throw new _GraphQLError.GraphQLError('Schema is not configured for mutations.', operation); + } + + return mutationType; + } + + if (operation.operation === 'subscription') { + var subscriptionType = schema.getSubscriptionType(); + + if (!subscriptionType) { + throw new _GraphQLError.GraphQLError('Schema is not configured for subscriptions.', operation); + } + + return subscriptionType; + } + + throw new _GraphQLError.GraphQLError('Can only have query, mutation and subscription operations.', operation); +} + + +/***/ }), + +/***/ 676: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "getIntrospectionQuery", ({ + enumerable: true, + get: function get() { + return _getIntrospectionQuery.getIntrospectionQuery; + } +})); +Object.defineProperty(exports, "getOperationAST", ({ + enumerable: true, + get: function get() { + return _getOperationAST.getOperationAST; + } +})); +Object.defineProperty(exports, "getOperationRootType", ({ + enumerable: true, + get: function get() { + return _getOperationRootType.getOperationRootType; + } +})); +Object.defineProperty(exports, "introspectionFromSchema", ({ + enumerable: true, + get: function get() { + return _introspectionFromSchema.introspectionFromSchema; + } +})); +Object.defineProperty(exports, "buildClientSchema", ({ + enumerable: true, + get: function get() { + return _buildClientSchema.buildClientSchema; + } +})); +Object.defineProperty(exports, "buildASTSchema", ({ + enumerable: true, + get: function get() { + return _buildASTSchema.buildASTSchema; + } +})); +Object.defineProperty(exports, "buildSchema", ({ + enumerable: true, + get: function get() { + return _buildASTSchema.buildSchema; + } +})); +Object.defineProperty(exports, "extendSchema", ({ + enumerable: true, + get: function get() { + return _extendSchema.extendSchema; + } +})); +Object.defineProperty(exports, "getDescription", ({ + enumerable: true, + get: function get() { + return _extendSchema.getDescription; + } +})); +Object.defineProperty(exports, "lexicographicSortSchema", ({ + enumerable: true, + get: function get() { + return _lexicographicSortSchema.lexicographicSortSchema; + } +})); +Object.defineProperty(exports, "printSchema", ({ + enumerable: true, + get: function get() { + return _printSchema.printSchema; + } +})); +Object.defineProperty(exports, "printType", ({ + enumerable: true, + get: function get() { + return _printSchema.printType; + } +})); +Object.defineProperty(exports, "printIntrospectionSchema", ({ + enumerable: true, + get: function get() { + return _printSchema.printIntrospectionSchema; + } +})); +Object.defineProperty(exports, "typeFromAST", ({ + enumerable: true, + get: function get() { + return _typeFromAST.typeFromAST; + } +})); +Object.defineProperty(exports, "valueFromAST", ({ + enumerable: true, + get: function get() { + return _valueFromAST.valueFromAST; + } +})); +Object.defineProperty(exports, "valueFromASTUntyped", ({ + enumerable: true, + get: function get() { + return _valueFromASTUntyped.valueFromASTUntyped; + } +})); +Object.defineProperty(exports, "astFromValue", ({ + enumerable: true, + get: function get() { + return _astFromValue.astFromValue; + } +})); +Object.defineProperty(exports, "TypeInfo", ({ + enumerable: true, + get: function get() { + return _TypeInfo.TypeInfo; + } +})); +Object.defineProperty(exports, "visitWithTypeInfo", ({ + enumerable: true, + get: function get() { + return _TypeInfo.visitWithTypeInfo; + } +})); +Object.defineProperty(exports, "coerceInputValue", ({ + enumerable: true, + get: function get() { + return _coerceInputValue.coerceInputValue; + } +})); +Object.defineProperty(exports, "concatAST", ({ + enumerable: true, + get: function get() { + return _concatAST.concatAST; + } +})); +Object.defineProperty(exports, "separateOperations", ({ + enumerable: true, + get: function get() { + return _separateOperations.separateOperations; + } +})); +Object.defineProperty(exports, "stripIgnoredCharacters", ({ + enumerable: true, + get: function get() { + return _stripIgnoredCharacters.stripIgnoredCharacters; + } +})); +Object.defineProperty(exports, "isEqualType", ({ + enumerable: true, + get: function get() { + return _typeComparators.isEqualType; + } +})); +Object.defineProperty(exports, "isTypeSubTypeOf", ({ + enumerable: true, + get: function get() { + return _typeComparators.isTypeSubTypeOf; + } +})); +Object.defineProperty(exports, "doTypesOverlap", ({ + enumerable: true, + get: function get() { + return _typeComparators.doTypesOverlap; + } +})); +Object.defineProperty(exports, "assertValidName", ({ + enumerable: true, + get: function get() { + return _assertValidName.assertValidName; + } +})); +Object.defineProperty(exports, "isValidNameError", ({ + enumerable: true, + get: function get() { + return _assertValidName.isValidNameError; + } +})); +Object.defineProperty(exports, "BreakingChangeType", ({ + enumerable: true, + get: function get() { + return _findBreakingChanges.BreakingChangeType; + } +})); +Object.defineProperty(exports, "DangerousChangeType", ({ + enumerable: true, + get: function get() { + return _findBreakingChanges.DangerousChangeType; + } +})); +Object.defineProperty(exports, "findBreakingChanges", ({ + enumerable: true, + get: function get() { + return _findBreakingChanges.findBreakingChanges; + } +})); +Object.defineProperty(exports, "findDangerousChanges", ({ + enumerable: true, + get: function get() { + return _findBreakingChanges.findDangerousChanges; + } +})); +Object.defineProperty(exports, "findDeprecatedUsages", ({ + enumerable: true, + get: function get() { + return _findDeprecatedUsages.findDeprecatedUsages; + } +})); + +var _getIntrospectionQuery = __nccwpck_require__(747); + +var _getOperationAST = __nccwpck_require__(92854); + +var _getOperationRootType = __nccwpck_require__(81605); + +var _introspectionFromSchema = __nccwpck_require__(47371); + +var _buildClientSchema = __nccwpck_require__(9352); + +var _buildASTSchema = __nccwpck_require__(9337); + +var _extendSchema = __nccwpck_require__(51832); + +var _lexicographicSortSchema = __nccwpck_require__(19447); + +var _printSchema = __nccwpck_require__(84166); + +var _typeFromAST = __nccwpck_require__(27664); + +var _valueFromAST = __nccwpck_require__(83181); + +var _valueFromASTUntyped = __nccwpck_require__(86699); + +var _astFromValue = __nccwpck_require__(12653); + +var _TypeInfo = __nccwpck_require__(76625); + +var _coerceInputValue = __nccwpck_require__(39603); + +var _concatAST = __nccwpck_require__(17232); + +var _separateOperations = __nccwpck_require__(29125); + +var _stripIgnoredCharacters = __nccwpck_require__(17766); + +var _typeComparators = __nccwpck_require__(10333); + +var _assertValidName = __nccwpck_require__(25780); + +var _findBreakingChanges = __nccwpck_require__(59366); + +var _findDeprecatedUsages = __nccwpck_require__(26461); + + +/***/ }), + +/***/ 47371: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.introspectionFromSchema = introspectionFromSchema; + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _parser = __nccwpck_require__(50655); + +var _execute = __nccwpck_require__(83677); + +var _getIntrospectionQuery = __nccwpck_require__(747); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +function introspectionFromSchema(schema, options) { + var optionsWithDefaults = _objectSpread({ + directiveIsRepeatable: true, + schemaDescription: true + }, options); + + var document = (0, _parser.parse)((0, _getIntrospectionQuery.getIntrospectionQuery)(optionsWithDefaults)); + var result = (0, _execute.executeSync)({ + schema: schema, + document: document + }); + !result.errors && result.data || (0, _invariant.default)(0); + return result.data; +} + + +/***/ }), + +/***/ 19447: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.lexicographicSortSchema = lexicographicSortSchema; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _keyValMap = _interopRequireDefault(__nccwpck_require__(49268)); + +var _schema = __nccwpck_require__(8505); + +var _directives = __nccwpck_require__(83614); + +var _introspection = __nccwpck_require__(28344); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +function lexicographicSortSchema(schema) { + var schemaConfig = schema.toConfig(); + var typeMap = (0, _keyValMap.default)(sortByName(schemaConfig.types), function (type) { + return type.name; + }, sortNamedType); + return new _schema.GraphQLSchema(_objectSpread(_objectSpread({}, schemaConfig), {}, { + types: (0, _objectValues.default)(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription) + })); + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // $FlowFixMe[incompatible-return] + return new _definition.GraphQLList(replaceType(type.ofType)); + } else if ((0, _definition.isNonNullType)(type)) { + // $FlowFixMe[incompatible-return] + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + return typeMap[type.name]; + } + + function replaceMaybeType(maybeType) { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive) { + var config = directive.toConfig(); + return new _directives.GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, { + locations: sortBy(config.locations, function (x) { + return x; + }), + args: sortArgs(config.args) + })); + } + + function sortArgs(args) { + return sortObjMap(args, function (arg) { + return _objectSpread(_objectSpread({}, arg), {}, { + type: replaceType(arg.type) + }); + }); + } + + function sortFields(fieldsMap) { + return sortObjMap(fieldsMap, function (field) { + return _objectSpread(_objectSpread({}, field), {}, { + type: replaceType(field.type), + args: sortArgs(field.args) + }); + }); + } + + function sortInputFields(fieldsMap) { + return sortObjMap(fieldsMap, function (field) { + return _objectSpread(_objectSpread({}, field), {}, { + type: replaceType(field.type) + }); + }); + } + + function sortTypes(arr) { + return sortByName(arr).map(replaceNamedType); + } + + function sortNamedType(type) { + if ((0, _definition.isScalarType)(type) || (0, _introspection.isIntrospectionType)(type)) { + return type; + } + + if ((0, _definition.isObjectType)(type)) { + var config = type.toConfig(); + return new _definition.GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, { + interfaces: function interfaces() { + return sortTypes(config.interfaces); + }, + fields: function fields() { + return sortFields(config.fields); + } + })); + } + + if ((0, _definition.isInterfaceType)(type)) { + var _config = type.toConfig(); + + return new _definition.GraphQLInterfaceType(_objectSpread(_objectSpread({}, _config), {}, { + interfaces: function interfaces() { + return sortTypes(_config.interfaces); + }, + fields: function fields() { + return sortFields(_config.fields); + } + })); + } + + if ((0, _definition.isUnionType)(type)) { + var _config2 = type.toConfig(); + + return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, { + types: function types() { + return sortTypes(_config2.types); + } + })); + } + + if ((0, _definition.isEnumType)(type)) { + var _config3 = type.toConfig(); + + return new _definition.GraphQLEnumType(_objectSpread(_objectSpread({}, _config3), {}, { + values: sortObjMap(_config3.values) + })); + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isInputObjectType)(type)) { + var _config4 = type.toConfig(); + + return new _definition.GraphQLInputObjectType(_objectSpread(_objectSpread({}, _config4), {}, { + fields: function fields() { + return sortInputFields(_config4.fields); + } + })); + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); + } +} + +function sortObjMap(map, sortValueFn) { + var sortedMap = Object.create(null); + var sortedKeys = sortBy(Object.keys(map), function (x) { + return x; + }); + + for (var _i2 = 0; _i2 < sortedKeys.length; _i2++) { + var key = sortedKeys[_i2]; + var value = map[key]; + sortedMap[key] = sortValueFn ? sortValueFn(value) : value; + } + + return sortedMap; +} + +function sortByName(array) { + return sortBy(array, function (obj) { + return obj.name; + }); +} + +function sortBy(array, mapToKey) { + return array.slice().sort(function (obj1, obj2) { + var key1 = mapToKey(obj1); + var key2 = mapToKey(obj2); + return key1.localeCompare(key2); + }); +} + + +/***/ }), + +/***/ 84166: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.printSchema = printSchema; +exports.printIntrospectionSchema = printIntrospectionSchema; +exports.printType = printType; + +var _objectValues = _interopRequireDefault(__nccwpck_require__(30026)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _printer = __nccwpck_require__(68203); + +var _blockString = __nccwpck_require__(4515); + +var _introspection = __nccwpck_require__(28344); + +var _scalars = __nccwpck_require__(93145); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +var _astFromValue = __nccwpck_require__(12653); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Accepts options as a second argument: + * + * - commentDescriptions: + * Provide true to use preceding comments as the description. + * + */ +function printSchema(schema, options) { + return printFilteredSchema(schema, function (n) { + return !(0, _directives.isSpecifiedDirective)(n); + }, isDefinedType, options); +} + +function printIntrospectionSchema(schema, options) { + return printFilteredSchema(schema, _directives.isSpecifiedDirective, _introspection.isIntrospectionType, options); +} + +function isDefinedType(type) { + return !(0, _scalars.isSpecifiedScalarType)(type) && !(0, _introspection.isIntrospectionType)(type); +} + +function printFilteredSchema(schema, directiveFilter, typeFilter, options) { + var directives = schema.getDirectives().filter(directiveFilter); + var types = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter); + return [printSchemaDefinition(schema)].concat(directives.map(function (directive) { + return printDirective(directive, options); + }), types.map(function (type) { + return printType(type, options); + })).filter(Boolean).join('\n\n') + '\n'; +} + +function printSchemaDefinition(schema) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + var operationTypes = []; + var queryType = schema.getQueryType(); + + if (queryType) { + operationTypes.push(" query: ".concat(queryType.name)); + } + + var mutationType = schema.getMutationType(); + + if (mutationType) { + operationTypes.push(" mutation: ".concat(mutationType.name)); + } + + var subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + operationTypes.push(" subscription: ".concat(subscriptionType.name)); + } + + return printDescription({}, schema) + "schema {\n".concat(operationTypes.join('\n'), "\n}"); +} +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * schema { + * query: Query + * mutation: Mutation + * } + * + * When using this naming convention, the schema description can be omitted. + */ + + +function isSchemaOfCommonNames(schema) { + var queryType = schema.getQueryType(); + + if (queryType && queryType.name !== 'Query') { + return false; + } + + var mutationType = schema.getMutationType(); + + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + var subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +function printType(type, options) { + if ((0, _definition.isScalarType)(type)) { + return printScalar(type, options); + } + + if ((0, _definition.isObjectType)(type)) { + return printObject(type, options); + } + + if ((0, _definition.isInterfaceType)(type)) { + return printInterface(type, options); + } + + if ((0, _definition.isUnionType)(type)) { + return printUnion(type, options); + } + + if ((0, _definition.isEnumType)(type)) { + return printEnum(type, options); + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isInputObjectType)(type)) { + return printInputObject(type, options); + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); +} + +function printScalar(type, options) { + return printDescription(options, type) + "scalar ".concat(type.name) + printSpecifiedByUrl(type); +} + +function printImplementedInterfaces(type) { + var interfaces = type.getInterfaces(); + return interfaces.length ? ' implements ' + interfaces.map(function (i) { + return i.name; + }).join(' & ') : ''; +} + +function printObject(type, options) { + return printDescription(options, type) + "type ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); +} + +function printInterface(type, options) { + return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type); +} + +function printUnion(type, options) { + var types = type.getTypes(); + var possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(options, type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type, options) { + var values = type.getValues().map(function (value, i) { + return printDescription(options, value, ' ', !i) + ' ' + value.name + printDeprecated(value.deprecationReason); + }); + return printDescription(options, type) + "enum ".concat(type.name) + printBlock(values); +} + +function printInputObject(type, options) { + var fields = (0, _objectValues.default)(type.getFields()).map(function (f, i) { + return printDescription(options, f, ' ', !i) + ' ' + printInputValue(f); + }); + return printDescription(options, type) + "input ".concat(type.name) + printBlock(fields); +} + +function printFields(options, type) { + var fields = (0, _objectValues.default)(type.getFields()).map(function (f, i) { + return printDescription(options, f, ' ', !i) + ' ' + f.name + printArgs(options, f.args, ' ') + ': ' + String(f.type) + printDeprecated(f.deprecationReason); + }); + return printBlock(fields); +} + +function printBlock(items) { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs(options, args) { + var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + + if (args.length === 0) { + return ''; + } // If every arg does not have a description, print them on one line. + + + if (args.every(function (arg) { + return !arg.description; + })) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return '(\n' + args.map(function (arg, i) { + return printDescription(options, arg, ' ' + indentation, !i) + ' ' + indentation + printInputValue(arg); + }).join('\n') + '\n' + indentation + ')'; +} + +function printInputValue(arg) { + var defaultAST = (0, _astFromValue.astFromValue)(arg.defaultValue, arg.type); + var argDecl = arg.name + ': ' + String(arg.type); + + if (defaultAST) { + argDecl += " = ".concat((0, _printer.print)(defaultAST)); + } + + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive, options) { + return printDescription(options, directive) + 'directive @' + directive.name + printArgs(options, directive.args) + (directive.isRepeatable ? ' repeatable' : '') + ' on ' + directive.locations.join(' | '); +} + +function printDeprecated(reason) { + if (reason == null) { + return ''; + } + + var reasonAST = (0, _astFromValue.astFromValue)(reason, _scalars.GraphQLString); + + if (reasonAST && reason !== _directives.DEFAULT_DEPRECATION_REASON) { + return ' @deprecated(reason: ' + (0, _printer.print)(reasonAST) + ')'; + } + + return ' @deprecated'; +} + +function printSpecifiedByUrl(scalar) { + if (scalar.specifiedByUrl == null) { + return ''; + } + + var url = scalar.specifiedByUrl; + var urlAST = (0, _astFromValue.astFromValue)(url, _scalars.GraphQLString); + urlAST || (0, _invariant.default)(0, 'Unexpected null value returned from `astFromValue` for specifiedByUrl'); + return ' @specifiedBy(url: ' + (0, _printer.print)(urlAST) + ')'; +} + +function printDescription(options, def) { + var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + var firstInBlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var description = def.description; + + if (description == null) { + return ''; + } + + if ((options === null || options === void 0 ? void 0 : options.commentDescriptions) === true) { + return printDescriptionWithComments(description, indentation, firstInBlock); + } + + var preferMultipleLines = description.length > 70; + var blockString = (0, _blockString.printBlockString)(description, '', preferMultipleLines); + var prefix = indentation && !firstInBlock ? '\n' + indentation : indentation; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} + +function printDescriptionWithComments(description, indentation, firstInBlock) { + var prefix = indentation && !firstInBlock ? '\n' : ''; + var comment = description.split('\n').map(function (line) { + return indentation + (line !== '' ? '# ' + line : '#'); + }).join('\n'); + return prefix + comment + '\n'; +} + + +/***/ }), + +/***/ 29125: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.separateOperations = separateOperations; + +var _kinds = __nccwpck_require__(11927); + +var _visitor = __nccwpck_require__(5678); + +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +function separateOperations(documentAST) { + var operations = []; + var depGraph = Object.create(null); + var fromName; // Populate metadata and build a dependency graph. + + (0, _visitor.visit)(documentAST, { + OperationDefinition: function OperationDefinition(node) { + fromName = opName(node); + operations.push(node); + }, + FragmentDefinition: function FragmentDefinition(node) { + fromName = node.name.value; + }, + FragmentSpread: function FragmentSpread(node) { + var toName = node.name.value; + var dependents = depGraph[fromName]; + + if (dependents === undefined) { + dependents = depGraph[fromName] = Object.create(null); + } + + dependents[toName] = true; + } + }); // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + + var separatedDocumentASTs = Object.create(null); + + var _loop = function _loop(_i2) { + var operation = operations[_i2]; + var operationName = opName(operation); + var dependencies = Object.create(null); + collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + + separatedDocumentASTs[operationName] = { + kind: _kinds.Kind.DOCUMENT, + definitions: documentAST.definitions.filter(function (node) { + return node === operation || node.kind === _kinds.Kind.FRAGMENT_DEFINITION && dependencies[node.name.value]; + }) + }; + }; + + for (var _i2 = 0; _i2 < operations.length; _i2++) { + _loop(_i2); + } + + return separatedDocumentASTs; +} + +// Provides the empty string for anonymous operations. +function opName(operation) { + return operation.name ? operation.name.value : ''; +} // From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. + + +function collectTransitiveDependencies(collected, depGraph, fromName) { + var immediateDeps = depGraph[fromName]; + + if (immediateDeps) { + for (var _i4 = 0, _Object$keys2 = Object.keys(immediateDeps); _i4 < _Object$keys2.length; _i4++) { + var toName = _Object$keys2[_i4]; + + if (!collected[toName]) { + collected[toName] = true; + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + + +/***/ }), + +/***/ 17766: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.stripIgnoredCharacters = stripIgnoredCharacters; + +var _source = __nccwpck_require__(65521); + +var _tokenKind = __nccwpck_require__(91565); + +var _lexer = __nccwpck_require__(24605); + +var _blockString = __nccwpck_require__(4515); + +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * + * Becomes: + * + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * + * SDL example: + * + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * + * Becomes: + * + * """Type description""" type Foo{"""Field description""" bar:String} + */ +function stripIgnoredCharacters(source) { + var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); + var body = sourceObj.body; + var lexer = new _lexer.Lexer(sourceObj); + var strippedBody = ''; + var wasLastAddedTokenNonPunctuator = false; + + while (lexer.advance().kind !== _tokenKind.TokenKind.EOF) { + var currentToken = lexer.token; + var tokenKind = currentToken.kind; + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + + var isNonPunctuator = !(0, _lexer.isPunctuatorTokenKind)(currentToken.kind); + + if (wasLastAddedTokenNonPunctuator) { + if (isNonPunctuator || currentToken.kind === _tokenKind.TokenKind.SPREAD) { + strippedBody += ' '; + } + } + + var tokenBody = body.slice(currentToken.start, currentToken.end); + + if (tokenKind === _tokenKind.TokenKind.BLOCK_STRING) { + strippedBody += dedentBlockString(tokenBody); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} + +function dedentBlockString(blockStr) { + // skip leading and trailing triple quotations + var rawStr = blockStr.slice(3, -3); + var body = (0, _blockString.dedentBlockStringValue)(rawStr); + + if ((0, _blockString.getBlockStringIndentation)(body) > 0) { + body = '\n' + body; + } + + var lastChar = body[body.length - 1]; + var hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""'; + + if (hasTrailingQuote || lastChar === '\\') { + body += '\n'; + } + + return '"""' + body + '"""'; +} + + +/***/ }), + +/***/ 10333: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isEqualType = isEqualType; +exports.isTypeSubTypeOf = isTypeSubTypeOf; +exports.doTypesOverlap = doTypesOverlap; + +var _definition = __nccwpck_require__(5821); + +/** + * Provided two types, return true if the types are equal (invariant). + */ +function isEqualType(typeA, typeB) { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } // If either type is non-null, the other must also be non-null. + + + if ((0, _definition.isNonNullType)(typeA) && (0, _definition.isNonNullType)(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // If either type is a list, the other must also be a list. + + + if ((0, _definition.isListType)(typeA) && (0, _definition.isListType)(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // Otherwise the types are not equal. + + + return false; +} +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + + +function isTypeSubTypeOf(schema, maybeSubType, superType) { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } // If superType is non-null, maybeSubType must also be non-null. + + + if ((0, _definition.isNonNullType)(superType)) { + if ((0, _definition.isNonNullType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isNonNullType)(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } // If superType type is a list, maybeSubType type must also be a list. + + + if ((0, _definition.isListType)(superType)) { + if ((0, _definition.isListType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isListType)(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + + + return (0, _definition.isAbstractType)(superType) && ((0, _definition.isInterfaceType)(maybeSubType) || (0, _definition.isObjectType)(maybeSubType)) && schema.isSubType(superType, maybeSubType); +} +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + + +function doTypesOverlap(schema, typeA, typeB) { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if ((0, _definition.isAbstractType)(typeA)) { + if ((0, _definition.isAbstractType)(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema.getPossibleTypes(typeA).some(function (type) { + return schema.isSubType(typeB, type); + }); + } // Determine if the latter type is a possible concrete type of the former. + + + return schema.isSubType(typeA, typeB); + } + + if ((0, _definition.isAbstractType)(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } // Otherwise the types do not overlap. + + + return false; +} + + +/***/ }), + +/***/ 27664: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.typeFromAST = typeFromAST; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _kinds = __nccwpck_require__(11927); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function typeFromAST(schema, typeNode) { + /* eslint-enable no-redeclare */ + var innerType; + + if (typeNode.kind === _kinds.Kind.LIST_TYPE) { + innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLList(innerType); + } + + if (typeNode.kind === _kinds.Kind.NON_NULL_TYPE) { + innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLNonNull(innerType); + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if (typeNode.kind === _kinds.Kind.NAMED_TYPE) { + return schema.getType(typeNode.name.value); + } // istanbul ignore next (Not reachable. All possible type nodes have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type node: ' + (0, _inspect.default)(typeNode)); +} + + +/***/ }), + +/***/ 83181: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.valueFromAST = valueFromAST; + +var _objectValues3 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _kinds = __nccwpck_require__(11927); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Mixed | + * | NullValue | null | + * + */ +function valueFromAST(valueNode, type, variables) { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + var variableName = valueNode.name.value; + + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + + var variableValue = variables[variableName]; + + if (variableValue === null && (0, _definition.isNonNullType)(type)) { + return; // Invalid: intentionally return no value. + } // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + + + return variableValue; + } + + if ((0, _definition.isNonNullType)(type)) { + if (valueNode.kind === _kinds.Kind.NULL) { + return; // Invalid: intentionally return no value. + } + + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === _kinds.Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + var itemType = type.ofType; + + if (valueNode.kind === _kinds.Kind.LIST) { + var coercedValues = []; + + for (var _i2 = 0, _valueNode$values2 = valueNode.values; _i2 < _valueNode$values2.length; _i2++) { + var itemNode = _valueNode$values2[_i2]; + + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if ((0, _definition.isNonNullType)(itemType)) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(null); + } else { + var itemValue = valueFromAST(itemNode, itemType, variables); + + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(itemValue); + } + } + + return coercedValues; + } + + var coercedValue = valueFromAST(valueNode, itemType, variables); + + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + + return [coercedValue]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (valueNode.kind !== _kinds.Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + + var coercedObj = Object.create(null); + var fieldNodes = (0, _keyMap.default)(valueNode.fields, function (field) { + return field.name.value; + }); + + for (var _i4 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) { + var field = _objectValues2[_i4]; + var fieldNode = fieldNodes[field.name]; + + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + return; // Invalid: intentionally return no value. + } + + continue; + } + + var fieldValue = valueFromAST(fieldNode.value, field.type, variables); + + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedObj[field.name] = fieldValue; + } + + return coercedObj; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isLeafType)(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + var result; + + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + + return result; + } // istanbul ignore next (Not reachable. All possible input types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type)); +} // Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. + + +function isMissingVariable(valueNode, variables) { + return valueNode.kind === _kinds.Kind.VARIABLE && (variables == null || variables[valueNode.name.value] === undefined); +} + + +/***/ }), + +/***/ 86699: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.valueFromASTUntyped = valueFromASTUntyped; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _keyValMap = _interopRequireDefault(__nccwpck_require__(49268)); + +var _kinds = __nccwpck_require__(11927); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +function valueFromASTUntyped(valueNode, variables) { + switch (valueNode.kind) { + case _kinds.Kind.NULL: + return null; + + case _kinds.Kind.INT: + return parseInt(valueNode.value, 10); + + case _kinds.Kind.FLOAT: + return parseFloat(valueNode.value); + + case _kinds.Kind.STRING: + case _kinds.Kind.ENUM: + case _kinds.Kind.BOOLEAN: + return valueNode.value; + + case _kinds.Kind.LIST: + return valueNode.values.map(function (node) { + return valueFromASTUntyped(node, variables); + }); + + case _kinds.Kind.OBJECT: + return (0, _keyValMap.default)(valueNode.fields, function (field) { + return field.name.value; + }, function (field) { + return valueFromASTUntyped(field.value, variables); + }); + + case _kinds.Kind.VARIABLE: + return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value]; + } // istanbul ignore next (Not reachable. All possible value nodes have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected value node: ' + (0, _inspect.default)(valueNode)); +} + + +/***/ }), + +/***/ 28263: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ValidationContext = exports.SDLValidationContext = exports.ASTValidationContext = void 0; + +var _kinds = __nccwpck_require__(11927); + +var _visitor = __nccwpck_require__(5678); + +var _TypeInfo = __nccwpck_require__(76625); + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +var ASTValidationContext = /*#__PURE__*/function () { + function ASTValidationContext(ast, onError) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + var _proto = ASTValidationContext.prototype; + + _proto.reportError = function reportError(error) { + this._onError(error); + }; + + _proto.getDocument = function getDocument() { + return this._ast; + }; + + _proto.getFragment = function getFragment(name) { + var fragments = this._fragments; + + if (!fragments) { + this._fragments = fragments = this.getDocument().definitions.reduce(function (frags, statement) { + if (statement.kind === _kinds.Kind.FRAGMENT_DEFINITION) { + frags[statement.name.value] = statement; + } + + return frags; + }, Object.create(null)); + } + + return fragments[name]; + }; + + _proto.getFragmentSpreads = function getFragmentSpreads(node) { + var spreads = this._fragmentSpreads.get(node); + + if (!spreads) { + spreads = []; + var setsToVisit = [node]; + + while (setsToVisit.length !== 0) { + var set = setsToVisit.pop(); + + for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) { + var selection = _set$selections2[_i2]; + + if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + + this._fragmentSpreads.set(node, spreads); + } + + return spreads; + }; + + _proto.getRecursivelyReferencedFragments = function getRecursivelyReferencedFragments(operation) { + var fragments = this._recursivelyReferencedFragments.get(operation); + + if (!fragments) { + fragments = []; + var collectedNames = Object.create(null); + var nodesToVisit = [operation.selectionSet]; + + while (nodesToVisit.length !== 0) { + var node = nodesToVisit.pop(); + + for (var _i4 = 0, _this$getFragmentSpre2 = this.getFragmentSpreads(node); _i4 < _this$getFragmentSpre2.length; _i4++) { + var spread = _this$getFragmentSpre2[_i4]; + var fragName = spread.name.value; + + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + var fragment = this.getFragment(fragName); + + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + + this._recursivelyReferencedFragments.set(operation, fragments); + } + + return fragments; + }; + + return ASTValidationContext; +}(); + +exports.ASTValidationContext = ASTValidationContext; + +var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext) { + _inheritsLoose(SDLValidationContext, _ASTValidationContext); + + function SDLValidationContext(ast, schema, onError) { + var _this; + + _this = _ASTValidationContext.call(this, ast, onError) || this; + _this._schema = schema; + return _this; + } + + var _proto2 = SDLValidationContext.prototype; + + _proto2.getSchema = function getSchema() { + return this._schema; + }; + + return SDLValidationContext; +}(ASTValidationContext); + +exports.SDLValidationContext = SDLValidationContext; + +var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) { + _inheritsLoose(ValidationContext, _ASTValidationContext2); + + function ValidationContext(schema, ast, typeInfo, onError) { + var _this2; + + _this2 = _ASTValidationContext2.call(this, ast, onError) || this; + _this2._schema = schema; + _this2._typeInfo = typeInfo; + _this2._variableUsages = new Map(); + _this2._recursiveVariableUsages = new Map(); + return _this2; + } + + var _proto3 = ValidationContext.prototype; + + _proto3.getSchema = function getSchema() { + return this._schema; + }; + + _proto3.getVariableUsages = function getVariableUsages(node) { + var usages = this._variableUsages.get(node); + + if (!usages) { + var newUsages = []; + var typeInfo = new _TypeInfo.TypeInfo(this._schema); + (0, _visitor.visit)(node, (0, _TypeInfo.visitWithTypeInfo)(typeInfo, { + VariableDefinition: function VariableDefinition() { + return false; + }, + Variable: function Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue() + }); + } + })); + usages = newUsages; + + this._variableUsages.set(node, usages); + } + + return usages; + }; + + _proto3.getRecursiveVariableUsages = function getRecursiveVariableUsages(operation) { + var usages = this._recursiveVariableUsages.get(operation); + + if (!usages) { + usages = this.getVariableUsages(operation); + + for (var _i6 = 0, _this$getRecursivelyR2 = this.getRecursivelyReferencedFragments(operation); _i6 < _this$getRecursivelyR2.length; _i6++) { + var frag = _this$getRecursivelyR2[_i6]; + usages = usages.concat(this.getVariableUsages(frag)); + } + + this._recursiveVariableUsages.set(operation, usages); + } + + return usages; + }; + + _proto3.getType = function getType() { + return this._typeInfo.getType(); + }; + + _proto3.getParentType = function getParentType() { + return this._typeInfo.getParentType(); + }; + + _proto3.getInputType = function getInputType() { + return this._typeInfo.getInputType(); + }; + + _proto3.getParentInputType = function getParentInputType() { + return this._typeInfo.getParentInputType(); + }; + + _proto3.getFieldDef = function getFieldDef() { + return this._typeInfo.getFieldDef(); + }; + + _proto3.getDirective = function getDirective() { + return this._typeInfo.getDirective(); + }; + + _proto3.getArgument = function getArgument() { + return this._typeInfo.getArgument(); + }; + + _proto3.getEnumValue = function getEnumValue() { + return this._typeInfo.getEnumValue(); + }; + + return ValidationContext; +}(ASTValidationContext); + +exports.ValidationContext = ValidationContext; + + +/***/ }), + +/***/ 82201: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function get() { + return _validate.validate; + } +})); +Object.defineProperty(exports, "ValidationContext", ({ + enumerable: true, + get: function get() { + return _ValidationContext.ValidationContext; + } +})); +Object.defineProperty(exports, "specifiedRules", ({ + enumerable: true, + get: function get() { + return _specifiedRules.specifiedRules; + } +})); +Object.defineProperty(exports, "ExecutableDefinitionsRule", ({ + enumerable: true, + get: function get() { + return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; + } +})); +Object.defineProperty(exports, "FieldsOnCorrectTypeRule", ({ + enumerable: true, + get: function get() { + return _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule; + } +})); +Object.defineProperty(exports, "FragmentsOnCompositeTypesRule", ({ + enumerable: true, + get: function get() { + return _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule; + } +})); +Object.defineProperty(exports, "KnownArgumentNamesRule", ({ + enumerable: true, + get: function get() { + return _KnownArgumentNamesRule.KnownArgumentNamesRule; + } +})); +Object.defineProperty(exports, "KnownDirectivesRule", ({ + enumerable: true, + get: function get() { + return _KnownDirectivesRule.KnownDirectivesRule; + } +})); +Object.defineProperty(exports, "KnownFragmentNamesRule", ({ + enumerable: true, + get: function get() { + return _KnownFragmentNamesRule.KnownFragmentNamesRule; + } +})); +Object.defineProperty(exports, "KnownTypeNamesRule", ({ + enumerable: true, + get: function get() { + return _KnownTypeNamesRule.KnownTypeNamesRule; + } +})); +Object.defineProperty(exports, "LoneAnonymousOperationRule", ({ + enumerable: true, + get: function get() { + return _LoneAnonymousOperationRule.LoneAnonymousOperationRule; + } +})); +Object.defineProperty(exports, "NoFragmentCyclesRule", ({ + enumerable: true, + get: function get() { + return _NoFragmentCyclesRule.NoFragmentCyclesRule; + } +})); +Object.defineProperty(exports, "NoUndefinedVariablesRule", ({ + enumerable: true, + get: function get() { + return _NoUndefinedVariablesRule.NoUndefinedVariablesRule; + } +})); +Object.defineProperty(exports, "NoUnusedFragmentsRule", ({ + enumerable: true, + get: function get() { + return _NoUnusedFragmentsRule.NoUnusedFragmentsRule; + } +})); +Object.defineProperty(exports, "NoUnusedVariablesRule", ({ + enumerable: true, + get: function get() { + return _NoUnusedVariablesRule.NoUnusedVariablesRule; + } +})); +Object.defineProperty(exports, "OverlappingFieldsCanBeMergedRule", ({ + enumerable: true, + get: function get() { + return _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule; + } +})); +Object.defineProperty(exports, "PossibleFragmentSpreadsRule", ({ + enumerable: true, + get: function get() { + return _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule; + } +})); +Object.defineProperty(exports, "ProvidedRequiredArgumentsRule", ({ + enumerable: true, + get: function get() { + return _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule; + } +})); +Object.defineProperty(exports, "ScalarLeafsRule", ({ + enumerable: true, + get: function get() { + return _ScalarLeafsRule.ScalarLeafsRule; + } +})); +Object.defineProperty(exports, "SingleFieldSubscriptionsRule", ({ + enumerable: true, + get: function get() { + return _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule; + } +})); +Object.defineProperty(exports, "UniqueArgumentNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueArgumentNamesRule.UniqueArgumentNamesRule; + } +})); +Object.defineProperty(exports, "UniqueDirectivesPerLocationRule", ({ + enumerable: true, + get: function get() { + return _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule; + } +})); +Object.defineProperty(exports, "UniqueFragmentNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueFragmentNamesRule.UniqueFragmentNamesRule; + } +})); +Object.defineProperty(exports, "UniqueInputFieldNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule; + } +})); +Object.defineProperty(exports, "UniqueOperationNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueOperationNamesRule.UniqueOperationNamesRule; + } +})); +Object.defineProperty(exports, "UniqueVariableNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueVariableNamesRule.UniqueVariableNamesRule; + } +})); +Object.defineProperty(exports, "ValuesOfCorrectTypeRule", ({ + enumerable: true, + get: function get() { + return _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule; + } +})); +Object.defineProperty(exports, "VariablesAreInputTypesRule", ({ + enumerable: true, + get: function get() { + return _VariablesAreInputTypesRule.VariablesAreInputTypesRule; + } +})); +Object.defineProperty(exports, "VariablesInAllowedPositionRule", ({ + enumerable: true, + get: function get() { + return _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule; + } +})); +Object.defineProperty(exports, "LoneSchemaDefinitionRule", ({ + enumerable: true, + get: function get() { + return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; + } +})); +Object.defineProperty(exports, "UniqueOperationTypesRule", ({ + enumerable: true, + get: function get() { + return _UniqueOperationTypesRule.UniqueOperationTypesRule; + } +})); +Object.defineProperty(exports, "UniqueTypeNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueTypeNamesRule.UniqueTypeNamesRule; + } +})); +Object.defineProperty(exports, "UniqueEnumValueNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; + } +})); +Object.defineProperty(exports, "UniqueFieldDefinitionNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; + } +})); +Object.defineProperty(exports, "UniqueDirectiveNamesRule", ({ + enumerable: true, + get: function get() { + return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; + } +})); +Object.defineProperty(exports, "PossibleTypeExtensionsRule", ({ + enumerable: true, + get: function get() { + return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; + } +})); +Object.defineProperty(exports, "NoDeprecatedCustomRule", ({ + enumerable: true, + get: function get() { + return _NoDeprecatedCustomRule.NoDeprecatedCustomRule; + } +})); +Object.defineProperty(exports, "NoSchemaIntrospectionCustomRule", ({ + enumerable: true, + get: function get() { + return _NoSchemaIntrospectionCustomRule.NoSchemaIntrospectionCustomRule; + } +})); + +var _validate = __nccwpck_require__(14193); + +var _ValidationContext = __nccwpck_require__(28263); + +var _specifiedRules = __nccwpck_require__(84908); + +var _ExecutableDefinitionsRule = __nccwpck_require__(89199); + +var _FieldsOnCorrectTypeRule = __nccwpck_require__(63016); + +var _FragmentsOnCompositeTypesRule = __nccwpck_require__(60381); + +var _KnownArgumentNamesRule = __nccwpck_require__(67147); + +var _KnownDirectivesRule = __nccwpck_require__(85303); + +var _KnownFragmentNamesRule = __nccwpck_require__(15166); + +var _KnownTypeNamesRule = __nccwpck_require__(42509); + +var _LoneAnonymousOperationRule = __nccwpck_require__(45726); + +var _NoFragmentCyclesRule = __nccwpck_require__(62564); + +var _NoUndefinedVariablesRule = __nccwpck_require__(61671); + +var _NoUnusedFragmentsRule = __nccwpck_require__(192); + +var _NoUnusedVariablesRule = __nccwpck_require__(40242); + +var _OverlappingFieldsCanBeMergedRule = __nccwpck_require__(23577); + +var _PossibleFragmentSpreadsRule = __nccwpck_require__(62450); + +var _ProvidedRequiredArgumentsRule = __nccwpck_require__(57669); + +var _ScalarLeafsRule = __nccwpck_require__(16830); + +var _SingleFieldSubscriptionsRule = __nccwpck_require__(4365); + +var _UniqueArgumentNamesRule = __nccwpck_require__(45799); + +var _UniqueDirectivesPerLocationRule = __nccwpck_require__(61944); + +var _UniqueFragmentNamesRule = __nccwpck_require__(79402); + +var _UniqueInputFieldNamesRule = __nccwpck_require__(83552); + +var _UniqueOperationNamesRule = __nccwpck_require__(94865); + +var _UniqueVariableNamesRule = __nccwpck_require__(65931); + +var _ValuesOfCorrectTypeRule = __nccwpck_require__(39091); + +var _VariablesAreInputTypesRule = __nccwpck_require__(99506); + +var _VariablesInAllowedPositionRule = __nccwpck_require__(8815); + +var _LoneSchemaDefinitionRule = __nccwpck_require__(48307); + +var _UniqueOperationTypesRule = __nccwpck_require__(31492); + +var _UniqueTypeNamesRule = __nccwpck_require__(24316); + +var _UniqueEnumValueNamesRule = __nccwpck_require__(44437); + +var _UniqueFieldDefinitionNamesRule = __nccwpck_require__(9502); + +var _UniqueDirectiveNamesRule = __nccwpck_require__(17074); + +var _PossibleTypeExtensionsRule = __nccwpck_require__(70075); + +var _NoDeprecatedCustomRule = __nccwpck_require__(33915); + +var _NoSchemaIntrospectionCustomRule = __nccwpck_require__(39478); + + +/***/ }), + +/***/ 89199: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _predicates = __nccwpck_require__(20535); + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + */ +function ExecutableDefinitionsRule(context) { + return { + Document: function Document(node) { + for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) { + var definition = _node$definitions2[_i2]; + + if (!(0, _predicates.isExecutableDefinitionNode)(definition)) { + var defName = definition.kind === _kinds.Kind.SCHEMA_DEFINITION || definition.kind === _kinds.Kind.SCHEMA_EXTENSION ? 'schema' : '"' + definition.name.value + '"'; + context.reportError(new _GraphQLError.GraphQLError("The ".concat(defName, " definition is not executable."), definition)); + } + } + + return false; + } + }; +} + + +/***/ }), + +/***/ 63016: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule; + +var _arrayFrom = _interopRequireDefault(__nccwpck_require__(86839)); + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + */ +function FieldsOnCorrectTypeRule(context) { + return { + Field: function Field(node) { + var type = context.getParentType(); + + if (type) { + var fieldDef = context.getFieldDef(); + + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + var schema = context.getSchema(); + var fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + var suggestion = (0, _didYouMean.default)('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? + + if (suggestion === '') { + suggestion = (0, _didYouMean.default)(getSuggestedFieldNames(type, fieldName)); + } // Report an error, including helpful suggestions. + + + context.reportError(new _GraphQLError.GraphQLError("Cannot query field \"".concat(fieldName, "\" on type \"").concat(type.name, "\".") + suggestion, node)); + } + } + } + }; +} +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ + + +function getSuggestedTypeNames(schema, type, fieldName) { + if (!(0, _definition.isAbstractType)(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + var suggestedTypes = new Set(); + var usageCount = Object.create(null); + + for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) { + var possibleType = _schema$getPossibleTy2[_i2]; + + if (!possibleType.getFields()[fieldName]) { + continue; + } // This object type defines this field. + + + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) { + var _usageCount$possibleI; + + var possibleInterface = _possibleType$getInte2[_i4]; + + if (!possibleInterface.getFields()[fieldName]) { + continue; + } // This interface type defines this field. + + + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; + } + } + + return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) { + // Suggest both interface and object types based on how common they are. + var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + + if (usageCountDiff !== 0) { + return usageCountDiff; + } // Suggest super types first followed by subtypes + + + if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) { + return -1; + } + + if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) { + return 1; + } + + return typeA.name.localeCompare(typeB.name); + }).map(function (x) { + return x.name; + }); +} +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ + + +function getSuggestedFieldNames(type, fieldName) { + if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { + var possibleFieldNames = Object.keys(type.getFields()); + return (0, _suggestionList.default)(fieldName, possibleFieldNames); + } // Otherwise, must be a Union type, which does not define fields. + + + return []; +} + + +/***/ }), + +/***/ 60381: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _printer = __nccwpck_require__(68203); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + */ +function FragmentsOnCompositeTypesRule(context) { + return { + InlineFragment: function InlineFragment(node) { + var typeCondition = node.typeCondition; + + if (typeCondition) { + var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition); + + if (type && !(0, _definition.isCompositeType)(type)) { + var typeStr = (0, _printer.print)(typeCondition); + context.reportError(new _GraphQLError.GraphQLError("Fragment cannot condition on non composite type \"".concat(typeStr, "\"."), typeCondition)); + } + } + }, + FragmentDefinition: function FragmentDefinition(node) { + var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.typeCondition); + + if (type && !(0, _definition.isCompositeType)(type)) { + var typeStr = (0, _printer.print)(node.typeCondition); + context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(node.name.value, "\" cannot condition on non composite type \"").concat(typeStr, "\"."), node.typeCondition)); + } + } + }; +} + + +/***/ }), + +/***/ 67147: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.KnownArgumentNamesRule = KnownArgumentNamesRule; +exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule; + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _directives = __nccwpck_require__(83614); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + */ +function KnownArgumentNamesRule(context) { + return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, { + Argument: function Argument(argNode) { + var argDef = context.getArgument(); + var fieldDef = context.getFieldDef(); + var parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + var argName = argNode.name.value; + var knownArgsNames = fieldDef.args.map(function (arg) { + return arg.name; + }); + var suggestions = (0, _suggestionList.default)(argName, knownArgsNames); + context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on field \"").concat(parentType.name, ".").concat(fieldDef.name, "\".") + (0, _didYouMean.default)(suggestions), argNode)); + } + } + }); +} +/** + * @internal + */ + + +function KnownArgumentNamesOnDirectivesRule(context) { + var directiveArgs = Object.create(null); + var schema = context.getSchema(); + var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; + + for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { + var directive = definedDirectives[_i2]; + directiveArgs[directive.name] = directive.args.map(function (arg) { + return arg.name; + }); + } + + var astDefinitions = context.getDocument().definitions; + + for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { + var def = astDefinitions[_i4]; + + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; + directiveArgs[def.name.value] = argsNodes.map(function (arg) { + return arg.name.value; + }); + } + } + + return { + Directive: function Directive(directiveNode) { + var directiveName = directiveNode.name.value; + var knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) { + var argNode = _directiveNode$argume2[_i6]; + var argName = argNode.name.value; + + if (knownArgs.indexOf(argName) === -1) { + var suggestions = (0, _suggestionList.default)(argName, knownArgs); + context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on directive \"@").concat(directiveName, "\".") + (0, _didYouMean.default)(suggestions), argNode)); + } + } + } + + return false; + } + }; +} + + +/***/ }), + +/***/ 85303: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.KnownDirectivesRule = KnownDirectivesRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _directiveLocation = __nccwpck_require__(81205); + +var _directives = __nccwpck_require__(83614); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + */ +function KnownDirectivesRule(context) { + var locationsMap = Object.create(null); + var schema = context.getSchema(); + var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; + + for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { + var directive = definedDirectives[_i2]; + locationsMap[directive.name] = directive.locations; + } + + var astDefinitions = context.getDocument().definitions; + + for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { + var def = astDefinitions[_i4]; + + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map(function (name) { + return name.value; + }); + } + } + + return { + Directive: function Directive(node, _key, _parent, _path, ancestors) { + var name = node.name.value; + var locations = locationsMap[name]; + + if (!locations) { + context.reportError(new _GraphQLError.GraphQLError("Unknown directive \"@".concat(name, "\"."), node)); + return; + } + + var candidateLocation = getDirectiveLocationForASTPath(ancestors); + + if (candidateLocation && locations.indexOf(candidateLocation) === -1) { + context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(name, "\" may not be used on ").concat(candidateLocation, "."), node)); + } + } + }; +} + +function getDirectiveLocationForASTPath(ancestors) { + var appliedTo = ancestors[ancestors.length - 1]; + !Array.isArray(appliedTo) || (0, _invariant.default)(0); + + switch (appliedTo.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + + case _kinds.Kind.FIELD: + return _directiveLocation.DirectiveLocation.FIELD; + + case _kinds.Kind.FRAGMENT_SPREAD: + return _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD; + + case _kinds.Kind.INLINE_FRAGMENT: + return _directiveLocation.DirectiveLocation.INLINE_FRAGMENT; + + case _kinds.Kind.FRAGMENT_DEFINITION: + return _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION; + + case _kinds.Kind.VARIABLE_DEFINITION: + return _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION; + + case _kinds.Kind.SCHEMA_DEFINITION: + case _kinds.Kind.SCHEMA_EXTENSION: + return _directiveLocation.DirectiveLocation.SCHEMA; + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.SCALAR; + + case _kinds.Kind.OBJECT_TYPE_DEFINITION: + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.OBJECT; + + case _kinds.Kind.FIELD_DEFINITION: + return _directiveLocation.DirectiveLocation.FIELD_DEFINITION; + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INTERFACE; + + case _kinds.Kind.UNION_TYPE_DEFINITION: + case _kinds.Kind.UNION_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.UNION; + + case _kinds.Kind.ENUM_TYPE_DEFINITION: + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.ENUM; + + case _kinds.Kind.ENUM_VALUE_DEFINITION: + return _directiveLocation.DirectiveLocation.ENUM_VALUE; + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INPUT_OBJECT; + + case _kinds.Kind.INPUT_VALUE_DEFINITION: + { + var parentNode = ancestors[ancestors.length - 3]; + return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; + } + } +} + +function getDirectiveLocationForOperation(operation) { + switch (operation) { + case 'query': + return _directiveLocation.DirectiveLocation.QUERY; + + case 'mutation': + return _directiveLocation.DirectiveLocation.MUTATION; + + case 'subscription': + return _directiveLocation.DirectiveLocation.SUBSCRIPTION; + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected operation: ' + (0, _inspect.default)(operation)); +} + + +/***/ }), + +/***/ 15166: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.KnownFragmentNamesRule = KnownFragmentNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + */ +function KnownFragmentNamesRule(context) { + return { + FragmentSpread: function FragmentSpread(node) { + var fragmentName = node.name.value; + var fragment = context.getFragment(fragmentName); + + if (!fragment) { + context.reportError(new _GraphQLError.GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name)); + } + } + }; +} + + +/***/ }), + +/***/ 42509: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.KnownTypeNamesRule = KnownTypeNamesRule; + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _predicates = __nccwpck_require__(20535); + +var _scalars = __nccwpck_require__(93145); + +var _introspection = __nccwpck_require__(28344); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + */ +function KnownTypeNamesRule(context) { + var schema = context.getSchema(); + var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + var definedTypes = Object.create(null); + + for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { + var def = _context$getDocument$2[_i2]; + + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = true; + } + } + + var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes)); + return { + NamedType: function NamedType(node, _1, parent, _2, ancestors) { + var typeName = node.name.value; + + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + var _ancestors$; + + var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; + var isSDL = definitionNode != null && isSDLNode(definitionNode); + + if (isSDL && isStandardTypeName(typeName)) { + return; + } + + var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); + context.reportError(new _GraphQLError.GraphQLError("Unknown type \"".concat(typeName, "\".") + (0, _didYouMean.default)(suggestedTypes), node)); + } + } + }; +} + +var standardTypeNames = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes).map(function (type) { + return type.name; +}); + +function isStandardTypeName(typeName) { + return standardTypeNames.indexOf(typeName) !== -1; +} + +function isSDLNode(value) { + return !Array.isArray(value) && ((0, _predicates.isTypeSystemDefinitionNode)(value) || (0, _predicates.isTypeSystemExtensionNode)(value)); +} + + +/***/ }), + +/***/ 45726: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + */ +function LoneAnonymousOperationRule(context) { + var operationCount = 0; + return { + Document: function Document(node) { + operationCount = node.definitions.filter(function (definition) { + return definition.kind === _kinds.Kind.OPERATION_DEFINITION; + }).length; + }, + OperationDefinition: function OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError(new _GraphQLError.GraphQLError('This anonymous operation must be the only defined operation.', node)); + } + } + }; +} + + +/***/ }), + +/***/ 48307: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.LoneSchemaDefinitionRule = LoneSchemaDefinitionRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +function LoneSchemaDefinitionRule(context) { + var _ref, _ref2, _oldSchema$astNode; + + var oldSchema = context.getSchema(); + var alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); + var schemaDefinitionsCount = 0; + return { + SchemaDefinition: function SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError(new _GraphQLError.GraphQLError('Cannot define a new schema within a schema extension.', node)); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError(new _GraphQLError.GraphQLError('Must provide only one schema definition.', node)); + } + + ++schemaDefinitionsCount; + } + }; +} + + +/***/ }), + +/***/ 62564: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoFragmentCyclesRule = NoFragmentCyclesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +function NoFragmentCyclesRule(context) { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + var visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + var spreadPath = []; // Position in the spread path + + var spreadPathIndexByName = Object.create(null); + return { + OperationDefinition: function OperationDefinition() { + return false; + }, + FragmentDefinition: function FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + } + }; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(fragment) { + if (visitedFrags[fragment.name.value]) { + return; + } + + var fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + var spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (var _i2 = 0; _i2 < spreadNodes.length; _i2++) { + var spreadNode = spreadNodes[_i2]; + var spreadName = spreadNode.name.value; + var cycleIndex = spreadPathIndexByName[spreadName]; + spreadPath.push(spreadNode); + + if (cycleIndex === undefined) { + var spreadFragment = context.getFragment(spreadName); + + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + var cyclePath = spreadPath.slice(cycleIndex); + var viaPath = cyclePath.slice(0, -1).map(function (s) { + return '"' + s.name.value + '"'; + }).join(', '); + context.reportError(new _GraphQLError.GraphQLError("Cannot spread fragment \"".concat(spreadName, "\" within itself") + (viaPath !== '' ? " via ".concat(viaPath, ".") : '.'), cyclePath)); + } + + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} + + +/***/ }), + +/***/ 61671: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoUndefinedVariablesRule = NoUndefinedVariablesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + */ +function NoUndefinedVariablesRule(context) { + var variableNameDefined = Object.create(null); + return { + OperationDefinition: { + enter: function enter() { + variableNameDefined = Object.create(null); + }, + leave: function leave(operation) { + var usages = context.getRecursiveVariableUsages(operation); + + for (var _i2 = 0; _i2 < usages.length; _i2++) { + var _ref2 = usages[_i2]; + var node = _ref2.node; + var varName = node.name.value; + + if (variableNameDefined[varName] !== true) { + context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(varName, "\" is not defined by operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(varName, "\" is not defined."), [node, operation])); + } + } + } + }, + VariableDefinition: function VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + } + }; +} + + +/***/ }), + +/***/ 192: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoUnusedFragmentsRule = NoUnusedFragmentsRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + */ +function NoUnusedFragmentsRule(context) { + var operationDefs = []; + var fragmentDefs = []; + return { + OperationDefinition: function OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + FragmentDefinition: function FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + Document: { + leave: function leave() { + var fragmentNameUsed = Object.create(null); + + for (var _i2 = 0; _i2 < operationDefs.length; _i2++) { + var operation = operationDefs[_i2]; + + for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) { + var fragment = _context$getRecursive2[_i4]; + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) { + var fragmentDef = fragmentDefs[_i6]; + var fragName = fragmentDef.name.value; + + if (fragmentNameUsed[fragName] !== true) { + context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" is never used."), fragmentDef)); + } + } + } + } + }; +} + + +/***/ }), + +/***/ 40242: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoUnusedVariablesRule = NoUnusedVariablesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + */ +function NoUnusedVariablesRule(context) { + var variableDefs = []; + return { + OperationDefinition: { + enter: function enter() { + variableDefs = []; + }, + leave: function leave(operation) { + var variableNameUsed = Object.create(null); + var usages = context.getRecursiveVariableUsages(operation); + + for (var _i2 = 0; _i2 < usages.length; _i2++) { + var _ref2 = usages[_i2]; + var node = _ref2.node; + variableNameUsed[node.name.value] = true; + } + + for (var _i4 = 0, _variableDefs2 = variableDefs; _i4 < _variableDefs2.length; _i4++) { + var variableDef = _variableDefs2[_i4]; + var variableName = variableDef.variable.name.value; + + if (variableNameUsed[variableName] !== true) { + context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(variableName, "\" is never used in operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(variableName, "\" is never used."), variableDef)); + } + } + } + }, + VariableDefinition: function VariableDefinition(def) { + variableDefs.push(def); + } + }; +} + + +/***/ }), + +/***/ 23577: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.OverlappingFieldsCanBeMergedRule = OverlappingFieldsCanBeMergedRule; + +var _find = _interopRequireDefault(__nccwpck_require__(57649)); + +var _objectEntries3 = _interopRequireDefault(__nccwpck_require__(86422)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _printer = __nccwpck_require__(68203); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function reasonMessage(reason) { + if (Array.isArray(reason)) { + return reason.map(function (_ref) { + var responseName = _ref[0], + subReason = _ref[1]; + return "subfields \"".concat(responseName, "\" conflict because ") + reasonMessage(subReason); + }).join(' and '); + } + + return reason; +} +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + */ + + +function OverlappingFieldsCanBeMergedRule(context) { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + var comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + + var cachedFieldsAndFragmentNames = new Map(); + return { + SelectionSet: function SelectionSet(selectionSet) { + var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet); + + for (var _i2 = 0; _i2 < conflicts.length; _i2++) { + var _ref3 = conflicts[_i2]; + var _ref2$ = _ref3[0]; + var responseName = _ref2$[0]; + var reason = _ref2$[1]; + var fields1 = _ref3[1]; + var fields2 = _ref3[2]; + var reasonMsg = reasonMessage(reason); + context.reportError(new _GraphQLError.GraphQLError("Fields \"".concat(responseName, "\" conflict because ").concat(reasonMsg, ". Use different aliases on the fields to fetch both if this was intentional."), fields1.concat(fields2))); + } + } + }; +} + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { + var conflicts = []; + + var _getFieldsAndFragment = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet), + fieldMap = _getFieldsAndFragment[0], + fragmentNames = _getFieldsAndFragment[1]; // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + + + collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (var i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + + for (var j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); + } + } + } + + return conflicts; +} // Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. + + +function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { + var fragment = context.getFragment(fragmentName); + + if (!fragment) { + return; + } + + var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment), + fieldMap2 = _getReferencedFieldsA[0], + fragmentNames2 = _getReferencedFieldsA[1]; // Do not compare a fragment's fieldMap to itself. + + + if (fieldMap === fieldMap2) { + return; + } // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + + for (var i = 0; i < fragmentNames2.length; i++) { + collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); + } +} // Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. + + +function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } // Memoize so two fragments are not compared for conflicts more than once. + + + if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { + return; + } + + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + var fragment1 = context.getFragment(fragmentName1); + var fragment2 = context.getFragment(fragmentName2); + + if (!fragment1 || !fragment2) { + return; + } + + var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), + fieldMap1 = _getReferencedFieldsA2[0], + fragmentNames1 = _getReferencedFieldsA2[1]; + + var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2), + fieldMap2 = _getReferencedFieldsA3[0], + fragmentNames2 = _getReferencedFieldsA3[1]; // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + + for (var j = 0; j < fragmentNames2.length; j++) { + collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]); + } // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + + + for (var i = 0; i < fragmentNames1.length; i++) { + collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[i], fragmentName2); + } +} // Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. + + +function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { + var conflicts = []; + + var _getFieldsAndFragment2 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1), + fieldMap1 = _getFieldsAndFragment2[0], + fragmentNames1 = _getFieldsAndFragment2[1]; + + var _getFieldsAndFragment3 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2), + fieldMap2 = _getFieldsAndFragment3[0], + fragmentNames2 = _getFieldsAndFragment3[1]; // (H) First, collect all conflicts between these two collections of field. + + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + + if (fragmentNames2.length !== 0) { + for (var j = 0; j < fragmentNames2.length; j++) { + collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentNames2[j]); + } + } // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + + + if (fragmentNames1.length !== 0) { + for (var i = 0; i < fragmentNames1.length; i++) { + collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentNames1[i]); + } + } // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + + + for (var _i3 = 0; _i3 < fragmentNames1.length; _i3++) { + for (var _j = 0; _j < fragmentNames2.length; _j++) { + collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[_i3], fragmentNames2[_j]); + } + } + + return conflicts; +} // Collect all Conflicts "within" one collection of fields. + + +function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (var _i5 = 0, _objectEntries2 = (0, _objectEntries3.default)(fieldMap); _i5 < _objectEntries2.length; _i5++) { + var _ref5 = _objectEntries2[_i5]; + var responseName = _ref5[0]; + var fields = _ref5[1]; + + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (var i = 0; i < fields.length; i++) { + for (var j = i + 1; j < fields.length; j++) { + var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, // within one collection is never mutually exclusive + responseName, fields[i], fields[j]); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. + + +function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (var _i7 = 0, _Object$keys2 = Object.keys(fieldMap1); _i7 < _Object$keys2.length; _i7++) { + var responseName = _Object$keys2[_i7]; + var fields2 = fieldMap2[responseName]; + + if (fields2) { + var fields1 = fieldMap1[responseName]; + + for (var i = 0; i < fields1.length; i++) { + for (var j = 0; j < fields2.length; j++) { + var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, fields1[i], fields2[j]); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. + + +function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { + var parentType1 = field1[0], + node1 = field1[1], + def1 = field1[2]; + var parentType2 = field2[0], + node2 = field2[1], + def2 = field2[2]; // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + + var areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && (0, _definition.isObjectType)(parentType1) && (0, _definition.isObjectType)(parentType2); + + if (!areMutuallyExclusive) { + var _node1$arguments, _node2$arguments; + + // Two aliases must refer to the same field. + var name1 = node1.name.value; + var name2 = node2.name.value; + + if (name1 !== name2) { + return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]]; + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + + var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments. + + if (!sameArguments(args1, args2)) { + return [[responseName, 'they have differing arguments'], [node1], [node2]]; + } + } // The return type for each field. + + + var type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; + var type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [[responseName, "they return conflicting types \"".concat((0, _inspect.default)(type1), "\" and \"").concat((0, _inspect.default)(type2), "\"")], [node1], [node2]]; + } // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + + + var selectionSet1 = node1.selectionSet; + var selectionSet2 = node2.selectionSet; + + if (selectionSet1 && selectionSet2) { + var conflicts = findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, (0, _definition.getNamedType)(type1), selectionSet1, (0, _definition.getNamedType)(type2), selectionSet2); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments(arguments1, arguments2) { + if (arguments1.length !== arguments2.length) { + return false; + } + + return arguments1.every(function (argument1) { + var argument2 = (0, _find.default)(arguments2, function (argument) { + return argument.name.value === argument1.name.value; + }); + + if (!argument2) { + return false; + } + + return sameValue(argument1.value, argument2.value); + }); +} + +function sameValue(value1, value2) { + return (0, _printer.print)(value1) === (0, _printer.print)(value2); +} // Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. + + +function doTypesConflict(type1, type2) { + if ((0, _definition.isListType)(type1)) { + return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; + } + + if ((0, _definition.isListType)(type2)) { + return true; + } + + if ((0, _definition.isNonNullType)(type1)) { + return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; + } + + if ((0, _definition.isNonNullType)(type2)) { + return true; + } + + if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) { + return type1 !== type2; + } + + return false; +} // Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. + + +function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { + var cached = cachedFieldsAndFragmentNames.get(selectionSet); + + if (!cached) { + var nodeAndDefs = Object.create(null); + var fragmentNames = Object.create(null); + + _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); + + cached = [nodeAndDefs, Object.keys(fragmentNames)]; + cachedFieldsAndFragmentNames.set(selectionSet, cached); + } + + return cached; +} // Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. + + +function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { + // Short-circuit building a type from the node if possible. + var cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + + if (cached) { + return cached; + } + + var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment.typeCondition); + return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment.selectionSet); +} + +function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { + for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) { + var selection = _selectionSet$selecti2[_i9]; + + switch (selection.kind) { + case _kinds.Kind.FIELD: + { + var fieldName = selection.name.value; + var fieldDef = void 0; + + if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { + fieldDef = parentType.getFields()[fieldName]; + } + + var responseName = selection.alias ? selection.alias.value : fieldName; + + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + + case _kinds.Kind.INLINE_FRAGMENT: + { + var typeCondition = selection.typeCondition; + var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) : parentType; + + _collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames); + + break; + } + } + } +} // Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. + + +function subfieldConflicts(conflicts, responseName, node1, node2) { + if (conflicts.length > 0) { + return [[responseName, conflicts.map(function (_ref6) { + var reason = _ref6[0]; + return reason; + })], conflicts.reduce(function (allFields, _ref7) { + var fields1 = _ref7[1]; + return allFields.concat(fields1); + }, [node1]), conflicts.reduce(function (allFields, _ref8) { + var fields2 = _ref8[2]; + return allFields.concat(fields2); + }, [node2])]; + } +} +/** + * A way to keep track of pairs of things when the ordering of the pair does + * not matter. We do this by maintaining a sort of double adjacency sets. + */ + + +var PairSet = /*#__PURE__*/function () { + function PairSet() { + this._data = Object.create(null); + } + + var _proto = PairSet.prototype; + + _proto.has = function has(a, b, areMutuallyExclusive) { + var first = this._data[a]; + var result = first && first[b]; + + if (result === undefined) { + return false; + } // areMutuallyExclusive being false is a superset of being true, + // hence if we want to know if this PairSet "has" these two with no + // exclusivity, we have to ensure it was added as such. + + + if (areMutuallyExclusive === false) { + return result === false; + } + + return true; + }; + + _proto.add = function add(a, b, areMutuallyExclusive) { + this._pairSetAdd(a, b, areMutuallyExclusive); + + this._pairSetAdd(b, a, areMutuallyExclusive); + }; + + _proto._pairSetAdd = function _pairSetAdd(a, b, areMutuallyExclusive) { + var map = this._data[a]; + + if (!map) { + map = Object.create(null); + this._data[a] = map; + } + + map[b] = areMutuallyExclusive; + }; + + return PairSet; +}(); + + +/***/ }), + +/***/ 62450: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.PossibleFragmentSpreadsRule = PossibleFragmentSpreadsRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +var _typeComparators = __nccwpck_require__(10333); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +function PossibleFragmentSpreadsRule(context) { + return { + InlineFragment: function InlineFragment(node) { + var fragType = context.getType(); + var parentType = context.getParentType(); + + if ((0, _definition.isCompositeType)(fragType) && (0, _definition.isCompositeType)(parentType) && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { + var parentTypeStr = (0, _inspect.default)(parentType); + var fragTypeStr = (0, _inspect.default)(fragType); + context.reportError(new _GraphQLError.GraphQLError("Fragment cannot be spread here as objects of type \"".concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); + } + }, + FragmentSpread: function FragmentSpread(node) { + var fragName = node.name.value; + var fragType = getFragmentType(context, fragName); + var parentType = context.getParentType(); + + if (fragType && parentType && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { + var parentTypeStr = (0, _inspect.default)(parentType); + var fragTypeStr = (0, _inspect.default)(fragType); + context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" cannot be spread here as objects of type \"").concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); + } + } + }; +} + +function getFragmentType(context, name) { + var frag = context.getFragment(name); + + if (frag) { + var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), frag.typeCondition); + + if ((0, _definition.isCompositeType)(type)) { + return type; + } + } +} + + +/***/ }), + +/***/ 70075: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.PossibleTypeExtensionsRule = PossibleTypeExtensionsRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _predicates = __nccwpck_require__(20535); + +var _definition = __nccwpck_require__(5821); + +var _defKindToExtKind; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +function PossibleTypeExtensionsRule(context) { + var schema = context.getSchema(); + var definedTypes = Object.create(null); + + for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { + var def = _context$getDocument$2[_i2]; + + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension + }; + + function checkExtension(node) { + var typeName = node.name.value; + var defNode = definedTypes[typeName]; + var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); + var expectedKind; + + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + var kindStr = extensionKindToTypeName(node.kind); + context.reportError(new _GraphQLError.GraphQLError("Cannot extend non-".concat(kindStr, " type \"").concat(typeName, "\"."), defNode ? [defNode, node] : node)); + } + } else { + var allTypeNames = Object.keys(definedTypes); + + if (schema) { + allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); + } + + var suggestedTypes = (0, _suggestionList.default)(typeName, allTypeNames); + context.reportError(new _GraphQLError.GraphQLError("Cannot extend type \"".concat(typeName, "\" because it is not defined.") + (0, _didYouMean.default)(suggestedTypes), node.name)); + } + } +} + +var defKindToExtKind = (_defKindToExtKind = {}, _defineProperty(_defKindToExtKind, _kinds.Kind.SCALAR_TYPE_DEFINITION, _kinds.Kind.SCALAR_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.OBJECT_TYPE_DEFINITION, _kinds.Kind.OBJECT_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INTERFACE_TYPE_DEFINITION, _kinds.Kind.INTERFACE_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.UNION_TYPE_DEFINITION, _kinds.Kind.UNION_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.ENUM_TYPE_DEFINITION, _kinds.Kind.ENUM_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind); + +function typeToExtKind(type) { + if ((0, _definition.isScalarType)(type)) { + return _kinds.Kind.SCALAR_TYPE_EXTENSION; + } + + if ((0, _definition.isObjectType)(type)) { + return _kinds.Kind.OBJECT_TYPE_EXTENSION; + } + + if ((0, _definition.isInterfaceType)(type)) { + return _kinds.Kind.INTERFACE_TYPE_EXTENSION; + } + + if ((0, _definition.isUnionType)(type)) { + return _kinds.Kind.UNION_TYPE_EXTENSION; + } + + if ((0, _definition.isEnumType)(type)) { + return _kinds.Kind.ENUM_TYPE_EXTENSION; + } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') + + + if ((0, _definition.isInputObjectType)(type)) { + return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); +} + +function extensionKindToTypeName(kind) { + switch (kind) { + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + + case _kinds.Kind.UNION_TYPE_EXTENSION: + return 'union'; + + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + } // istanbul ignore next (Not reachable. All possible types have been considered) + + + false || (0, _invariant.default)(0, 'Unexpected kind: ' + (0, _inspect.default)(kind)); +} + + +/***/ }), + +/***/ 57669: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; +exports.ProvidedRequiredArgumentsOnDirectivesRule = ProvidedRequiredArgumentsOnDirectivesRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _printer = __nccwpck_require__(68203); + +var _directives = __nccwpck_require__(83614); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +function ProvidedRequiredArgumentsRule(context) { + return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave: function leave(fieldNode) { + var _fieldNode$arguments; + + var fieldDef = context.getFieldDef(); + + if (!fieldDef) { + return false; + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + + var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : []; + var argNodeMap = (0, _keyMap.default)(argNodes, function (arg) { + return arg.name.value; + }); + + for (var _i2 = 0, _fieldDef$args2 = fieldDef.args; _i2 < _fieldDef$args2.length; _i2++) { + var argDef = _fieldDef$args2[_i2]; + var argNode = argNodeMap[argDef.name]; + + if (!argNode && (0, _definition.isRequiredArgument)(argDef)) { + var argTypeStr = (0, _inspect.default)(argDef.type); + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), fieldNode)); + } + } + } + } + }); +} +/** + * @internal + */ + + +function ProvidedRequiredArgumentsOnDirectivesRule(context) { + var requiredArgsMap = Object.create(null); + var schema = context.getSchema(); + var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; + + for (var _i4 = 0; _i4 < definedDirectives.length; _i4++) { + var directive = definedDirectives[_i4]; + requiredArgsMap[directive.name] = (0, _keyMap.default)(directive.args.filter(_definition.isRequiredArgument), function (arg) { + return arg.name; + }); + } + + var astDefinitions = context.getDocument().definitions; + + for (var _i6 = 0; _i6 < astDefinitions.length; _i6++) { + var def = astDefinitions[_i6]; + + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; + requiredArgsMap[def.name.value] = (0, _keyMap.default)(argNodes.filter(isRequiredArgumentNode), function (arg) { + return arg.name.value; + }); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave: function leave(directiveNode) { + var directiveName = directiveNode.name.value; + var requiredArgs = requiredArgsMap[directiveName]; + + if (requiredArgs) { + var _directiveNode$argume; + + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; + + var argNodeMap = (0, _keyMap.default)(_argNodes, function (arg) { + return arg.name.value; + }); + + for (var _i8 = 0, _Object$keys2 = Object.keys(requiredArgs); _i8 < _Object$keys2.length; _i8++) { + var argName = _Object$keys2[_i8]; + + if (!argNodeMap[argName]) { + var argType = requiredArgs[argName].type; + var argTypeStr = (0, _definition.isType)(argType) ? (0, _inspect.default)(argType) : (0, _printer.print)(argType); + context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" argument \"").concat(argName, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), directiveNode)); + } + } + } + } + } + }; +} + +function isRequiredArgumentNode(arg) { + return arg.type.kind === _kinds.Kind.NON_NULL_TYPE && arg.defaultValue == null; +} + + +/***/ }), + +/***/ 16830: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ScalarLeafsRule = ScalarLeafsRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +function ScalarLeafsRule(context) { + return { + Field: function Field(node) { + var type = context.getType(); + var selectionSet = node.selectionSet; + + if (type) { + if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type))) { + if (selectionSet) { + var fieldName = node.name.value; + var typeStr = (0, _inspect.default)(type); + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldName, "\" must not have a selection since type \"").concat(typeStr, "\" has no subfields."), selectionSet)); + } + } else if (!selectionSet) { + var _fieldName = node.name.value; + + var _typeStr = (0, _inspect.default)(type); + + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(_fieldName, "\" of type \"").concat(_typeStr, "\" must have a selection of subfields. Did you mean \"").concat(_fieldName, " { ... }\"?"), node)); + } + } + } + }; +} + + +/***/ }), + +/***/ 4365: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Subscriptions must only include one field. + * + * A GraphQL subscription is valid only if it contains a single root field. + */ +function SingleFieldSubscriptionsRule(context) { + return { + OperationDefinition: function OperationDefinition(node) { + if (node.operation === 'subscription') { + if (node.selectionSet.selections.length !== 1) { + context.reportError(new _GraphQLError.GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); + } + } + } + }; +} + + +/***/ }), + +/***/ 45799: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueArgumentNamesRule = UniqueArgumentNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + */ +function UniqueArgumentNamesRule(context) { + var knownArgNames = Object.create(null); + return { + Field: function Field() { + knownArgNames = Object.create(null); + }, + Directive: function Directive() { + knownArgNames = Object.create(null); + }, + Argument: function Argument(node) { + var argName = node.name.value; + + if (knownArgNames[argName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one argument named \"".concat(argName, "\"."), [knownArgNames[argName], node.name])); + } else { + knownArgNames[argName] = node.name; + } + + return false; + } + }; +} + + +/***/ }), + +/***/ 17074: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueDirectiveNamesRule = UniqueDirectiveNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +function UniqueDirectiveNamesRule(context) { + var knownDirectiveNames = Object.create(null); + var schema = context.getSchema(); + return { + DirectiveDefinition: function DirectiveDefinition(node) { + var directiveName = node.name.value; + + if (schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName)) { + context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" already exists in the schema. It cannot be redefined."), node.name)); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one directive named \"@".concat(directiveName, "\"."), [knownDirectiveNames[directiveName], node.name])); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + } + }; +} + + +/***/ }), + +/***/ 61944: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueDirectivesPerLocationRule = UniqueDirectivesPerLocationRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _predicates = __nccwpck_require__(20535); + +var _directives = __nccwpck_require__(83614); + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + */ +function UniqueDirectivesPerLocationRule(context) { + var uniqueDirectiveMap = Object.create(null); + var schema = context.getSchema(); + var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; + + for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { + var directive = definedDirectives[_i2]; + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + var astDefinitions = context.getDocument().definitions; + + for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { + var def = astDefinitions[_i4]; + + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + var schemaDirectives = Object.create(null); + var typeDirectivesMap = Object.create(null); + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter: function enter(node) { + if (node.directives == null) { + return; + } + + var seenDirectives; + + if (node.kind === _kinds.Kind.SCHEMA_DEFINITION || node.kind === _kinds.Kind.SCHEMA_EXTENSION) { + seenDirectives = schemaDirectives; + } else if ((0, _predicates.isTypeDefinitionNode)(node) || (0, _predicates.isTypeExtensionNode)(node)) { + var typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (var _i6 = 0, _node$directives2 = node.directives; _i6 < _node$directives2.length; _i6++) { + var _directive = _node$directives2[_i6]; + var directiveName = _directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError(new _GraphQLError.GraphQLError("The directive \"@".concat(directiveName, "\" can only be used once at this location."), [seenDirectives[directiveName], _directive])); + } else { + seenDirectives[directiveName] = _directive; + } + } + } + } + }; +} + + +/***/ }), + +/***/ 44437: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueEnumValueNamesRule = UniqueEnumValueNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +function UniqueEnumValueNamesRule(context) { + var schema = context.getSchema(); + var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + var knownValueNames = Object.create(null); + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness + }; + + function checkValueUniqueness(node) { + var _node$values; + + var typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + + var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; + var valueNames = knownValueNames[typeName]; + + for (var _i2 = 0; _i2 < valueNodes.length; _i2++) { + var valueDef = valueNodes[_i2]; + var valueName = valueDef.name.value; + var existingType = existingTypeMap[typeName]; + + if ((0, _definition.isEnumType)(existingType) && existingType.getValue(valueName)) { + context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" already exists in the schema. It cannot also be defined in this type extension."), valueDef.name)); + } else if (valueNames[valueName]) { + context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" can only be defined once."), [valueNames[valueName], valueDef.name])); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} + + +/***/ }), + +/***/ 9502: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueFieldDefinitionNamesRule = UniqueFieldDefinitionNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +function UniqueFieldDefinitionNamesRule(context) { + var schema = context.getSchema(); + var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + var knownFieldNames = Object.create(null); + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness + }; + + function checkFieldUniqueness(node) { + var _node$fields; + + var typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + + + var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; + var fieldNames = knownFieldNames[typeName]; + + for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) { + var fieldDef = fieldNodes[_i2]; + var fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" already exists in the schema. It cannot also be defined in this type extension."), fieldDef.name)); + } else if (fieldNames[fieldName]) { + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" can only be defined once."), [fieldNames[fieldName], fieldDef.name])); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type, fieldName) { + if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type) || (0, _definition.isInputObjectType)(type)) { + return type.getFields()[fieldName] != null; + } + + return false; +} + + +/***/ }), + +/***/ 79402: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueFragmentNamesRule = UniqueFragmentNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + */ +function UniqueFragmentNamesRule(context) { + var knownFragmentNames = Object.create(null); + return { + OperationDefinition: function OperationDefinition() { + return false; + }, + FragmentDefinition: function FragmentDefinition(node) { + var fragmentName = node.name.value; + + if (knownFragmentNames[fragmentName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one fragment named \"".concat(fragmentName, "\"."), [knownFragmentNames[fragmentName], node.name])); + } else { + knownFragmentNames[fragmentName] = node.name; + } + + return false; + } + }; +} + + +/***/ }), + +/***/ 83552: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + */ +function UniqueInputFieldNamesRule(context) { + var knownNameStack = []; + var knownNames = Object.create(null); + return { + ObjectValue: { + enter: function enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + leave: function leave() { + knownNames = knownNameStack.pop(); + } + }, + ObjectField: function ObjectField(node) { + var fieldName = node.name.value; + + if (knownNames[fieldName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one input field named \"".concat(fieldName, "\"."), [knownNames[fieldName], node.name])); + } else { + knownNames[fieldName] = node.name; + } + } + }; +} + + +/***/ }), + +/***/ 94865: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueOperationNamesRule = UniqueOperationNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + */ +function UniqueOperationNamesRule(context) { + var knownOperationNames = Object.create(null); + return { + OperationDefinition: function OperationDefinition(node) { + var operationName = node.name; + + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one operation named \"".concat(operationName.value, "\"."), [knownOperationNames[operationName.value], operationName])); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + + return false; + }, + FragmentDefinition: function FragmentDefinition() { + return false; + } + }; +} + + +/***/ }), + +/***/ 31492: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueOperationTypesRule = UniqueOperationTypesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +function UniqueOperationTypesRule(context) { + var schema = context.getSchema(); + var definedOperationTypes = Object.create(null); + var existingOperationTypes = schema ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType() + } : {}; + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes + }; + + function checkOperationTypes(node) { + var _node$operationTypes; + + // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') + var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; + + for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) { + var operationType = operationTypesNodes[_i2]; + var operation = operationType.operation; + var alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError(new _GraphQLError.GraphQLError("Type for ".concat(operation, " already defined in the schema. It cannot be redefined."), operationType)); + } else if (alreadyDefinedOperationType) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one ".concat(operation, " type in schema."), [alreadyDefinedOperationType, operationType])); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} + + +/***/ }), + +/***/ 24316: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueTypeNamesRule = UniqueTypeNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +function UniqueTypeNamesRule(context) { + var knownTypeNames = Object.create(null); + var schema = context.getSchema(); + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName + }; + + function checkTypeName(node) { + var typeName = node.name.value; + + if (schema === null || schema === void 0 ? void 0 : schema.getType(typeName)) { + context.reportError(new _GraphQLError.GraphQLError("Type \"".concat(typeName, "\" already exists in the schema. It cannot also be defined in this type definition."), node.name)); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one type named \"".concat(typeName, "\"."), [knownTypeNames[typeName], node.name])); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} + + +/***/ }), + +/***/ 65931: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UniqueVariableNamesRule = UniqueVariableNamesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +function UniqueVariableNamesRule(context) { + var knownVariableNames = Object.create(null); + return { + OperationDefinition: function OperationDefinition() { + knownVariableNames = Object.create(null); + }, + VariableDefinition: function VariableDefinition(node) { + var variableName = node.variable.name.value; + + if (knownVariableNames[variableName]) { + context.reportError(new _GraphQLError.GraphQLError("There can be only one variable named \"$".concat(variableName, "\"."), [knownVariableNames[variableName], node.variable.name])); + } else { + knownVariableNames[variableName] = node.variable.name; + } + } + }; +} + + +/***/ }), + +/***/ 39091: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; + +var _objectValues3 = _interopRequireDefault(__nccwpck_require__(30026)); + +var _keyMap = _interopRequireDefault(__nccwpck_require__(10711)); + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _didYouMean = _interopRequireDefault(__nccwpck_require__(42878)); + +var _suggestionList = _interopRequireDefault(__nccwpck_require__(57704)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _printer = __nccwpck_require__(68203); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + */ +function ValuesOfCorrectTypeRule(context) { + return { + ListValue: function ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + var type = (0, _definition.getNullableType)(context.getParentInputType()); + + if (!(0, _definition.isListType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + ObjectValue: function ObjectValue(node) { + var type = (0, _definition.getNamedType)(context.getInputType()); + + if (!(0, _definition.isInputObjectType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } // Ensure every required field exists. + + + var fieldNodeMap = (0, _keyMap.default)(node.fields, function (field) { + return field.name.value; + }); + + for (var _i2 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i2 < _objectValues2.length; _i2++) { + var fieldDef = _objectValues2[_i2]; + var fieldNode = fieldNodeMap[fieldDef.name]; + + if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { + var typeStr = (0, _inspect.default)(fieldDef.type); + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(type.name, ".").concat(fieldDef.name, "\" of required type \"").concat(typeStr, "\" was not provided."), node)); + } + } + }, + ObjectField: function ObjectField(node) { + var parentType = (0, _definition.getNamedType)(context.getParentInputType()); + var fieldType = context.getInputType(); + + if (!fieldType && (0, _definition.isInputObjectType)(parentType)) { + var suggestions = (0, _suggestionList.default)(node.name.value, Object.keys(parentType.getFields())); + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(node.name.value, "\" is not defined by type \"").concat(parentType.name, "\".") + (0, _didYouMean.default)(suggestions), node)); + } + }, + NullValue: function NullValue(node) { + var type = context.getInputType(); + + if ((0, _definition.isNonNullType)(type)) { + context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat((0, _inspect.default)(type), "\", found ").concat((0, _printer.print)(node), "."), node)); + } + }, + EnumValue: function EnumValue(node) { + return isValidValueNode(context, node); + }, + IntValue: function IntValue(node) { + return isValidValueNode(context, node); + }, + FloatValue: function FloatValue(node) { + return isValidValueNode(context, node); + }, + StringValue: function StringValue(node) { + return isValidValueNode(context, node); + }, + BooleanValue: function BooleanValue(node) { + return isValidValueNode(context, node); + } + }; +} +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ + + +function isValidValueNode(context, node) { + // Report any error at the full type expected by the location. + var locationType = context.getInputType(); + + if (!locationType) { + return; + } + + var type = (0, _definition.getNamedType)(locationType); + + if (!(0, _definition.isLeafType)(type)) { + var typeStr = (0, _inspect.default)(locationType); + context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); + return; + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + + + try { + var parseResult = type.parseLiteral(node, undefined + /* variables */ + ); + + if (parseResult === undefined) { + var _typeStr = (0, _inspect.default)(locationType); + + context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); + } + } catch (error) { + var _typeStr2 = (0, _inspect.default)(locationType); + + if (error instanceof _GraphQLError.GraphQLError) { + context.reportError(error); + } else { + context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr2, "\", found ").concat((0, _printer.print)(node), "; ") + error.message, node, undefined, undefined, undefined, error)); + } + } +} + + +/***/ }), + +/***/ 99506: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _printer = __nccwpck_require__(68203); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + */ +function VariablesAreInputTypesRule(context) { + return { + VariableDefinition: function VariableDefinition(node) { + var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.type); + + if (type && !(0, _definition.isInputType)(type)) { + var variableName = node.variable.name.value; + var typeName = (0, _printer.print)(node.type); + context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\"."), node.type)); + } + } + }; +} + + +/***/ }), + +/***/ 8815: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.VariablesInAllowedPositionRule = VariablesInAllowedPositionRule; + +var _inspect = _interopRequireDefault(__nccwpck_require__(10102)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _kinds = __nccwpck_require__(11927); + +var _definition = __nccwpck_require__(5821); + +var _typeFromAST = __nccwpck_require__(27664); + +var _typeComparators = __nccwpck_require__(10333); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Variables passed to field arguments conform to type + */ +function VariablesInAllowedPositionRule(context) { + var varDefMap = Object.create(null); + return { + OperationDefinition: { + enter: function enter() { + varDefMap = Object.create(null); + }, + leave: function leave(operation) { + var usages = context.getRecursiveVariableUsages(operation); + + for (var _i2 = 0; _i2 < usages.length; _i2++) { + var _ref2 = usages[_i2]; + var node = _ref2.node; + var type = _ref2.type; + var defaultValue = _ref2.defaultValue; + var varName = node.name.value; + var varDef = varDefMap[varName]; + + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + var schema = context.getSchema(); + var varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type); + + if (varType && !allowedVariableUsage(schema, varType, varDef.defaultValue, type, defaultValue)) { + var varTypeStr = (0, _inspect.default)(varType); + var typeStr = (0, _inspect.default)(type); + context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of type \"").concat(varTypeStr, "\" used in position expecting type \"").concat(typeStr, "\"."), [varDef, node])); + } + } + } + } + }, + VariableDefinition: function VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + } + }; +} +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ + + +function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { + if ((0, _definition.isNonNullType)(locationType) && !(0, _definition.isNonNullType)(varType)) { + var hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; + var hasLocationDefaultValue = locationDefaultValue !== undefined; + + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + + var nullableLocationType = locationType.ofType; + return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, nullableLocationType); + } + + return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, locationType); +} + + +/***/ }), + +/***/ 33915: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoDeprecatedCustomRule = NoDeprecatedCustomRule; + +var _invariant = _interopRequireDefault(__nccwpck_require__(28847)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +function NoDeprecatedCustomRule(context) { + return { + Field: function Field(node) { + var fieldDef = context.getFieldDef(); + var deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; + + if (fieldDef && deprecationReason != null) { + var parentType = context.getParentType(); + parentType != null || (0, _invariant.default)(0); + context.reportError(new _GraphQLError.GraphQLError("The field ".concat(parentType.name, ".").concat(fieldDef.name, " is deprecated. ").concat(deprecationReason), node)); + } + }, + Argument: function Argument(node) { + var argDef = context.getArgument(); + var deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; + + if (argDef && deprecationReason != null) { + var directiveDef = context.getDirective(); + + if (directiveDef != null) { + context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); + } else { + var parentType = context.getParentType(); + var fieldDef = context.getFieldDef(); + parentType != null && fieldDef != null || (0, _invariant.default)(0); + context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(parentType.name, ".").concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); + } + } + }, + ObjectField: function ObjectField(node) { + var inputObjectDef = (0, _definition.getNamedType)(context.getParentInputType()); + + if ((0, _definition.isInputObjectType)(inputObjectDef)) { + var inputFieldDef = inputObjectDef.getFields()[node.name.value]; // flowlint-next-line unnecessary-optional-chain:off + + var deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; + + if (deprecationReason != null) { + context.reportError(new _GraphQLError.GraphQLError("The input field ".concat(inputObjectDef.name, ".").concat(inputFieldDef.name, " is deprecated. ").concat(deprecationReason), node)); + } + } + }, + EnumValue: function EnumValue(node) { + var enumValueDef = context.getEnumValue(); + var deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; + + if (enumValueDef && deprecationReason != null) { + var enumTypeDef = (0, _definition.getNamedType)(context.getInputType()); + enumTypeDef != null || (0, _invariant.default)(0); + context.reportError(new _GraphQLError.GraphQLError("The enum value \"".concat(enumTypeDef.name, ".").concat(enumValueDef.name, "\" is deprecated. ").concat(deprecationReason), node)); + } + } + }; +} + + +/***/ }), + +/***/ 39478: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.NoSchemaIntrospectionCustomRule = NoSchemaIntrospectionCustomRule; + +var _GraphQLError = __nccwpck_require__(4797); + +var _definition = __nccwpck_require__(5821); + +var _introspection = __nccwpck_require__(28344); + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +function NoSchemaIntrospectionCustomRule(context) { + return { + Field: function Field(node) { + var type = (0, _definition.getNamedType)(context.getType()); + + if (type && (0, _introspection.isIntrospectionType)(type)) { + context.reportError(new _GraphQLError.GraphQLError("GraphQL introspection has been disabled, but the requested query contained the field \"".concat(node.name.value, "\"."), node)); + } + } + }; +} + + +/***/ }), + +/***/ 84908: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.specifiedSDLRules = exports.specifiedRules = void 0; + +var _ExecutableDefinitionsRule = __nccwpck_require__(89199); + +var _UniqueOperationNamesRule = __nccwpck_require__(94865); + +var _LoneAnonymousOperationRule = __nccwpck_require__(45726); + +var _SingleFieldSubscriptionsRule = __nccwpck_require__(4365); + +var _KnownTypeNamesRule = __nccwpck_require__(42509); + +var _FragmentsOnCompositeTypesRule = __nccwpck_require__(60381); + +var _VariablesAreInputTypesRule = __nccwpck_require__(99506); + +var _ScalarLeafsRule = __nccwpck_require__(16830); + +var _FieldsOnCorrectTypeRule = __nccwpck_require__(63016); + +var _UniqueFragmentNamesRule = __nccwpck_require__(79402); + +var _KnownFragmentNamesRule = __nccwpck_require__(15166); + +var _NoUnusedFragmentsRule = __nccwpck_require__(192); + +var _PossibleFragmentSpreadsRule = __nccwpck_require__(62450); + +var _NoFragmentCyclesRule = __nccwpck_require__(62564); + +var _UniqueVariableNamesRule = __nccwpck_require__(65931); + +var _NoUndefinedVariablesRule = __nccwpck_require__(61671); + +var _NoUnusedVariablesRule = __nccwpck_require__(40242); + +var _KnownDirectivesRule = __nccwpck_require__(85303); + +var _UniqueDirectivesPerLocationRule = __nccwpck_require__(61944); + +var _KnownArgumentNamesRule = __nccwpck_require__(67147); + +var _UniqueArgumentNamesRule = __nccwpck_require__(45799); + +var _ValuesOfCorrectTypeRule = __nccwpck_require__(39091); + +var _ProvidedRequiredArgumentsRule = __nccwpck_require__(57669); + +var _VariablesInAllowedPositionRule = __nccwpck_require__(8815); + +var _OverlappingFieldsCanBeMergedRule = __nccwpck_require__(23577); + +var _UniqueInputFieldNamesRule = __nccwpck_require__(83552); + +var _LoneSchemaDefinitionRule = __nccwpck_require__(48307); + +var _UniqueOperationTypesRule = __nccwpck_require__(31492); + +var _UniqueTypeNamesRule = __nccwpck_require__(24316); + +var _UniqueEnumValueNamesRule = __nccwpck_require__(44437); + +var _UniqueFieldDefinitionNamesRule = __nccwpck_require__(9502); + +var _UniqueDirectiveNamesRule = __nccwpck_require__(17074); + +var _PossibleTypeExtensionsRule = __nccwpck_require__(70075); + +// Spec Section: "Executable Definitions" +// Spec Section: "Operation Name Uniqueness" +// Spec Section: "Lone Anonymous Operation" +// Spec Section: "Subscriptions with Single Root Field" +// Spec Section: "Fragment Spread Type Existence" +// Spec Section: "Fragments on Composite Types" +// Spec Section: "Variables are Input Types" +// Spec Section: "Leaf Field Selections" +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +// Spec Section: "Fragment Name Uniqueness" +// Spec Section: "Fragment spread target defined" +// Spec Section: "Fragments must be used" +// Spec Section: "Fragment spread is possible" +// Spec Section: "Fragments must not form cycles" +// Spec Section: "Variable Uniqueness" +// Spec Section: "All Variable Used Defined" +// Spec Section: "All Variables Used" +// Spec Section: "Directives Are Defined" +// Spec Section: "Directives Are Unique Per Location" +// Spec Section: "Argument Names" +// Spec Section: "Argument Uniqueness" +// Spec Section: "Value Type Correctness" +// Spec Section: "Argument Optionality" +// Spec Section: "All Variable Usages Are Allowed" +// Spec Section: "Field Selection Merging" +// Spec Section: "Input Object Field Uniqueness" +// SDL-specific validation rules + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +var specifiedRules = Object.freeze([_ExecutableDefinitionsRule.ExecutableDefinitionsRule, _UniqueOperationNamesRule.UniqueOperationNamesRule, _LoneAnonymousOperationRule.LoneAnonymousOperationRule, _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, _KnownTypeNamesRule.KnownTypeNamesRule, _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, _VariablesAreInputTypesRule.VariablesAreInputTypesRule, _ScalarLeafsRule.ScalarLeafsRule, _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, _UniqueFragmentNamesRule.UniqueFragmentNamesRule, _KnownFragmentNamesRule.KnownFragmentNamesRule, _NoUnusedFragmentsRule.NoUnusedFragmentsRule, _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, _NoFragmentCyclesRule.NoFragmentCyclesRule, _UniqueVariableNamesRule.UniqueVariableNamesRule, _NoUndefinedVariablesRule.NoUndefinedVariablesRule, _NoUnusedVariablesRule.NoUnusedVariablesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _KnownArgumentNamesRule.KnownArgumentNamesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule]); +/** + * @internal + */ + +exports.specifiedRules = specifiedRules; +var specifiedSDLRules = Object.freeze([_LoneSchemaDefinitionRule.LoneSchemaDefinitionRule, _UniqueOperationTypesRule.UniqueOperationTypesRule, _UniqueTypeNamesRule.UniqueTypeNamesRule, _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule, _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule, _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule, _KnownTypeNamesRule.KnownTypeNamesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule, _KnownArgumentNamesRule.KnownArgumentNamesOnDirectivesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsOnDirectivesRule]); +exports.specifiedSDLRules = specifiedSDLRules; + + +/***/ }), + +/***/ 14193: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.validate = validate; +exports.validateSDL = validateSDL; +exports.assertValidSDL = assertValidSDL; +exports.assertValidSDLExtension = assertValidSDLExtension; + +var _devAssert = _interopRequireDefault(__nccwpck_require__(46514)); + +var _GraphQLError = __nccwpck_require__(4797); + +var _visitor = __nccwpck_require__(5678); + +var _validate = __nccwpck_require__(22430); + +var _TypeInfo = __nccwpck_require__(76625); + +var _specifiedRules = __nccwpck_require__(84908); + +var _ValidationContext = __nccwpck_require__(28263); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +function validate(schema, documentAST) { + var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _specifiedRules.specifiedRules; + var typeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new _TypeInfo.TypeInfo(schema); + var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { + maxErrors: undefined + }; + documentAST || (0, _devAssert.default)(0, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); + var abortObj = Object.freeze({}); + var errors = []; + var context = new _ValidationContext.ValidationContext(schema, documentAST, typeInfo, function (error) { + if (options.maxErrors != null && errors.length >= options.maxErrors) { + errors.push(new _GraphQLError.GraphQLError('Too many validation errors, error limit reached. Validation aborted.')); + throw abortObj; + } + + errors.push(error); + }); // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + + var visitor = (0, _visitor.visitInParallel)(rules.map(function (rule) { + return rule(context); + })); // Visit the whole document with each instance of all provided rules. + + try { + (0, _visitor.visit)(documentAST, (0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor)); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + + return errors; +} +/** + * @internal + */ + + +function validateSDL(documentAST, schemaToExtend) { + var rules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _specifiedRules.specifiedSDLRules; + var errors = []; + var context = new _ValidationContext.SDLValidationContext(documentAST, schemaToExtend, function (error) { + errors.push(error); + }); + var visitors = rules.map(function (rule) { + return rule(context); + }); + (0, _visitor.visit)(documentAST, (0, _visitor.visitInParallel)(visitors)); + return errors; +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + + +function assertValidSDL(documentAST) { + var errors = validateSDL(documentAST); + + if (errors.length !== 0) { + throw new Error(errors.map(function (error) { + return error.message; + }).join('\n\n')); + } +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + + +function assertValidSDLExtension(documentAST, schema) { + var errors = validateSDL(documentAST, schema); + + if (errors.length !== 0) { + throw new Error(errors.map(function (error) { + return error.message; + }).join('\n\n')); + } +} + + +/***/ }), + +/***/ 81923: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.versionInfo = exports.version = void 0; + +/** + * Note: This file is autogenerated using "resources/gen-version.js" script and + * automatically updated by "npm version" command. + */ + +/** + * A string containing the version of the GraphQL.js library + */ +var version = '15.4.0'; +/** + * An object containing the components of the GraphQL.js version string + */ + +exports.version = version; +var versionInfo = Object.freeze({ + major: 15, + minor: 4, + patch: 0, + preReleaseTag: null +}); +exports.versionInfo = versionInfo; + + +/***/ }), + +/***/ 31621: +/***/ ((module) => { + +"use strict"; + + +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + + +/***/ }), + +/***/ 44124: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +try { + var util = __nccwpck_require__(31669); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __nccwpck_require__(8544); +} + + +/***/ }), + +/***/ 8544: +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 20893: +/***/ ((module) => { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ 20716: +/***/ ((module) => { + +"use strict"; + + +function Kareem() { + this._pres = new Map(); + this._posts = new Map(); +} + +Kareem.prototype.execPre = function(name, context, args, callback) { + if (arguments.length === 3) { + callback = args; + args = []; + } + var pres = get(this._pres, name, []); + var numPres = pres.length; + var numAsyncPres = pres.numAsync || 0; + var currentPre = 0; + var asyncPresLeft = numAsyncPres; + var done = false; + var $args = args; + + if (!numPres) { + return process.nextTick(function() { + callback(null); + }); + } + + var next = function() { + if (currentPre >= numPres) { + return; + } + var pre = pres[currentPre]; + + if (pre.isAsync) { + var args = [ + decorateNextFn(_next), + decorateNextFn(function(error) { + if (error) { + if (done) { + return; + } + done = true; + return callback(error); + } + if (--asyncPresLeft === 0 && currentPre >= numPres) { + return callback(null); + } + }) + ]; + + callMiddlewareFunction(pre.fn, context, args, args[0]); + } else if (pre.fn.length > 0) { + var args = [decorateNextFn(_next)]; + var _args = arguments.length >= 2 ? arguments : [null].concat($args); + for (var i = 1; i < _args.length; ++i) { + args.push(_args[i]); + } + + callMiddlewareFunction(pre.fn, context, args, args[0]); + } else { + let maybePromise = null; + try { + maybePromise = pre.fn.call(context); + } catch (err) { + if (err != null) { + return callback(err); + } + } + + if (isPromise(maybePromise)) { + maybePromise.then(() => _next(), err => _next(err)); + } else { + if (++currentPre >= numPres) { + if (asyncPresLeft > 0) { + // Leave parallel hooks to run + return; + } else { + return process.nextTick(function() { + callback(null); + }); + } + } + next(); + } + } + }; + + next.apply(null, [null].concat(args)); + + function _next(error) { + if (error) { + if (done) { + return; + } + done = true; + return callback(error); + } + + if (++currentPre >= numPres) { + if (asyncPresLeft > 0) { + // Leave parallel hooks to run + return; + } else { + return callback(null); + } + } + + next.apply(context, arguments); + } +}; + +Kareem.prototype.execPreSync = function(name, context, args) { + var pres = get(this._pres, name, []); + var numPres = pres.length; + + for (var i = 0; i < numPres; ++i) { + pres[i].fn.apply(context, args || []); + } +}; + +Kareem.prototype.execPost = function(name, context, args, options, callback) { + if (arguments.length < 5) { + callback = options; + options = null; + } + var posts = get(this._posts, name, []); + var numPosts = posts.length; + var currentPost = 0; + + var firstError = null; + if (options && options.error) { + firstError = options.error; + } + + if (!numPosts) { + return process.nextTick(function() { + callback.apply(null, [firstError].concat(args)); + }); + } + + var next = function() { + var post = posts[currentPost].fn; + var numArgs = 0; + var argLength = args.length; + var newArgs = []; + for (var i = 0; i < argLength; ++i) { + numArgs += args[i] && args[i]._kareemIgnore ? 0 : 1; + if (!args[i] || !args[i]._kareemIgnore) { + newArgs.push(args[i]); + } + } + + if (firstError) { + if (post.length === numArgs + 2) { + var _cb = decorateNextFn(function(error) { + if (error) { + firstError = error; + } + if (++currentPost >= numPosts) { + return callback.call(null, firstError); + } + next(); + }); + + callMiddlewareFunction(post, context, + [firstError].concat(newArgs).concat([_cb]), _cb); + } else { + if (++currentPost >= numPosts) { + return callback.call(null, firstError); + } + next(); + } + } else { + const _cb = decorateNextFn(function(error) { + if (error) { + firstError = error; + return next(); + } + + if (++currentPost >= numPosts) { + return callback.apply(null, [null].concat(args)); + } + + next(); + }); + + if (post.length === numArgs + 2) { + // Skip error handlers if no error + if (++currentPost >= numPosts) { + return callback.apply(null, [null].concat(args)); + } + return next(); + } + if (post.length === numArgs + 1) { + callMiddlewareFunction(post, context, newArgs.concat([_cb]), _cb); + } else { + let error; + let maybePromise; + try { + maybePromise = post.apply(context, newArgs); + } catch (err) { + error = err; + firstError = err; + } + + if (isPromise(maybePromise)) { + return maybePromise.then(() => _cb(), err => _cb(err)); + } + + if (++currentPost >= numPosts) { + return callback.apply(null, [error].concat(args)); + } + + next(error); + } + } + }; + + next(); +}; + +Kareem.prototype.execPostSync = function(name, context, args) { + const posts = get(this._posts, name, []); + const numPosts = posts.length; + + for (let i = 0; i < numPosts; ++i) { + posts[i].fn.apply(context, args || []); + } +}; + +Kareem.prototype.createWrapperSync = function(name, fn) { + var kareem = this; + return function syncWrapper() { + kareem.execPreSync(name, this, arguments); + + var toReturn = fn.apply(this, arguments); + + kareem.execPostSync(name, this, [toReturn]); + + return toReturn; + }; +} + +function _handleWrapError(instance, error, name, context, args, options, callback) { + if (options.useErrorHandlers) { + var _options = { error: error }; + return instance.execPost(name, context, args, _options, function(error) { + return typeof callback === 'function' && callback(error); + }); + } else { + return typeof callback === 'function' ? + callback(error) : + undefined; + } +} + +Kareem.prototype.wrap = function(name, fn, context, args, options) { + const lastArg = (args.length > 0 ? args[args.length - 1] : null); + const argsWithoutCb = typeof lastArg === 'function' ? + args.slice(0, args.length - 1) : + args; + const _this = this; + + options = options || {}; + const checkForPromise = options.checkForPromise; + + this.execPre(name, context, args, function(error) { + if (error) { + const numCallbackParams = options.numCallbackParams || 0; + const errorArgs = options.contextParameter ? [context] : []; + for (var i = errorArgs.length; i < numCallbackParams; ++i) { + errorArgs.push(null); + } + return _handleWrapError(_this, error, name, context, errorArgs, + options, lastArg); + } + + const end = (typeof lastArg === 'function' ? args.length - 1 : args.length); + const numParameters = fn.length; + const ret = fn.apply(context, args.slice(0, end).concat(_cb)); + + if (checkForPromise) { + if (ret != null && typeof ret.then === 'function') { + // Thenable, use it + return ret.then( + res => _cb(null, res), + err => _cb(err) + ); + } + + // If `fn()` doesn't have a callback argument and doesn't return a + // promise, assume it is sync + if (numParameters < end + 1) { + return _cb(null, ret); + } + } + + function _cb() { + const args = arguments; + const argsWithoutError = Array.prototype.slice.call(arguments, 1); + if (options.nullResultByDefault && argsWithoutError.length === 0) { + argsWithoutError.push(null); + } + if (arguments[0]) { + // Assume error + return _handleWrapError(_this, arguments[0], name, context, + argsWithoutError, options, lastArg); + } else { + _this.execPost(name, context, argsWithoutError, function() { + if (arguments[0]) { + return typeof lastArg === 'function' ? + lastArg(arguments[0]) : + undefined; + } + + return typeof lastArg === 'function' ? + lastArg.apply(context, arguments) : + undefined; + }); + } + } + }); +}; + +Kareem.prototype.filter = function(fn) { + const clone = this.clone(); + + const pres = Array.from(clone._pres.keys()); + for (const name of pres) { + const hooks = this._pres.get(name). + map(h => Object.assign({}, h, { name: name })). + filter(fn); + + if (hooks.length === 0) { + clone._pres.delete(name); + continue; + } + + hooks.numAsync = hooks.filter(h => h.isAsync).length; + + clone._pres.set(name, hooks); + } + + const posts = Array.from(clone._posts.keys()); + for (const name of posts) { + const hooks = this._posts.get(name). + map(h => Object.assign({}, h, { name: name })). + filter(fn); + + if (hooks.length === 0) { + clone._posts.delete(name); + continue; + } + + clone._posts.set(name, hooks); + } + + return clone; +}; + +Kareem.prototype.hasHooks = function(name) { + return this._pres.has(name) || this._posts.has(name); +}; + +Kareem.prototype.createWrapper = function(name, fn, context, options) { + var _this = this; + if (!this.hasHooks(name)) { + // Fast path: if there's no hooks for this function, just return the + // function wrapped in a nextTick() + return function() { + process.nextTick(() => fn.apply(this, arguments)); + }; + } + return function() { + var _context = context || this; + var args = Array.prototype.slice.call(arguments); + _this.wrap(name, fn, _context, args, options); + }; +}; + +Kareem.prototype.pre = function(name, isAsync, fn, error, unshift) { + let options = {}; + if (typeof isAsync === 'object' && isAsync != null) { + options = isAsync; + isAsync = options.isAsync; + } else if (typeof arguments[1] !== 'boolean') { + error = fn; + fn = isAsync; + isAsync = false; + } + + const pres = get(this._pres, name, []); + this._pres.set(name, pres); + + if (isAsync) { + pres.numAsync = pres.numAsync || 0; + ++pres.numAsync; + } + + if (typeof fn !== 'function') { + throw new Error('pre() requires a function, got "' + typeof fn + '"'); + } + + if (unshift) { + pres.unshift(Object.assign({}, options, { fn: fn, isAsync: isAsync })); + } else { + pres.push(Object.assign({}, options, { fn: fn, isAsync: isAsync })); + } + + return this; +}; + +Kareem.prototype.post = function(name, options, fn, unshift) { + const hooks = get(this._posts, name, []); + + if (typeof options === 'function') { + unshift = !!fn; + fn = options; + options = {}; + } + + if (typeof fn !== 'function') { + throw new Error('post() requires a function, got "' + typeof fn + '"'); + } + + if (unshift) { + hooks.unshift(Object.assign({}, options, { fn: fn })); + } else { + hooks.push(Object.assign({}, options, { fn: fn })); + } + this._posts.set(name, hooks); + return this; +}; + +Kareem.prototype.clone = function() { + const n = new Kareem(); + + for (let key of this._pres.keys()) { + const clone = this._pres.get(key).slice(); + clone.numAsync = this._pres.get(key).numAsync; + n._pres.set(key, clone); + } + for (let key of this._posts.keys()) { + n._posts.set(key, this._posts.get(key).slice()); + } + + return n; +}; + +Kareem.prototype.merge = function(other, clone) { + clone = arguments.length === 1 ? true : clone; + var ret = clone ? this.clone() : this; + + for (let key of other._pres.keys()) { + const sourcePres = get(ret._pres, key, []); + const deduplicated = other._pres.get(key). + // Deduplicate based on `fn` + filter(p => sourcePres.map(_p => _p.fn).indexOf(p.fn) === -1); + const combined = sourcePres.concat(deduplicated); + combined.numAsync = sourcePres.numAsync || 0; + combined.numAsync += deduplicated.filter(p => p.isAsync).length; + ret._pres.set(key, combined); + } + for (let key of other._posts.keys()) { + const sourcePosts = get(ret._posts, key, []); + const deduplicated = other._posts.get(key). + filter(p => sourcePosts.indexOf(p) === -1); + ret._posts.set(key, sourcePosts.concat(deduplicated)); + } + + return ret; +}; + +function get(map, key, def) { + if (map.has(key)) { + return map.get(key); + } + return def; +} + +function callMiddlewareFunction(fn, context, args, next) { + let maybePromise; + try { + maybePromise = fn.apply(context, args); + } catch (error) { + return next(error); + } + + if (isPromise(maybePromise)) { + maybePromise.then(() => next(), err => next(err)); + } +} + +function isPromise(v) { + return v != null && typeof v.then === 'function'; +} + +function decorateNextFn(fn) { + var called = false; + var _this = this; + return function() { + // Ensure this function can only be called once + if (called) { + return; + } + called = true; + // Make sure to clear the stack so try/catch doesn't catch errors + // in subsequent middleware + return process.nextTick(() => fn.apply(_this, arguments)); + }; +} + +module.exports = Kareem; + + +/***/ }), + +/***/ 96008: +/***/ ((module) => { + +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to match template delimiters. */ +var reInterpolate = /<%=([\s\S]+?)%>/g; + +module.exports = reInterpolate; + + +/***/ }), + +/***/ 60417: +/***/ ((module, exports, __nccwpck_require__) => { + +/* module decorator */ module = __nccwpck_require__.nmd(module); +/** + * Lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +var reInterpolate = __nccwpck_require__(96008), + templateSettings = __nccwpck_require__(25477); + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800, + HOT_SPAN = 16; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to match empty string literals in compiled template source. */ +var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ +var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Used to ensure capturing order of template delimiters. */ +var reNoMatch = /($^)/; + +/** Used to match unescaped characters in compiled string literals. */ +var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** Used to escape characters for inclusion in compiled string literals. */ +var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Detect free variable `exports`. */ +var freeExports = true && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ +function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); +} + +/** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ +function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined, + Symbol = root.Symbol, + getPrototype = overArg(Object.getPrototypeOf, Object), + propertyIsEnumerable = objectProto.propertyIsEnumerable, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeNow = Date.now; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; +} + +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} + +/** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ +function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +/** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ +function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); +}); + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} + +/** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '