@apollo/client 3.4.0-rc.7 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs.js +300 -263
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -1
- package/cache/cache.cjs.js +105 -41
- package/cache/cache.cjs.js.map +1 -1
- package/cache/core/types/DataProxy.js +1 -0
- package/cache/index.d.ts +0 -1
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +3 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -2
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +22 -10
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +1 -0
- package/cache/inmemory/helpers.d.ts +1 -1
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +5 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +24 -3
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +3 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +12 -7
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +23 -10
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +5 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +9 -6
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.js +1 -0
- package/cache/inmemory/writeToStore.d.ts +1 -0
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +16 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -0
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -4
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +7 -6
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +116 -78
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +3 -6
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +13 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +137 -181
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/types.d.ts +4 -1
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.js +1 -0
- package/errors/errors.cjs.js +2 -0
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +3 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +82 -57
- package/link/context/context.cjs.js +4 -0
- package/link/context/context.cjs.js.map +1 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js +4 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs.js +4 -2
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +3 -0
- package/link/core/index.js.map +1 -1
- package/link/core/types.js +1 -0
- package/link/http/checkFetcher.js +1 -1
- package/link/http/http.cjs.js +13 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +11 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/utils.cjs.js +1 -1
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +20 -20
- package/react/components/Mutation.d.ts +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/components.cjs.js +45 -31
- package/react/components/components.cjs.js.map +1 -1
- package/react/components/types.js +1 -0
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs.js +22 -8
- package/react/context/context.cjs.js.map +1 -1
- package/react/data/OperationData.js +2 -2
- package/react/data/QueryData.d.ts +1 -2
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +65 -72
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +65 -71
- package/react/data/data.cjs.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs.js +35 -18
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/types.js +1 -0
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs.js +56 -10
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +16 -6
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +2 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js +18 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +10 -3
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +3 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.js +4 -4
- package/react/parser/parser.cjs.js +4 -4
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -2
- package/react/react.cjs.js.map +1 -1
- package/react/ssr/ssr.cjs.js +15 -1
- package/react/ssr/ssr.cjs.js.map +1 -1
- package/react/types/types.d.ts +9 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js +1 -0
- package/react/types/types.js.map +1 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -0
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +68 -17
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +1 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/global.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +2 -2
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts +2 -0
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -0
- package/utilities/common/stringifyForDisplay.js +8 -0
- package/utilities/common/stringifyForDisplay.js.map +1 -0
- package/utilities/globals/DEV.d.ts +3 -0
- package/utilities/globals/DEV.d.ts.map +1 -0
- package/utilities/globals/DEV.js +20 -0
- package/utilities/globals/DEV.js.map +1 -0
- package/utilities/globals/graphql.d.ts +1 -1
- package/utilities/globals/graphql.d.ts.map +1 -1
- package/utilities/globals/graphql.js +3 -3
- package/utilities/globals/graphql.js.map +1 -1
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +5 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +5 -5
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +3 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +5 -1
- package/utilities/index.js.map +1 -1
- package/utilities/package.json +3 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +10 -11
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/index.d.ts +1 -0
- package/utilities/testing/index.d.ts.map +1 -1
- package/utilities/testing/index.js +1 -0
- package/utilities/testing/index.js.map +1 -1
- package/utilities/testing/itAsync.d.ts +5 -8
- package/utilities/testing/itAsync.d.ts.map +1 -1
- package/utilities/testing/itAsync.js +6 -7
- package/utilities/testing/itAsync.js.map +1 -1
- package/utilities/testing/mocking/mockFetch.js +2 -2
- package/utilities/testing/mocking/mockFetch.js.map +1 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +2 -8
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js +2 -2
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js +2 -2
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/testing/withConsoleSpy.d.ts +4 -0
- package/utilities/testing/withConsoleSpy.d.ts.map +1 -0
- package/utilities/testing/withConsoleSpy.js +39 -0
- package/utilities/testing/withConsoleSpy.js.map +1 -0
- package/utilities/types/IsStrictlyAny.js +1 -0
- package/utilities/utilities.cjs.js +56 -48
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/core/Reobserver.d.ts +0 -18
- package/core/Reobserver.d.ts.map +0 -1
- package/core/Reobserver.js +0 -87
- package/core/Reobserver.js.map +0 -1
- package/utilities/globals/__DEV__.d.ts +0 -3
- package/utilities/globals/__DEV__.d.ts.map +0 -1
- package/utilities/globals/__DEV__.js +0 -32
- package/utilities/globals/__DEV__.js.map +0 -1
- package/utilities/globals/process.d.ts +0 -2
- package/utilities/globals/process.d.ts.map +0 -1
- package/utilities/globals/process.js +0 -31
- package/utilities/globals/process.js.map +0 -1
package/apollo-client.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("ts-invariant"),r=require("@wry/equality"),n=require("zen-observable-ts");require("symbol-observable");var i=require("graphql"),o=require("optimism"),a=require("@wry/context"),s=require("@wry/trie"),u=require("graphql-tag");function c(e){try{return e()}catch(e){}}var l=c((function(){return globalThis}))||c((function(){return window}))||c((function(){return self}))||c((function(){return global}))||c((function(){return Function("return this")()}));var f=function(){try{return Boolean(!1)}catch(t){var e=c((function(){return process.env.NODE_ENV}));c((function(){return process.versions.node}));return Object.defineProperty(l,"__DEV__",{value:"production"!==e,enumerable:!1,configurable:!0,writable:!0}),l.__DEV__}}();function p(e,r){var n=e.directives;return!n||!n.length||function(e){var r=[];e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var n=e.arguments;e.name.value;t.invariant(n&&1===n.length,40);var i=n[0];t.invariant(i.name&&"if"===i.name.value,41);var o=i.value;t.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),42),r.push({directive:e,ifArgument:i})}}));return r}(n).every((function(e){var n=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=r&&r[i.value.name.value],t.invariant(void 0!==o,39)):o=i.value.value,"skip"===n.name.value?!o:o}))}function h(e,t){return function(e){var t=[];return i.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function d(e){return e&&h(["client"],e)&&h(["export"],e)}function v(r,n){var i=n,o=[];return r.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw new t.InvariantError(43);"FragmentDefinition"===e.kind&&o.push(e)})),void 0===i&&(t.invariant(1===o.length,44),i=o[0].name.value),e.__assign(e.__assign({},r),{definitions:e.__spreadArrays([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],r.definitions)})}function y(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function m(e,r){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var n=r&&r[e.name.value];return t.invariant(n,45),n;default:return null}}function g(e){return null!==e&&"object"==typeof e}function b(e){return{__ref:String(e)}}function _(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function w(e,r,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))e[r.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))e[r.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return w(o,e.name,e.value,i)})),e[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];e[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))e[r.value]=n.values.map((function(e){var t={};return w(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))e[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new t.InvariantError(54);e[r.value]=null}}var S=["connection","include","skip","client","rest","export"],O=Object.assign((function(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach((function(e){i[e]=t[e]})),r.connection.key+"("+k(i)+")"}return r.connection.key}var o=e;if(t){var a=k(t);o+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===S.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@"+e+"("+k(r[e])+")":o+="@"+e)})),o}),{setStringify:function(e){var t=k;return k=e,t}}),k=function(e){return JSON.stringify(e,x)};function x(e,t){return g(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function E(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return w(r,n,i,t)})),r}return null}function q(e){return e.alias?e.alias.value:e.name.value}function R(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(Q(o)){if("__typename"===o.name.value)return e[q(o)]}else{var a=R(e,m(o,r).selectionSet,r);if("string"==typeof a)return a}}}function Q(e){return"Field"===e.kind}function F(e){return"InlineFragment"===e.kind}function I(e){t.invariant(e&&"Document"===e.kind,46);var r=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw new t.InvariantError(47);return e}));return t.invariant(r.length<=1,48),e}function P(e){return I(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function M(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function T(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function D(e){var r;I(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new t.InvariantError(53)}function C(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&w(t,e.variable.name,e.defaultValue)})),t}function j(e,t,r){var n=0;return e.forEach((function(r,i){t.call(this,r,i,e)&&(e[n++]=r)}),r),e.length=n,e}var A={kind:"Field",name:{kind:"Name",value:"__typename"}};function N(e,t){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&N(t[e.name.value],t)}))}function L(e){return N(P(e)||function(e){t.invariant("Document"===e.kind,50),t.invariant(e.definitions.length<=1,51);var r=e.definitions[0];return t.invariant("FragmentDefinition"===r.kind,52),r}(e),y(T(e)))?null:e}function V(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function B(t,r){var n=Object.create(null),o=[],a=Object.create(null),s=[],u=L(i.visit(r,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(n[e.name.value]=!0)}},Field:{enter:function(e){if(t&&e.directives&&(t.some((function(e){return e.remove}))&&e.directives&&e.directives.some(V(t))))return e.arguments&&e.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),e.selectionSet&&U(e.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(e){if(V(t)(e))return null}}}));return u&&j(o,(function(e){return!!e.name&&!n[e.name]})).length&&(u=function(t,r){var n=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(t);return L(i.visit(r,{OperationDefinition:{enter:function(r){return e.__assign(e.__assign({},r),{variableDefinitions:r.variableDefinitions?r.variableDefinitions.filter((function(e){return!t.some((function(t){return t.name===e.variable.name.value}))})):[]})}},Field:{enter:function(e){if(t.some((function(e){return e.remove}))){var r=0;if(e.arguments&&e.arguments.forEach((function(e){n(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(n(e))return null}}}))}(o,u)),u&&j(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return L(i.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(s,u)),u}var W=Object.assign((function(t){return i.visit(I(t),{SelectionSet:{enter:function(t,r,n){if(!n||"OperationDefinition"!==n.kind){var i=t.selections;if(i)if(!i.some((function(e){return Q(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(Q(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return e.__assign(e.__assign({},t),{selections:e.__spreadArrays(i,[A])})}}}}})}),{added:function(e){return e===A}}),z={test:function(e){var t="connection"===e.name.value;return t&&(!e.arguments||e.arguments.some((function(e){return"key"===e.name.value}))),t}};function U(e){var t=[];return e.selections.forEach((function(e){(Q(e)||F(e))&&e.selectionSet?U(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function K(t){return"query"===D(t).operation?t:i.visit(t,{OperationDefinition:{enter:function(t){return e.__assign(e.__assign({},t),{operation:"query"})}}})}var J=Object.prototype.hasOwnProperty;function H(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Y(e)}function Y(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new $,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var G=function(e,t,r){return this.merge(e[r],t[r])},$=function(){function t(e){void 0===e&&(e=G),this.reconciler=e,this.isObject=g,this.pastCopies=new Set}return t.prototype.merge=function(t,r){for(var n=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return g(r)&&g(t)?(Object.keys(r).forEach((function(o){if(J.call(t,o)){var a=t[o];if(r[o]!==a){var s=n.reconciler.apply(n,e.__spreadArrays([t,r,o],i));s!==a&&((t=n.shallowCopyForMerge(t))[o]=s)}}else(t=n.shallowCopyForMerge(t))[o]=r[o]})),t):r},t.prototype.shallowCopyForMerge=function(t){return g(t)&&!this.pastCopies.has(t)&&(t=Array.isArray(t)?t.slice(0):e.__assign({__proto__:Object.getPrototypeOf(t)},t),this.pastCopies.add(t)),t},t}(),X=Object.prototype.toString;function Z(e){return ee(e)}function ee(e,t){switch(X.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=ee(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=ee(e[r],t)})),n;default:return e}}function te(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function re(e,t,r){return new n.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}function ne(e){function t(t){Object.defineProperty(e,t,{value:n.Observable})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ie(e){return e&&"function"==typeof e.then}var oe=function(t){function r(e){var r=t.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],te(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&Promise.resolve().then((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),te(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?ie(e)?e.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=e.subscribe(r.handlers):(r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),te(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof e&&(e=[new n.Observable(e)]),ie(e)?e.then((function(e){return r.start(e)}),r.handlers.error):r.start(e),r}return e.__extends(r,t),r.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},r.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},r.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},r.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},r.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},r}(n.Observable);function ae(e){return Array.isArray(e)&&e.length>0}function se(e){return e.errors&&e.errors.length>0||!1}ne(oe);var ue="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);function ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}var le=new Map;function fe(e){var t=le.get(e)||1;return le.set(e,t+1),e+":"+t+":"+Math.random().toString(36).slice(2)}function pe(e){return new n.Observable((function(t){t.error(e)}))}var he=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n};function de(e,t){return t?t(e):n.Observable.of()}function ve(e){return"function"==typeof e?new me(e):e}function ye(e){return e.request.length<=1}!function(t){function r(e,r){var n=t.call(this,e)||this;return n.link=r,n}e.__extends(r,t)}(Error);var me=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r((function(){return n.Observable.of()}))},r.from=function(e){return 0===e.length?r.empty():e.map(ve).reduce((function(e,t){return e.concat(t)}))},r.split=function(e,t,i){var o=ve(t),a=ve(i||new r(de));return ye(o)&&ye(a)?new r((function(t){return e(t)?o.request(t)||n.Observable.of():a.request(t)||n.Observable.of()})):new r((function(t,r){return e(t)?o.request(t,r)||n.Observable.of():a.request(t,r)||n.Observable.of()}))},r.execute=function(r,i){return r.request(function(t,r){var n=e.__assign({},t);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(t){n="function"==typeof t?e.__assign(e.__assign({},n),t(n)):e.__assign(e.__assign({},n),t)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return e.__assign({},n)}}),r}(i.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?M(t.query)||void 0:""),t}(function(e){for(var r=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];if(r.indexOf(o)<0)throw new t.InvariantError(27)}return e}(i))))||n.Observable.of()},r.concat=function(e,t){var i=ve(e);if(ye(i))return i;var o=ve(t);return ye(o)?new r((function(e){return i.request(e,(function(e){return o.request(e)||n.Observable.of()}))||n.Observable.of()})):new r((function(e,t){return i.request(e,(function(e){return o.request(e,t)||n.Observable.of()}))||n.Observable.of()}))},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(de)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,r){throw new t.InvariantError(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}(),ge=me.empty,be=me.from,_e=me.split,we=me.concat,Se=me.execute,Oe=Object.prototype.hasOwnProperty;function ke(e){return function(t){return t.text().then((function(e){try{return JSON.parse(e)}catch(n){var r=n;throw r.name="ServerParseError",r.response=t,r.statusCode=t.status,r.bodyText=e,r}})).then((function(r){return t.status>=300&&he(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||Oe.call(r,"data")||Oe.call(r,"errors")||he(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var xe=function(e,r){var n;try{n=JSON.stringify(e)}catch(e){var i=new t.InvariantError(24);throw i.parseError=e,i}return n},Ee={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},qe=function(t,r){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var a=e.__assign(e.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),s=r.http||{};n.forEach((function(t){a=e.__assign(e.__assign(e.__assign({},a),t.options),{headers:e.__assign(e.__assign({},a.headers),t.headers)}),t.credentials&&(a.credentials=t.credentials),s=e.__assign(e.__assign({},s),t.http)}));var u=t.operationName,c=t.extensions,l=t.variables,f=t.query,p={operationName:u,variables:l};return s.includeExtensions&&(p.extensions=c),s.includeQuery&&(p.query=i.print(f)),{options:a,body:p}},Re=function(e){if(!e&&"undefined"==typeof fetch)throw new t.InvariantError(23)},Qe=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},Fe=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function Ie(e,t){var r=[],n=function(e,t){r.push(e+"="+encodeURIComponent(t))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=xe(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=xe(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var Pe=function(t){void 0===t&&(t={});var r=t.uri,o=void 0===r?"/graphql":r,a=t.fetch,s=t.includeExtensions,u=t.useGETForQueries,c=t.includeUnusedVariables,l=void 0!==c&&c,f=e.__rest(t,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);Re(a),a||(a=fetch);var p={http:{includeExtensions:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new me((function(t){var r=Fe(t,o),s=t.getContext(),c={};if(s.clientAwareness){var f=s.clientAwareness,h=f.name,d=f.version;h&&(c["apollographql-client-name"]=h),d&&(c["apollographql-client-version"]=d)}var v,y=e.__assign(e.__assign({},c),s.headers),m={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:y},g=qe(t,Ee,p,m),b=g.options,_=g.body;if(_.variables&&!l){var w=new Set(Object.keys(_.variables));i.visit(t.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&w.delete(e.name.value)}}),w.size&&(_.variables=e.__assign({},_.variables),w.forEach((function(e){delete _.variables[e]})))}if(!b.signal){var S=Qe(),O=S.controller,k=S.signal;(v=O)&&(b.signal=k)}if(u&&!t.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(b.method="GET"),"GET"===b.method){var x=Ie(r,_),E=x.newURI,q=x.parseError;if(q)return pe(q);r=E}else try{b.body=xe(_)}catch(q){return pe(q)}return new n.Observable((function(e){return a(r,b).then((function(e){return t.setContext({response:e}),e})).then(ke(t)).then((function(t){return e.next(t),e.complete(),t})).catch((function(t){"AbortError"!==t.name&&(t.result&&t.result.errors&&t.result.data&&e.next(t.result),e.error(t))})),function(){v&&v.abort()}}))}))},Me=function(t){function r(e){void 0===e&&(e={});var r=t.call(this,Pe(e).request)||this;return r.options=e,r}return e.__extends(r,t),r}(me),Te=function(){function t(){this.getFragmentDoc=o.wrap(v)}return t.prototype.batch=function(e){var t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;this.performTransaction(e.update,t)},t.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},t.prototype.transformDocument=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.transformForLink=function(e){return e},t.prototype.readQuery=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{rootId:t.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{query:this.getFragmentDoc(t.fragment,t.fragmentName),rootId:t.id,optimistic:r}))},t.prototype.writeQuery=function(t){var r=t.id,n=t.data,i=e.__rest(t,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(t){var r=t.id,n=t.data,i=t.fragment,o=t.fragmentName,a=e.__rest(t,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:r,result:n}))},t}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var De=function(t){function r(e,n,i,o){var a=t.call(this,e)||this;return a.message=e,a.path=n,a.query=i,a.variables=o,a.__proto__=r.prototype,a}return e.__extends(r,t),r}(Error),Ce=Object.prototype.hasOwnProperty;var je=/^[_a-z][_0-9a-z]*/i;function Ae(e){var t=e.match(je);return t?t[0]:e}function Ne(e,t,r){return!!g(t)&&(Array.isArray(t)?t.every((function(t){return Ne(e,t,r)})):e.selections.every((function(e){if(Q(e)&&p(e,r)){var n=q(e);return Ce.call(t,n)&&(!e.selectionSet||Ne(e.selectionSet,t[n],r))}return!0})))}function Le(e){return g(e)&&!_(e)&&!Array.isArray(e)}var Ve=Object.create(null),Be=function(){return Ve},We=Object.create(null),ze=function(){function r(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return _(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return _(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return b(e);if(_(e))return e;var n=r.policies.identify(e)[0];if(n){var i=b(n);return t&&r.merge(n,e),i}}}return r.prototype.toObject=function(){return e.__assign({},this.data)},r.prototype.has=function(e){return void 0!==this.lookup(e,!0)},r.prototype.get=function(e,t){if(this.group.depend(e,t),Ce.call(this.data,e)){var r=this.data[e];if(r&&Ce.call(r,t))return r[t]}return"__typename"===t&&Ce.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof He?this.parent.get(e,t):void 0},r.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Ce.call(this.data,e)?this.data[e]:this instanceof He?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},r.prototype.merge=function(e,r){var n,i=this,o="string"==typeof e?this.lookup(n=e):e,a="string"==typeof r?this.lookup(n=r):r;if(a){t.invariant("string"==typeof n,1);var s=new $(Ge).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=Ae(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof He||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},r.prototype.modify=function(t,r){var n=this,i=this.lookup(t);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:Ve,INVALIDATE:We,isReference:_,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||b(t)}:e,{store:n})}};if(Object.keys(i).forEach((function(c){var l=Ae(c),f=i[c];if(void 0!==f){var p="function"==typeof r?r:r[c]||r[l];if(p){var h=p===Be?Ve:p(f,e.__assign(e.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(t,c)}));h===We?n.group.dirty(t,c):(h===Ve&&(h=void 0),h!==f&&(o[c]=h,a=!0,f=h))}void 0!==f&&(s=!1)}})),a)return this.merge(t,o),s&&(this instanceof He?this.data[t]=void 0:delete this.data[t],this.group.dirty(t,"__exists")),!0}return!1},r.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=Be,n):Be)}return!1},r.prototype.evict=function(e){var t=!1;return e.id&&(Ce.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof He&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){Ce.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},r.prototype.replace=function(t){var r=this;if(Object.keys(this.data).forEach((function(e){t&&Ce.call(t,e)||r.delete(e)})),t){var n=t.__META,i=e.__rest(t,["__META"]);Object.keys(i).forEach((function(e){r.merge(e,i[e])})),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof He?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){Ce.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof He;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},r.prototype.findChildRefIds=function(e){if(!Ce.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=new Set([this.data[e]]);r.forEach((function(e){_(e)?t[e.__ref]=!0:g(e)&&Object.values(e).filter(g).forEach(r.add,r)}))}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),Ue=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.keyMaker=new s.Trie(ue),this.d=e?o.dep():null}return e.prototype.depend=function(e,t){if(this.d){this.d(Ke(e,t));var r=Ae(t);r!==t&&this.d(Ke(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ke(e,t),"__exists"===t?"forget":"setDirty")},e}();function Ke(e,t){return t+"#"+e}function Je(e,t){$e(e)&&e.group.depend(t,"__exists")}!function(t){var r=function(t){function r(e){var r=e.policies,n=e.resultCaching,i=void 0===n||n,o=e.seed,a=t.call(this,r,new Ue(i))||this;return a.stump=new Ye(a),a.storageTrie=new s.Trie(ue),o&&a.replace(o),a}return e.__extends(r,t),r.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(t);t.Root=r}(ze||(ze={}));var He=function(t){function n(e,r,n,i){var o=t.call(this,r.policies,i)||this;return o.id=e,o.parent=r,o.replay=n,o.group=i,n(o),o}return e.__extends(n,t),n.prototype.addLayer=function(e,t){return new n(e,this,t,this.group)},n.prototype.removeLayer=function(e){var t=this,n=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var i=t.data[e],o=n.lookup(e);o?i?i!==o&&Object.keys(i).forEach((function(n){r.equal(i[n],o[n])||t.group.dirty(e,n)})):(t.group.dirty(e,"__exists"),Object.keys(o).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),n):n===this.parent?this:n.addLayer(this.id,this.replay)},n.prototype.toObject=function(){return e.__assign(e.__assign({},this.parent.toObject()),this.data)},n.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Ce.call(this.data,r)?e.__assign(e.__assign({},n),t.prototype.findChildRefIds.call(this,r)):n},n.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},n}(ze),Ye=function(t){function r(e){return t.call(this,"EntityStore.Stump",e,(function(){}),new Ue(e.group.caching,e.group))||this}return e.__extends(r,t),r.prototype.removeLayer=function(){return this},r.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},r}(He);function Ge(e,t,n){var i=e[n],o=t[n];return r.equal(i,o)?i:o}function $e(e){return!!(e instanceof ze&&e.group.caching)}var Xe=function(){function t(){this.known=new(ue?WeakSet:Set),this.pool=new s.Trie(ue),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return g(e)&&this.known.has(e)},t.prototype.pass=function(t){if(g(t)){var r=function(t){return g(t)?Array.isArray(t)?t.slice(0):e.__assign({__proto__:Object.getPrototypeOf(t)},t):t}(t);return this.passes.set(r,t),r}return t},t.prototype.admit=function(e){var t=this;if(g(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},t.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},t}(),Ze=Object.assign((function(e){if(g(e)){var t=et.admit(e),r=tt.get(t);return void 0===r&&tt.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:function(){et=new Xe}}),et=new Xe,tt=new WeakMap;function rt(e,t){return new De(e.message,t.path.slice(),t.query,t.variables)}function nt(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var it=function(){function r(t){var r=this;this.canon=new Xe,this.knownResults=new WeakMap,this.config=e.__assign(e.__assign({},t),{addTypename:!1!==t.addTypename}),this.executeSelectionSet=o.wrap((function(t){var n,i=t.context.canonizeResults,o=nt(t);o[3]=!i;var a=(n=r.executeSelectionSet).peek.apply(n,o);return a?i?e.__assign(e.__assign({},a),{result:r.canon.admit(a.result)}):a:(Je(t.context.store,t.enclosingRef.__ref),r.execSelectionSetImpl(t))}),{max:this.config.resultCacheMaxSize,keyArgs:nt,makeCacheKey:function(e,t,r,n){if($e(r.store))return r.store.makeCacheKey(e,_(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=o.wrap((function(e){return Je(e.context.store,e.enclosingRef.__ref),r.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if($e(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return r.prototype.diffQueryAgainstStore=function(r){var n,i=r.store,o=r.query,a=r.rootId,s=void 0===a?"ROOT_QUERY":a,u=r.variables,c=r.returnPartialData,l=void 0===c||c,f=r.canonizeResults,p=void 0===f||f,h=this.config.cache.policies;u=e.__assign(e.__assign({},C((n=P(o),t.invariant(n&&"query"===n.operation,49),n))),u);var d=b(s),v=this.executeSelectionSet({selectionSet:D(o).selectionSet,objectOrReference:d,enclosingRef:d,context:{store:i,query:o,policies:h,variables:u,varString:Ze(u),canonizeResults:p,fragmentMap:y(T(o)),path:[]}}),m=v.missing&&v.missing.length>0;if(m&&!l)throw v.missing[0];return{result:v.result,missing:v.missing,complete:!m}},r.prototype.isFresh=function(e,t,r,n){if($e(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,i=e.objectOrReference,o=e.enclosingRef,a=e.context;if(_(i)&&!a.policies.rootTypenamesById[i.__ref]&&!a.store.has(i.__ref))return{result:this.canon.empty,missing:[rt(new t.InvariantError(5),a)]};var s=a.variables,u=a.policies,c=a.store,l=[],f={result:null},h=c.getFieldValue(i,"__typename");function d(){return f.missing||(f.missing=[])}function v(e){var t;return e.missing&&(t=d()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof h&&!u.rootIdsByTypename[h]&&l.push({__typename:h});var y=new Set(n.selections);y.forEach((function(e){var n;if(p(e,s))if(Q(e)){var c=u.readField({fieldName:e.name.value,field:e,variables:a.variables,from:i},a),f=q(e);a.path.push(f),void 0===c?W.added(e)||d().push(rt(new t.InvariantError(6),a)):Array.isArray(c)?c=v(r.executeSubSelectedArray({field:e,array:c,enclosingRef:o,context:a})):e.selectionSet?null!=c&&(c=v(r.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:c,enclosingRef:_(c)?c:o,context:a}))):a.canonizeResults&&(c=r.canon.pass(c)),void 0!==c&&l.push(((n={})[f]=c,n)),t.invariant(a.path.pop()===f)}else{var g=m(e,a.fragmentMap);g&&u.fragmentMatches(g,h)&&g.selectionSet.selections.forEach(y.add,y)}}));var g=Y(l);return f.result=a.canonizeResults?this.canon.admit(g):g,this.knownResults.set(f.result,n),f},r.prototype.execSubSelectedArrayImpl=function(e){var r,n=this,i=e.field,o=e.array,a=e.enclosingRef,s=e.context;function u(e,n){return e.missing&&(r=r||[]).push.apply(r,e.missing),t.invariant(s.path.pop()===n),e.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),o=o.map((function(e,r){return null===e?null:(s.path.push(r),Array.isArray(e)?u(n.executeSubSelectedArray({field:i,array:e,enclosingRef:a,context:s}),r):i.selectionSet?u(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,enclosingRef:_(e)?e:a,context:s}),r):(t.invariant(s.path.pop()===r),e))})),{result:s.canonizeResults?this.canon.admit(o):o,missing:r}},r}();var ot=function(){function r(e,t){this.cache=e,this.reader=t}return r.prototype.writeToStore=function(r,n){var i=this,o=n.query,a=n.result,s=n.dataId,u=n.variables,c=n.overwrite,l=P(o),f=new $;u=e.__assign(e.__assign({},C(l)),u);var p={store:r,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:Ze(u),fragmentMap:y(T(o)),overwrite:!!c,incomingById:new Map},h=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!_(h))throw new t.InvariantError(8);return p.incomingById.forEach((function(e,t){var n=e.fields,o=e.mergeTree,a=(e.selections,b(t));o.map.size&&(n=i.applyMerges(o,a,n,p)),r.merge(t,n)})),r.retain(h.__ref),h},r.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,i=e.result,o=e.selectionSet,a=e.context,s=e.mergeTree,u=this.cache.policies,c=u.identify(i,o,a.fragmentMap),l=c[0],f=c[1];if("string"==typeof(n=n||l)){var d=a.written[n]||(a.written[n]=[]),v=b(n);if(d.indexOf(o)>=0)return v;if(d.push(o),this.reader&&this.reader.isFresh(i,v,o,a))return v}var y=Object.create(null);f&&(y=a.merge(y,f));var g=n&&u.rootTypenamesById[n]||R(i,o,a.fragmentMap)||n&&a.store.get(n,"__typename");"string"==typeof g&&(y.__typename=g);var w=new Set(o.selections);if(w.forEach((function(e){var n;if(p(e,a.variables))if(Q(e)){var o=q(e),c=i[o];if(void 0!==c){var l=u.getStoreFieldName({typename:g,fieldName:e.name.value,field:e,variables:a.variables}),f=st(s,l),d=r.processFieldValue(c,e,a,f),v=void 0;if(e.selectionSet&&!(v=a.store.getFieldValue(d,"__typename"))&&_(d)){var b=a.incomingById.get(d.__ref);v=b&&b.fields.__typename}var S=u.getMergeFunction(g,e.name.value,v);S?f.info={field:e,typename:g,merge:S}:lt(s,l),y=a.merge(y,((n={})[l]=d,n))}else if(u.usingPossibleTypes&&!h(["defer","client"],e))throw new t.InvariantError(9)}else{var O=m(e,a.fragmentMap);O&&u.fragmentMatches(O,g,i,a.variables)&&O.selectionSet.selections.forEach(w.add,w)}})),"string"==typeof n){var S=a.incomingById.get(n);return S?(S.fields=a.merge(S.fields,y),S.mergeTree=ut(S.mergeTree,s),S.selections.forEach(w.add,w),S.selections=w):a.incomingById.set(n,{fields:y,mergeTree:s,selections:w}),b(n)}return y},r.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,st(n,o));return lt(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},r.prototype.applyMerges=function(r,n,i,o,a){var s,u=this;if(r.map.size&&!_(i)){var c,l=Array.isArray(i)||!_(n)&&!Le(n)?void 0:n,f=i;l&&!a&&(a=[_(l)?l.__ref:l]);var p=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};r.map.forEach((function(e,r){var n=p(l,r),i=p(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(e,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&t.invariant(a.pop()===r)}})),c&&(i=Array.isArray(f)?f.slice(0):e.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return r.info?this.cache.policies.runMergeFunction(n,i,r.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},r}(),at=[];function st(e,t){var r=e.map;return r.has(t)||r.set(t,at.pop()||{map:new Map}),r.get(t)}function ut(t,r){if(t===r||!r||ct(r))return t;if(!t||ct(t))return r;var n=t.info&&r.info?e.__assign(e.__assign({},t.info),r.info):t.info||r.info,i=t.map.size&&r.map.size,o={info:n,map:i?new Map:t.map.size?t.map:r.map};if(i){var a=new Set(r.map.keys());t.map.forEach((function(e,t){o.map.set(t,ut(e,r.map.get(t))),a.delete(t)})),a.forEach((function(e){o.map.set(e,ut(r.map.get(e),t.map.get(e)))}))}return o}function ct(e){return!e||!(e.info||e.map.size)}function lt(e,t){var r=e.map,n=r.get(t);n&&ct(n)&&(at.push(n),r.delete(t))}new Set;var ft=new a.Slot,pt=new WeakMap;function ht(e){var t=pt.get(e);return t||pt.set(e,t={vars:new Set,dep:o.dep()}),t}function dt(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){ht(e).dep.dirty(n),vt(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=ft.getValue();s&&(i(s),ht(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),ht(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function vt(e){e.broadcastWatches&&e.broadcastWatches()}function yt(e){return void 0!==e.args?e.args:e.field?E(e.field,e.variables):null}O.setStringify(Ze);var mt=function(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=void 0!==n?{id:n}:void 0!==i?{_id:i}:void 0),void 0===n&&(n=i),void 0!==n))return r+":"+("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))},gt=function(){},bt=function(e,t){return t.fieldName},_t=function(e,t,r){return(0,r.mergeObjects)(e,t)},wt=function(e,t){return t},St=function(){function r(t){this.config=t,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=!1,this.config=e.__assign({dataIdFromObject:mt},t),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),t.possibleTypes&&this.addPossibleTypes(t.possibleTypes),t.typePolicies&&this.addTypePolicies(t.typePolicies)}return r.prototype.identify=function(e,t,r){var n=t&&r?R(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},a=n&&this.getTypePolicy(n),s=a&&a.keyFn||this.config.dataIdFromObject;s;){var u=s(e,o);if(!Array.isArray(u)){i=u;break}s=Et(u)}return i=i?String(i):void 0,o.keyObject?[i,o.keyObject]:[i]},r.prototype.addTypePolicies=function(t){var r=this;Object.keys(t).forEach((function(n){var i=t[n],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=e.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),a&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Ce.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},r.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?_t:!1===t?wt:e.merge}a(n,t.merge),n.keyFn=!1===i?gt:Array.isArray(i)?Et(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?bt:Array.isArray(s)?xt(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||bt)}))},r.prototype.setRootTypename=function(e,r){void 0===r&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(t.invariant(!i||i===e,2),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(je);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},r.prototype.getTypePolicy=function(t){var r=this;if(!Ce.call(this.typePolicies,t)){var n=this.typePolicies[t]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(t);i&&i.size&&i.forEach((function(t){var i=r.getTypePolicy(t),o=i.fields,a=e.__rest(i,["fields"]);Object.assign(n,a),Object.assign(n.fields,o)}))}var o=this.toBeAdded[t];return o&&o.length&&o.splice(0).forEach((function(e){r.updateTypePolicy(t,e)})),this.typePolicies[t]},r.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},r.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&Ne(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},r.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},r.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=yt(e);o;){var u=o(s,a);if(!Array.isArray(u)){t=u||n;break}o=xt(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return w(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return w(n,r,i,t)}))),O(e.name.value,n,r)}(e.field,e.variables):O(n,yt(e))),!1===t?n:n===Ae(t)?t:n+":"+t},r.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=Ae(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=Ot(this,r,e,t,t.store.getStorage(_(r)?r.__ref:r,i));return ft.withValue(this.cache,u,[a,c])}return a}},r.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},r.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===_t?kt(n.store)(e,t):s===wt?t:(n.overwrite&&(e=void 0),s(e,t,Ot(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},r}();function Ot(t,r,n,i,o){var a=t.getStoreFieldName(n),s=Ae(a),u=n.variables||i.variables,c=i.store,l=c.toReference,f=c.canRead;return{args:yt(n),field:n.field||null,fieldName:s,storeFieldName:a,variables:u,isReference:_,toReference:l,storage:o,cache:t.cache,canRead:f,readField:function(n,o){var a="string"==typeof n?{fieldName:n,from:o}:e.__assign({},n);return void 0===a.from&&(a.from=r),void 0===a.variables&&(a.variables=u),t.readField(a,i)},mergeObjects:kt(i.store)}}function kt(r){return function(n,i){if(Array.isArray(n)||Array.isArray(i))throw new t.InvariantError(3);if(g(n)&&g(i)){var o=r.getFieldValue(n,"__typename"),a=r.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(_(n)&&Le(i))return r.merge(n.__ref,i),n;if(Le(n)&&_(i))return r.merge(n,i.__ref),i;if(Le(n)&&Le(i))return e.__assign(e.__assign({},n),i)}return i}}function xt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(Rt(t,e,!1)):r.fieldName}}function Et(e){var t=new s.Trie(ue);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=qt(n.selectionSet,n.fragmentMap))}var a=n.keyObject=Rt(r,e,!0,i);return n.typename+":"+JSON.stringify(a)}}function qt(e,t){var r=Object.create(null),n=new Set([e]);return n.forEach((function(e){e.selections.forEach((function(e){if(Q(e)){if(e.alias){var i=e.alias.value,o=e.name.value;if(o!==i)(r.aliases||(r.aliases=Object.create(null)))[o]=i}if(e.selectionSet)(r.subsets||(r.subsets=Object.create(null)))[e.name.value]=qt(e.selectionSet,t)}else{var a=m(e,t);a&&n.add(a.selectionSet)}}))})),r}function Rt(e,r,n,i){var o,a=Object.create(null);return r.forEach((function(r){if(Array.isArray(r)){if("string"==typeof o){var s=i&&i.subsets,u=s&&s[o];a[o]=Rt(e[o],r,n,u)}}else{var c=i&&i.aliases,l=c&&c[r]||r;Ce.call(e,l)?a[o=r]=e[l]:(t.invariant(!n,4),o=void 0)}})),a}var Qt={dataIdFromObject:mt,addTypename:!0,resultCaching:!0,typePolicies:{}},Ft=function(t){function n(r){void 0===r&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=dt,n.txCount=0,n.config=e.__assign(e.__assign({},Qt),r),n.addTypename=!!n.config.addTypename,n.policies=new St({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.__extends(n,t),n.prototype.init=function(){var e=this,t=this.data=new ze.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.storeWriter=new ot(this,this.storeReader=new it({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize})),this.maybeBroadcastWatch=o.wrap((function(t,r){return e.broadcastWatch(t,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(t){var r=t.optimistic?e.optimisticData:e.data;if($e(r)){var n=t.optimistic,i=t.rootId,o=t.variables;return r.makeCacheKey(t.query,t.callback,Ze({optimistic:n,rootId:i,variables:o}))}}})},n.prototype.restore=function(e){return e&&this.data.replace(e),this},n.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},n.prototype.read=function(t){var r=t.returnPartialData,n=void 0!==r&&r;try{return this.storeReader.diffQueryAgainstStore(e.__assign(e.__assign({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(e){if(e instanceof De)return null;throw e}},n.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},n.prototype.modify=function(e){if(Ce.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},n.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(e.__assign(e.__assign({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},n.prototype.watch=function(e){var t,r=this;return this.watches.size||ht(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&function(e){ht(e).vars.forEach((function(t){return t.forgetCache(e)}))}(r),r.maybeBroadcastWatch.forget(e)}},n.prototype.gc=function(){return Ze.reset(),this.optimisticData.gc()},n.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},n.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},n.prototype.identify=function(e){return _(e)?e.__ref:this.policies.identify(e)[0]},n.prototype.evict=function(t){if(!t.id){if(Ce.call(t,"id"))return!1;t=e.__assign(e.__assign({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},n.prototype.reset=function(){return this.init(),this.broadcastWatches(),Ze.reset(),Promise.resolve()},n.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},n.prototype.batch=function(t){var r=this,n=t.update,i=t.optimistic,o=void 0===i||i,a=t.removeOptimistic,s=t.onWatchUpdated,u=function(e){var t=r,i=t.data,o=t.optimisticData;++r.txCount,e&&(r.data=r.optimisticData=e);try{n(r)}finally{--r.txCount,r.data=i,r.optimisticData=o}},c=new Set;s&&!this.txCount&&this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof a&&(this.optimisticData=this.optimisticData.removeLayer(a)),s&&c.size?(this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e,t){var r=s.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return r.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(t)},n.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},n.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=W(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},n.prototype.broadcastWatch=function(e,t){var n=e.lastDiff,i=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});t&&(e.optimistic&&"string"==typeof t.optimistic&&(i.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,i,n))||n&&r.equal(n.result,i.result)||e.callback(e.lastDiff=i,n)},n}(Te);function It(e){return e.hasOwnProperty("graphQLErrors")}var Pt,Mt=function(t){function r(e){var n,i,o=e.graphQLErrors,a=e.clientErrors,s=e.networkError,u=e.errorMessage,c=e.extraInfo,l=t.call(this,u)||this;return l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(ae((n=l).graphQLErrors)||ae(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+=t+"\n"})),n.networkError&&(i+=n.networkError.message+"\n"),i=i.replace(/\n$/,"")),l.extraInfo=c,l.__proto__=r.prototype,l}return e.__extends(r,t),r}(Error);function Tt(e){return!!e&&e<7}exports.NetworkStatus=void 0,(Pt=exports.NetworkStatus||(exports.NetworkStatus={}))[Pt.loading=1]="loading",Pt[Pt.setVariables=2]="setVariables",Pt[Pt.fetchMore=3]="fetchMore",Pt[Pt.refetch=4]="refetch",Pt[Pt.poll=6]="poll",Pt[Pt.ready=7]="ready",Pt[Pt.error=8]="error";var Dt=function(){function e(e,t,r,n){this.observer=e,this.options=t,this.fetch=r,this.shouldFetch=n}return e.prototype.reobserve=function(e,t){e?this.updateOptions(e):this.updatePolling();var r=this.fetch(this.options,t);return this.concast&&this.concast.removeObserver(this.observer,!0),r.addObserver(this.observer),(this.concast=r).promise},e.prototype.updateOptions=function(e){return Object.assign(this.options,ce(e)),this.updatePolling(),this},e.prototype.stop=function(){this.concast&&(this.concast.removeObserver(this.observer),delete this.concast),this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),this.options.pollInterval=0,this.updatePolling())},e.prototype.updatePolling=function(){var e=this,r=this.pollingInfo,n=this.options.pollInterval;if(n){if((!r||r.interval!==n)&&(t.invariant(n,21),!1!==this.shouldFetch)){(r||(this.pollingInfo={})).interval=n;var i=function(){e.pollingInfo&&(e.shouldFetch&&e.shouldFetch()?e.reobserve({fetchPolicy:"network-only",nextFetchPolicy:e.options.fetchPolicy||"cache-first"},exports.NetworkStatus.poll).then(o,o):o())},o=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(i,t.interval))};o()}}else r&&(clearTimeout(r.timeout),delete this.pollingInfo)},e}(),Ct=function(t){function n(r){var n=r.queryManager,i=r.queryInfo,o=r.options,a=t.call(this,(function(e){return a.onSubscribe(e)}))||this;a.observers=new Set,a.subscriptions=new Set,a.observer={next:function(e){(a.lastError||a.isDifferentFromLastResult(e))&&(a.updateLastResult(e),te(a.observers,"next",e))},error:function(t){a.updateLastResult(e.__assign(e.__assign({},a.lastResult),{error:t,errors:t.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1})),te(a.observers,"error",a.lastError=t)}},a.isTornDown=!1,a.options=o,a.queryId=n.generateQueryId();var s=P(o.query);return a.queryName=s&&s.name&&s.name.value,a.queryManager=n,a.queryInfo=i,a}return e.__extends(n,t),Object.defineProperty(n.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),n.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},n.prototype.getCurrentResult=function(t){void 0===t&&(t=!0);var r=this.lastResult,n=this.queryInfo.networkStatus||r&&r.networkStatus||exports.NetworkStatus.ready,i=e.__assign(e.__assign({},r),{loading:Tt(n),networkStatus:n});if(this.isTornDown)return i;var o=this.options.fetchPolicy,a=void 0===o?"cache-first":o;if("no-cache"===a||"network-only"===a)delete i.partial;else if(!i.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var s=this.queryInfo.getDiff();i.data=s.complete||this.options.returnPartialData?s.result:void 0,s.complete?(i.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==a&&"cache-only"!==a||(i.networkStatus=exports.NetworkStatus.ready,i.loading=!1),delete i.partial):i.partial=!0,s.complete||this.options.partialRefetch||i.loading||i.data||i.error||(i.error=new Mt({clientErrors:s.missing}))}return t&&this.updateLastResult(i),i},n.prototype.isDifferentFromLastResult=function(e){return!r.equal(this.lastResultSnapshot,e)},n.prototype.getLastResult=function(){return this.lastResult},n.prototype.getLastError=function(){return this.lastError},n.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},n.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},n.prototype.refetch=function(t){var n={pollInterval:0},i=this.options.fetchPolicy;return"no-cache"!==i&&"cache-and-network"!==i&&(n.fetchPolicy="network-only",n.nextFetchPolicy=i||"cache-first"),t&&!r.equal(this.options.variables,t)&&(n.variables=this.options.variables=e.__assign(e.__assign({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.newReobserver(!1).reobserve(n,exports.NetworkStatus.refetch)},n.prototype.fetchMore=function(t){var r=this,n=e.__assign(e.__assign({},t.query?t:e.__assign(e.__assign(e.__assign({},this.options),t),{variables:e.__assign(e.__assign({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return n.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,n,exports.NetworkStatus.fetchMore).then((function(e){var i=e.data,o=t.updateQuery;return o?r.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:n.variables})})):r.queryManager.cache.writeQuery({query:n.query,variables:n.variables,data:i}),e})).finally((function(){r.queryManager.stopQuery(i),r.reobserve()}))},n.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError&&e.onError(t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},n.prototype.setOptions=function(e){return this.reobserve(e)},n.prototype.setVariables=function(e){if(r.equal(this.variables,e))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=e,!this.observers.size)return Promise.resolve();var t=this.options.fetchPolicy,n=void 0===t?"cache-first":t,i={fetchPolicy:n,variables:e};return"cache-first"!==n&&"no-cache"!==n&&"network-only"!==n&&(i.fetchPolicy="cache-and-network",i.nextFetchPolicy=n),this.reobserve(i,exports.NetworkStatus.setVariables)},n.prototype.updateQuery=function(e){var t,r=this.queryManager,n=e(r.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(t=this.lastResult)||void 0===t?void 0:t.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});n&&(r.cache.writeQuery({query:this.options.query,data:n,variables:this.variables}),r.broadcastQueries())},n.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},n.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},n.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:Z(e),ae(e.errors)||delete this.lastError,t},n.prototype.onSubscribe=function(e){var t=this;if(e===this.observer)return function(){};try{var r=e._subscription._observer;r&&!r.error&&(r.error=jt)}catch(e){}var n=!this.observers.size;return this.observers.add(e),this.lastError?e.error&&e.error(this.lastError):this.lastResult&&e.next&&e.next(this.lastResult),n&&this.reobserve().catch((function(){})),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},n.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},n.prototype.newReobserver=function(t){var r=this,n=this.queryManager,i=this.queryId;return n.setObservableQuery(this),new Dt(this.observer,t?this.options:e.__assign({},this.options),(function(e,t){return n.setObservableQuery(r),n.fetchQueryObservable(i,e,t)}),!n.ssrMode&&function(){return!Tt(r.queryInfo.networkStatus)})},n.prototype.reobserve=function(e,t){return this.isTornDown=!1,this.getReobserver().reobserve(e,t)},n.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},n.prototype.hasObservers=function(){return this.observers.size>0},n.prototype.tearDownQuery=function(){this.isTornDown||(this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},n}(n.Observable);function jt(e){}function At(e){var t=e.fetchPolicy,r=void 0===t?"cache-first":t,n=e.nextFetchPolicy;n&&(e.nextFetchPolicy=void 0,e.fetchPolicy="function"==typeof n?n.call(e,r):n)}ne(Ct);var Nt=function(){function r(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=H(t.resolvers,e)})):this.resolvers=H(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(t){var r=t.document,n=t.remoteResult,i=t.context,o=t.variables,a=t.onlyRunForcedResolvers,s=void 0!==a&&a;return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,s).then((function(t){return e.__assign(e.__assign({},n),{data:t.result})}))]:[2,n]}))}))},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return h(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return function(e){I(e);var t=B([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=i.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return Q(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},r.prototype.prepareContext=function(t){var r=this.cache;return e.__assign(e.__assign({},t),{cache:r,getCacheKey:function(e){return r.identify(e)}})},r.prototype.addExportedVariables=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,r)||{},this.prepareContext(n),r).then((function(t){return e.__assign(e.__assign({},r),t.exportedVariables)}))]:[2,e.__assign({},r)]}))}))},r.prototype.shouldForceResolvers=function(e){var t=!1;return i.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return i.BREAK}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:K(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(t,r,n,i,o,a){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),e.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,p,h,d,v;return e.__generator(this,(function(m){return s=D(t),u=T(t),c=y(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,d=p.client,v={fragmentMap:c,context:e.__assign(e.__assign({},n),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,r,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},r.prototype.resolveSelectionSet=function(r,n,i){return e.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return e.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[n],c=function(r){return e.__awaiter(l,void 0,void 0,(function(){var c,l;return e.__generator(this,(function(e){return p(r,s)?Q(r)?[2,this.resolveField(r,n,i).then((function(e){var t;void 0!==e&&u.push(((t={})[q(r)]=e,t))}))]:(F(r)?c=r:(c=o[r.name.value],t.invariant(c,12)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,a))?[2,this.resolveSelectionSet(c.selectionSet,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(r.selections.map(c)).then((function(){return Y(u)}))]}))}))},r.prototype.resolveField=function(t,r,n){return e.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,p,h=this;return e.__generator(this,(function(e){return i=n.variables,o=t.name.value,a=q(t),s=o!==a,u=r[a]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(l=r.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?o:a])&&(c=Promise.resolve(ft.withValue(this.cache,p,[r,E(t,i),n.context,{field:t,fragmentMap:n.fragmentMap}])))),[2,c.then((function(e){return void 0===e&&(e=u),t.directives&&t.directives.forEach((function(t){"export"===t.name.value&&t.arguments&&t.arguments.forEach((function(t){"as"===t.name.value&&"StringValue"===t.value.kind&&(n.exportedVariables[t.value.value]=e)}))})),t.selectionSet?null==e?e:Array.isArray(e)?h.resolveSubSelectedArray(t,e,n):t.selectionSet?h.resolveSelectionSet(t.selectionSet,e,n):void 0:e}))]}))}))},r.prototype.resolveSubSelectedArray=function(e,t,r){var n=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?n.resolveSubSelectedArray(e,t,r):e.selectionSet?n.resolveSelectionSet(e.selectionSet,t,r):void 0})))},r}(),Lt=new(ue?WeakMap:Map);function Vt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Lt.set(e,(Lt.get(e)+1)%1e15),r.apply(this,arguments)})}function Bt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Wt=function(){function t(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null,Lt.has(e)||(Lt.set(e,0),Vt(e,"evict"),Vt(e,"modify"),Vt(e,"reset"))}return t.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!r.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),r.equal(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){Bt(this),this.lastDiff=void 0,this.dirty=!1},t.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&r.equal(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&"no-cache"===n.options.fetchPolicy)return{complete:!1};var i=this.cache.diff(t);return this.updateLastDiff(i,t),i},t.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:this.canonize()}},t.prototype.setDiff=function(e){var t=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||r.equal(n&&n.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},t.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():e.reobserve()})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Bt(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Tt(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(t){var n=this;void 0===t&&(t=this.variables);var i=this.observableQuery;if(!i||"no-cache"!==i.options.fetchPolicy){var o=e.__assign(e.__assign({},this.getDiffOptions(t)),{watcher:this,callback:function(e){return n.setDiff(e)}});this.lastWatch&&r.equal(o,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=o))}},t.prototype.canonize=function(){var e=this.observableQuery;return!e||!1!==e.options.canonizeResults},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===Lt.get(this.cache)&&r.equal(t,n.variables)&&r.equal(e.data,n.result.data))},t.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=ae(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(t.variables)):this.stopped||0===r||(zt(e,t.errorPolicy)?this.cache.performTransaction((function(i){if(n.shouldWrite(e,t.variables))i.writeQuery({query:n.document,data:e.data,variables:t.variables,overwrite:1===r}),n.lastWrite={result:e,variables:t.variables,dmCount:Lt.get(n.cache)};else if(n.lastDiff&&n.lastDiff.diff.complete)return void(e.data=n.lastDiff.diff.result);var o=n.getDiffOptions(t.variables),a=i.diff(o);n.stopped||n.updateWatch(t.variables),n.updateLastDiff(a,o),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},t.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function zt(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!se(e);return!n&&r&&e.data&&(n=!0),n}var Ut=Object.prototype.hasOwnProperty,Kt=function(){function r(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(ue?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Nt({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!f,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new t.InvariantError(13))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},r.prototype.mutate=function(r){var n=r.mutation,i=r.variables,o=r.optimisticResponse,a=r.updateQueries,s=r.refetchQueries,u=void 0===s?[]:s,c=r.awaitRefetchQueries,l=void 0!==c&&c,f=r.update,p=r.onQueryUpdated,h=r.errorPolicy,d=void 0===h?"none":h,v=r.fetchPolicy,y=r.keepRootFields,m=r.context;return e.__awaiter(this,void 0,void 0,(function(){var r,s,c;return e.__generator(this,(function(h){switch(h.label){case 0:return t.invariant(n,14),t.invariant(!v||"no-cache"===v,15),r=this.generateMutationId(),n=this.transform(n).document,i=this.getVariables(n,i),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,i,m)]:[3,2];case 1:i=h.sent(),h.label=2;case 2:return s=this.mutationStore&&(this.mutationStore[r]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:r,document:n,variables:i,fetchPolicy:v,errorPolicy:d,context:m,updateQueries:a,update:f,keepRootFields:y}),this.broadcastQueries(),c=this,[2,new Promise((function(t,h){return re(c.getObservableFromLink(n,e.__assign(e.__assign({},m),{optimisticResponse:o}),i,!1),(function(t){if(se(t)&&"none"===d)throw new Mt({graphQLErrors:t.errors});s&&(s.loading=!1,s.error=null);var h=e.__assign({},t);return"function"==typeof u&&(u=u(h)),"ignore"===d&&se(h)&&delete h.errors,c.markMutationResult({mutationId:r,result:h,document:n,variables:i,fetchPolicy:v,errorPolicy:d,context:m,update:f,updateQueries:a,awaitRefetchQueries:l,refetchQueries:u,removeOptimistic:o?r:void 0,onQueryUpdated:p,keepRootFields:y})})).subscribe({next:function(e){c.broadcastQueries(),t(e)},error:function(e){s&&(s.loading=!1,s.error=e),o&&c.cache.removeOptimistic(r),c.broadcastQueries(),h(e instanceof Mt?e:new Mt({networkError:e}))}})}))]}}))}))},r.prototype.markMutationResult=function(t,r){var n=this;void 0===r&&(r=this.cache);var i=t.result,o=[],a="no-cache"===t.fetchPolicy;if(!a&&zt(i,t.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables});var s=t.updateQueries;s&&this.queries.forEach((function(e,t){var a=e.observableQuery,u=a&&a.queryName;if(u&&Ut.call(s,u)){var c=s[u],l=n.queries.get(t),f=l.document,p=l.variables,h=r.diff({query:f,variables:p,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&M(f)||void 0,queryVariables:p});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:p})}}}))}if(o.length>0||t.refetchQueries||t.update||t.onQueryUpdated||t.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(r){a||o.forEach((function(e){return r.write(e)}));var s=t.update;if(s){if(!a){var u=r.diff({id:"ROOT_MUTATION",query:n.transform(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0});u.complete&&(i=e.__assign(e.__assign({},i),{data:u.result}))}s(r,i,{context:t.context,variables:t.variables})}a||t.keepRootFields||r.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:t.refetchQueries,optimistic:!1,removeOptimistic:t.removeOptimistic,onQueryUpdated:t.onQueryUpdated||null}).forEach((function(e){return u.push(e)})),t.awaitRefetchQueries||t.onQueryUpdated)return Promise.all(u).then((function(){return i}))}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(t,r){var n=this,i="function"==typeof t?t(r.variables):t;return this.cache.recordOptimisticTransaction((function(t){try{n.markMutationResult(e.__assign(e.__assign({},r),{result:{data:i}}),t)}catch(e){}}),r.mutationId)},r.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(t){var r,n=this.transformCache;if(!n.has(t)){var i=this.cache.transformDocument(t),o=(r=this.cache.transformForLink(i),B([z],I(r))),a=this.localState.clientQuery(i),s=o&&this.localState.serverQuery(o),u={document:i,hasClientExports:d(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:C(P(i)),asQuery:e.__assign(e.__assign({},i),{definitions:i.definitions.map((function(t){return"OperationDefinition"===t.kind&&"query"!==t.operation?e.__assign(e.__assign({},t),{operation:"query"}):t}))})},c=function(e){e&&!n.has(e)&&n.set(e,u)};c(t),c(i),c(a),c(s)}return n.get(t)},r.prototype.getVariables=function(t,r){return e.__assign(e.__assign({},this.transform(t).defaultVars),r)},r.prototype.watchQuery=function(t){void 0===(t=e.__assign(e.__assign({},t),{variables:this.getVariables(t.query,t.variables)})).notifyOnNetworkStatusChange&&(t.notifyOnNetworkStatusChange=!1);var r=new Wt(this.cache),n=new Ct({queryManager:this,queryInfo:r,options:t});return this.queries.set(n.queryId,r),r.init({document:t.query,observableQuery:n,variables:t.variables}),n},r.prototype.query=function(e,r){var n=this;return void 0===r&&(r=this.generateQueryId()),t.invariant(e.query,16),t.invariant("Document"===e.query.kind,17),t.invariant(!e.returnPartialData,18),t.invariant(!e.pollInterval,19),this.fetchQuery(r,e).finally((function(){return n.stopQuery(r)}))},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(){return this.cancelPendingFetches(new t.InvariantError(20)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},r.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},r.prototype.getObservableQueries=function(t){var r=this;void 0===t&&(t="active");var n=new Map,i=new Map,o=new Set;return Array.isArray(t)&&t.forEach((function(e){var t;"string"==typeof e||g(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?i.set(e,!1):g(e)&&e.query&&o.add(e)})),this.queries.forEach((function(e,r){var o=e.observableQuery,a=e.document;if(o){if("all"===t)return void n.set(r,o);var s=o.queryName;if("standby"===o.options.fetchPolicy||!o.hasObservers())return;("active"===t||s&&i.has(s)||a&&i.has(a))&&(n.set(r,o),s&&i.set(s,!0),a&&i.set(a,!0))}})),o.size&&o.forEach((function(t){var i=fe("legacyOneTimeQuery"),o=r.getQuery(i).init({document:t.query,variables:t.variables}),a=new Ct({queryManager:r,queryInfo:o,options:e.__assign(e.__assign({},t),{fetchPolicy:"network-only"})});o.setObservableQuery(a),n.set(i,a)})),n},r.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,i=e.fetchPolicy,o=e.errorPolicy,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(n){if("no-cache"!==i&&(zt(n,o)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),se(n))throw new Mt({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new n.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(t,r,i,o){var a,s,u=this;void 0===o&&(o=null!==(a=null==r?void 0:r.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(t).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:i,operationName:M(c)||void 0,context:this.prepareContext(e.__assign(e.__assign({},r),{forceFetch:!o}))};if(r=p.context,o){var h=l.get(c)||new Map;l.set(c,h);var d=Ze(i);if(!(s=h.get(d))){var v=new oe([Se(f,p)]);h.set(d,s=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else s=new oe([Se(f,p)])}else s=new oe([n.Observable.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(t).clientQuery;return y&&(s=re(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:i})}))),s},r.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId();return re(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=ae(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Mt({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=It(t)?t:new Mt({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},r.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),a=this.getQuery(e),s=t.fetchPolicy,u=void 0===s?"cache-first":s,c=t.errorPolicy,l=void 0===c?"none":c,f=t.returnPartialData,p=void 0!==f&&f,h=t.notifyOnNetworkStatusChange,d=void 0!==h&&h,v=t.context,y=void 0===v?{}:v,m=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:l,returnPartialData:p,notifyOnNetworkStatusChange:d,context:y}),g=function(e){return m.variables=e,n.fetchQueryByPolicy(a,m,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return b.cancel(e)}))}));var b=new oe(this.transform(m.query).hasClientExports?this.localState.addExportedVariables(m.query,m.variables,m.context).then(g):g(m.variables));return b.cleanup((function(){n.fetchCancelFns.delete(e),At(t)})),b},r.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?fe("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Wt&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),!1}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},r.prototype.fetchQueryByPolicy=function(t,r,i){var o=this,a=r.query,s=r.variables,u=r.fetchPolicy,c=r.refetchWritePolicy,l=r.errorPolicy,f=r.returnPartialData,p=r.context,h=r.notifyOnNetworkStatusChange,d=t.networkStatus;t.init({document:a,variables:s,networkStatus:i});var v=function(){return t.getDiff(s)},y=function(r,i){void 0===i&&(i=t.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(t){return n.Observable.of(e.__assign({data:t,loading:Tt(i),networkStatus:i},r.complete?null:{partial:!0}))};return u&&o.transform(a).hasForcedResolvers?o.localState.runResolvers({document:a,remoteResult:{data:u},context:p,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:i===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return o.getResultsFromLink(t,m,{variables:s,context:p,fetchPolicy:u,errorPolicy:l})},b=h&&"number"==typeof d&&d!==i&&Tt(i);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,t.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),t.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(t.getDiff()),g()]:[g()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Wt(this.cache)),this.queries.get(e)},r.prototype.prepareContext=function(t){void 0===t&&(t={});var r=this.localState.prepareContext(t);return e.__assign(e.__assign({},r),{clientAwareness:this.clientAwareness})},r}();function Jt(t,r){return ce(t,r,r.variables&&{variables:e.__assign(e.__assign({},t.variables),r.variables)})}var Ht=function(){function r(e){var r=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,a=e.cache,s=e.ssrMode,u=void 0!==s&&s,c=e.ssrForceFetchDelay,l=void 0===c?0:c,f=e.connectToDevTools,p=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,h=e.queryDeduplication,d=void 0===h||h,v=e.defaultOptions,y=e.assumeImmutableResults,m=void 0!==y&&y,g=e.resolvers,b=e.typeDefs,_=e.fragmentMatcher,w=e.name,S=e.version,O=e.link;if(O||(O=n?new Me({uri:n,credentials:i,headers:o}):me.empty()),!a)throw new t.InvariantError(10);this.link=O,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=b,l&&setTimeout((function(){return r.disableNetworkFetches=!1}),l),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),p&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.4.0-rc.7",this.localState=new Nt({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Kt({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:S},localState:this.localState,assumeImmutableResults:m,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=Jt(this.defaultOptions.watchQuery,t)),!this.disableNetworkFetches||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t=e.__assign(e.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(t)},r.prototype.query=function(r){return this.defaultOptions.query&&(r=Jt(this.defaultOptions.query,r)),t.invariant("cache-and-network"!==r.fetchPolicy,11),this.disableNetworkFetches&&"network-only"===r.fetchPolicy&&(r=e.__assign(e.__assign({},r),{fetchPolicy:"cache-first"})),this.queryManager.query(r)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Jt(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},r.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Se(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i},r.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();t.setVerbosity("log"),exports.setLogVerbosity=t.setVerbosity,exports.Observable=n.Observable,exports.disableExperimentalFragmentVariables=u.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=u.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=u.enableExperimentalFragmentVariables,exports.gql=u.gql,exports.resetCaches=u.resetCaches,exports.ApolloCache=Te,exports.ApolloClient=Ht,exports.ApolloError=Mt,exports.ApolloLink=me,exports.HttpLink=Me,exports.InMemoryCache=Ft,exports.MissingFieldError=De,exports.ObservableQuery=Ct,exports.__DEV__=f,exports.applyNextFetchPolicy=At,exports.checkFetcher=Re,exports.concat=we,exports.createHttpLink=Pe,exports.createSignalIfSupported=Qe,exports.defaultDataIdFromObject=mt,exports.empty=ge,exports.execute=Se,exports.fallbackHttpConfig=Ee,exports.from=be,exports.fromError=pe,exports.fromPromise=function(e){return new n.Observable((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.isApolloError=It,exports.isReference=_,exports.makeReference=b,exports.makeVar=dt,exports.mergeOptions=Jt,exports.parseAndCheckHttpResponse=ke,exports.rewriteURIForGET=Ie,exports.selectHttpOptionsAndBody=qe,exports.selectURI=Fe,exports.serializeFetchParameter=xe,exports.split=_e,exports.throwServerError=he,exports.toPromise=function(e){var t=!1;return new Promise((function(r,n){e.subscribe({next:function(e){t||(t=!0,r(e))},error:n})}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ts-invariant"),t=require("ts-invariant/process"),r=require("graphql"),n=require("tslib"),i=require("@wry/equality"),o=require("zen-observable-ts");require("symbol-observable");var a=require("optimism"),s=require("@wry/context"),u=require("@wry/trie"),c=require("graphql-tag");function l(e){try{return e()}catch(e){}}var f=l((function(){return globalThis}))||l((function(){return window}))||l((function(){return self}))||l((function(){return global}))||l((function(){return Function("return this")()})),p="__",h=[p,p].join("DEV");var d=function(){try{return Boolean(!1)}catch(e){return Object.defineProperty(f,h,{value:"production"!==l((function(){return process.env.NODE_ENV})),enumerable:!1,configurable:!0,writable:!0}),f[h]}}();function v(t,r){var n=t.directives;return!n||!n.length||function(t){var r=[];t&&t.length&&t.forEach((function(t){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(t)){var n=t.arguments;t.name.value;e.invariant(n&&1===n.length,44);var i=n[0];e.invariant(i.name&&"if"===i.name.value,45);var o=i.value;e.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),46),r.push({directive:t,ifArgument:i})}}));return r}(n).every((function(t){var n=t.directive,i=t.ifArgument,o=!1;return"Variable"===i.value.kind?(o=r&&r[i.value.name.value],e.invariant(void 0!==o,43)):o=i.value.value,"skip"===n.name.value?!o:o}))}function y(e,t){return function(e){var t=[];return r.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function m(e){return e&&y(["client"],e)&&y(["export"],e)}function g(t,r){var i=r,o=[];return t.definitions.forEach((function(t){if("OperationDefinition"===t.kind)throw new e.InvariantError(47);"FragmentDefinition"===t.kind&&o.push(t)})),void 0===i&&(e.invariant(1===o.length,48),i=o[0].name.value),n.__assign(n.__assign({},t),{definitions:n.__spreadArray([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],t.definitions)})}function b(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function _(t,r){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":var n=r&&r[t.name.value];return e.invariant(n,49),n;default:return null}}function w(e){return null!==e&&"object"==typeof e}function S(e){return{__ref:String(e)}}function O(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function k(t,r,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))t[r.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))t[r.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return k(o,e.name,e.value,i)})),t[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];t[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))t[r.value]=n.values.map((function(e){var t={};return k(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))t[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new e.InvariantError(58);t[r.value]=null}}r.isType(null),t.remove();var x=["connection","include","skip","client","rest","export"],E=Object.assign((function(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach((function(e){i[e]=t[e]})),r.connection.key+"("+q(i)+")"}return r.connection.key}var o=e;if(t){var a=q(t);o+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===x.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@"+e+"("+q(r[e])+")":o+="@"+e)})),o}),{setStringify:function(e){var t=q;return q=e,t}}),q=function(e){return JSON.stringify(e,R)};function R(e,t){return w(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function Q(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return k(r,n,i,t)})),r}return null}function I(e){return e.alias?e.alias.value:e.name.value}function F(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(M(o)){if("__typename"===o.name.value)return e[I(o)]}else{var a=F(e,_(o,r).selectionSet,r);if("string"==typeof a)return a}}}function M(e){return"Field"===e.kind}function P(e){return"InlineFragment"===e.kind}function T(t){e.invariant(t&&"Document"===t.kind,50);var r=t.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(t){if("OperationDefinition"!==t.kind)throw new e.InvariantError(51);return t}));return e.invariant(r.length<=1,52),t}function C(e){return T(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function D(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function j(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function A(t){var r;T(t);for(var n=0,i=t.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new e.InvariantError(57)}function N(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&k(t,e.variable.name,e.defaultValue)})),t}function L(e,t,r){var n=0;return e.forEach((function(r,i){t.call(this,r,i,e)&&(e[n++]=r)}),r),e.length=n,e}var V={kind:"Field",name:{kind:"Name",value:"__typename"}};function B(e,t){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&B(t[e.name.value],t)}))}function W(t){return B(C(t)||function(t){e.invariant("Document"===t.kind,54),e.invariant(t.definitions.length<=1,55);var r=t.definitions[0];return e.invariant("FragmentDefinition"===r.kind,56),r}(t),b(j(t)))?null:t}function z(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function U(e,t){var i=Object.create(null),o=[],a=Object.create(null),s=[],u=W(r.visit(t,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(i[e.name.value]=!0)}},Field:{enter:function(t){if(e&&t.directives&&(e.some((function(e){return e.remove}))&&t.directives&&t.directives.some(z(e))))return t.arguments&&t.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),t.selectionSet&&H(t.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(t){if(z(e)(t))return null}}}));return u&&L(o,(function(e){return!!e.name&&!i[e.name]})).length&&(u=function(e,t){var i=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(e);return W(r.visit(t,{OperationDefinition:{enter:function(t){return n.__assign(n.__assign({},t),{variableDefinitions:t.variableDefinitions?t.variableDefinitions.filter((function(t){return!e.some((function(e){return e.name===t.variable.name.value}))})):[]})}},Field:{enter:function(t){if(e.some((function(e){return e.remove}))){var r=0;if(t.arguments&&t.arguments.forEach((function(e){i(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}(o,u)),u&&L(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function n(t){if(e.some((function(e){return e.name===t.name.value})))return null}return W(r.visit(t,{FragmentSpread:{enter:n},FragmentDefinition:{enter:n}}))}(s,u)),u}var K=Object.assign((function(e){return r.visit(T(e),{SelectionSet:{enter:function(e,t,r){if(!r||"OperationDefinition"!==r.kind){var i=e.selections;if(i)if(!i.some((function(e){return M(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=r;if(!(M(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return n.__assign(n.__assign({},e),{selections:n.__spreadArray(n.__spreadArray([],i),[V])})}}}}})}),{added:function(e){return e===V}}),J={test:function(e){var t="connection"===e.name.value;return t&&(!e.arguments||e.arguments.some((function(e){return"key"===e.name.value}))),t}};function H(e){var t=[];return e.selections.forEach((function(e){(M(e)||P(e))&&e.selectionSet?H(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function Y(e){return"query"===A(e).operation?e:r.visit(e,{OperationDefinition:{enter:function(e){return n.__assign(n.__assign({},e),{operation:"query"})}}})}var G=Object.prototype.hasOwnProperty;function $(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return X(e)}function X(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new ee,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var Z=function(e,t,r){return this.merge(e[r],t[r])},ee=function(){function e(e){void 0===e&&(e=Z),this.reconciler=e,this.isObject=w,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var r=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return w(t)&&w(e)?(Object.keys(t).forEach((function(o){if(G.call(e,o)){var a=e[o];if(t[o]!==a){var s=r.reconciler.apply(r,n.__spreadArray([e,t,o],i));s!==a&&((e=r.shallowCopyForMerge(e))[o]=s)}}else(e=r.shallowCopyForMerge(e))[o]=t[o]})),e):t},e.prototype.shallowCopyForMerge=function(e){return w(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}(),te=Object.prototype.toString;function re(e){return ne(e)}function ne(e,t){switch(te.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=ne(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=ne(e[r],t)})),n;default:return e}}function ie(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function oe(e,t,r){return new o.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}function ae(e){function t(t){Object.defineProperty(e,t,{value:o.Observable})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function se(e){return e&&"function"==typeof e.then}var ue=function(e){function t(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],ie(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&Promise.resolve().then((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),ie(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?se(e)?e.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=e.subscribe(r.handlers):(r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),ie(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new o.Observable(t)]),se(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return n.__extends(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},t.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},t.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},t}(o.Observable);function ce(e){return Array.isArray(e)&&e.length>0}function le(e){return e.errors&&e.errors.length>0||!1}ae(ue);var fe="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),pe="function"==typeof WeakSet;function he(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}var de=new Map;function ve(e){var t=de.get(e)||1;return de.set(e,t+1),e+":"+t+":"+Math.random().toString(36).slice(2)}function ye(e){return new o.Observable((function(t){t.error(e)}))}e.invariant("boolean"==typeof d,59);var me=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n};function ge(e,t){return t?t(e):o.Observable.of()}function be(e){return"function"==typeof e?new we(e):e}function _e(e){return e.request.length<=1}!function(e){function t(t,r){var n=e.call(this,t)||this;return n.link=r,n}n.__extends(t,e)}(Error);var we=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t((function(){return o.Observable.of()}))},t.from=function(e){return 0===e.length?t.empty():e.map(be).reduce((function(e,t){return e.concat(t)}))},t.split=function(e,r,n){var i=be(r),a=be(n||new t(ge));return _e(i)&&_e(a)?new t((function(t){return e(t)?i.request(t)||o.Observable.of():a.request(t)||o.Observable.of()})):new t((function(t,r){return e(t)?i.request(t,r)||o.Observable.of():a.request(t,r)||o.Observable.of()}))},t.execute=function(t,r){return t.request(function(e,t){var r=n.__assign({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r="function"==typeof e?n.__assign(n.__assign({},r),e(r)):n.__assign(n.__assign({},r),e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return n.__assign({},r)}}),t}(r.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?D(t.query)||void 0:""),t}(function(t){for(var r=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];if(r.indexOf(o)<0)throw new e.InvariantError(29)}return t}(r))))||o.Observable.of()},t.concat=function(e,r){var n=be(e);if(_e(n))return n;var i=be(r);return _e(i)?new t((function(e){return n.request(e,(function(e){return i.request(e)||o.Observable.of()}))||o.Observable.of()})):new t((function(e,t){return n.request(e,(function(e){return i.request(e,t)||o.Observable.of()}))||o.Observable.of()}))},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(ge)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(t,r){throw new e.InvariantError(23)},t.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}(),Se=we.empty,Oe=we.from,ke=we.split,xe=we.concat,Ee=we.execute,qe=Object.prototype.hasOwnProperty;function Re(e){return function(t){return t.text().then((function(e){try{return JSON.parse(e)}catch(n){var r=n;throw r.name="ServerParseError",r.response=t,r.statusCode=t.status,r.bodyText=e,r}})).then((function(r){return t.status>=300&&me(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||qe.call(r,"data")||qe.call(r,"errors")||me(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var Qe=function(t,r){var n;try{n=JSON.stringify(t)}catch(t){var i=new e.InvariantError(26);throw i.parseError=t,i}return n},Ie={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Fe=function(e,t){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var a=n.__assign(n.__assign({},t.options),{headers:t.headers,credentials:t.credentials}),s=t.http||{};i.forEach((function(e){a=n.__assign(n.__assign(n.__assign({},a),e.options),{headers:n.__assign(n.__assign({},a.headers),Me(e.headers))}),e.credentials&&(a.credentials=e.credentials),s=n.__assign(n.__assign({},s),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,f=e.query,p={operationName:u,variables:l};return s.includeExtensions&&(p.extensions=c),s.includeQuery&&(p.query=r.print(f)),{options:a,body:p}};function Me(e){if(e){var t=Object.create(null);return Object.keys(Object(e)).forEach((function(r){t[r.toLowerCase()]=e[r]})),t}return e}var Pe=function(t){if(!t&&"undefined"==typeof fetch)throw new e.InvariantError(25)},Te=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},Ce=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function De(e,t){var r=[],n=function(e,t){r.push(e+"="+encodeURIComponent(t))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=Qe(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Qe(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var je=function(e){void 0===e&&(e={});var t=e.uri,i=void 0===t?"/graphql":t,a=e.fetch,s=e.includeExtensions,u=e.useGETForQueries,c=e.includeUnusedVariables,l=void 0!==c&&c,f=n.__rest(e,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);Pe(a),a||(a=fetch);var p={http:{includeExtensions:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new we((function(e){var t=Ce(e,i),s=e.getContext(),c={};if(s.clientAwareness){var f=s.clientAwareness,h=f.name,d=f.version;h&&(c["apollographql-client-name"]=h),d&&(c["apollographql-client-version"]=d)}var v,y=n.__assign(n.__assign({},c),s.headers),m={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:y},g=Fe(e,Ie,p,m),b=g.options,_=g.body;if(_.variables&&!l){var w=new Set(Object.keys(_.variables));r.visit(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&w.delete(e.name.value)}}),w.size&&(_.variables=n.__assign({},_.variables),w.forEach((function(e){delete _.variables[e]})))}if(!b.signal){var S=Te(),O=S.controller,k=S.signal;(v=O)&&(b.signal=k)}if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(b.method="GET"),"GET"===b.method){var x=De(t,_),E=x.newURI,q=x.parseError;if(q)return ye(q);t=E}else try{b.body=Qe(_)}catch(q){return ye(q)}return new o.Observable((function(r){return a(t,b).then((function(t){return e.setContext({response:t}),t})).then(Re(e)).then((function(e){return r.next(e),r.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&r.next(e.result),r.error(e))})),function(){v&&v.abort()}}))}))},Ae=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,je(t).request)||this;return r.options=t,r}return n.__extends(t,e),t}(we),Ne=function(){function e(){this.getFragmentDoc=a.wrap(g)}return e.prototype.batch=function(e){var t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;this.performTransaction(e.update,t)},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,r=e.data,i=n.__rest(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:r}))},e.prototype.writeFragment=function(e){var t=e.id,r=e.data,i=e.fragment,o=e.fragmentName,a=n.__rest(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:t,result:r}))},e}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var Le=function(e){function t(r,n,i,o){var a=e.call(this,r)||this;return a.message=r,a.path=n,a.query=i,a.variables=o,a.__proto__=t.prototype,a}return n.__extends(t,e),t}(Error),Ve=Object.prototype.hasOwnProperty;var Be=/^[_a-z][_0-9a-z]*/i;function We(e){var t=e.match(Be);return t?t[0]:e}function ze(e,t,r){return!!w(t)&&(Array.isArray(t)?t.every((function(t){return ze(e,t,r)})):e.selections.every((function(e){if(M(e)&&v(e,r)){var n=I(e);return Ve.call(t,n)&&(!e.selectionSet||ze(e.selectionSet,t[n],r))}return!0})))}function Ue(e){return w(e)&&!O(e)&&!Array.isArray(e)}var Ke=Object.create(null),Je=function(){return Ke},He=Object.create(null),Ye=function(){function t(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return O(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return O(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return S(e);if(O(e))return e;var n=r.policies.identify(e)[0];if(n){var i=S(n);return t&&r.merge(n,e),i}}}return t.prototype.toObject=function(){return n.__assign({},this.data)},t.prototype.has=function(e){return void 0!==this.lookup(e,!0)},t.prototype.get=function(e,t){if(this.group.depend(e,t),Ve.call(this.data,e)){var r=this.data[e];if(r&&Ve.call(r,t))return r[t]}return"__typename"===t&&Ve.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ze?this.parent.get(e,t):void 0},t.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Ve.call(this.data,e)?this.data[e]:this instanceof Ze?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},t.prototype.merge=function(t,r){var n,i=this;O(t)&&(t=t.__ref),O(r)&&(r=r.__ref);var o="string"==typeof t?this.lookup(n=t):t,a="string"==typeof r?this.lookup(n=r):r;if(a){e.invariant("string"==typeof n,2);var s=new ee(tt).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=We(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof Ze||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},t.prototype.modify=function(e,t){var r=this,i=this.lookup(e);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:Ke,INVALIDATE:He,isReference:O,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||S(e)}:t,{store:r})}};if(Object.keys(i).forEach((function(c){var l=We(c),f=i[c];if(void 0!==f){var p="function"==typeof t?t:t[c]||t[l];if(p){var h=p===Je?Ke:p(f,n.__assign(n.__assign({},u),{fieldName:l,storeFieldName:c,storage:r.getStorage(e,c)}));h===He?r.group.dirty(e,c):(h===Ke&&(h=void 0),h!==f&&(o[c]=h,a=!0,f=h))}void 0!==f&&(s=!1)}})),a)return this.merge(e,o),s&&(this instanceof Ze?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=Je,n):Je)}return!1},t.prototype.evict=function(e){var t=!1;return e.id&&(Ve.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof Ze&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){Ve.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},t.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(r){e&&Ve.call(e,r)||t.delete(r)})),e){var r=e.__META,i=n.__rest(e,["__META"]);Object.keys(i).forEach((function(e){t.merge(e,i[e])})),r&&r.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},t.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ze?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){Ve.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Ze;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},t.prototype.findChildRefIds=function(e){if(!Ve.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){O(e)&&(t[e.__ref]=!0),w(e)&&Object.keys(e).forEach((function(t){var r=e[t];w(r)&&n.add(r)}))}))}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}(),Ge=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?a.dep():null,this.keyMaker=new u.Trie(fe)},e.prototype.depend=function(e,t){if(this.d){this.d($e(e,t));var r=We(t);r!==t&&this.d($e(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty($e(e,t),"__exists"===t?"forget":"setDirty")},e}();function $e(e,t){return t+"#"+e}function Xe(e,t){rt(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,a=e.call(this,r,new Ge(i))||this;return a.stump=new et(a),a.storageTrie=new u.Trie(fe),o&&a.replace(o),a}return n.__extends(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}(Ye||(Ye={}));var Ze=function(e){function t(t,r,n,i){var o=e.call(this,r.policies,i)||this;return o.id=t,o.parent=r,o.replay=n,o.group=i,n(o),o}return n.__extends(t,e),t.prototype.addLayer=function(e,r){return new t(e,this,r,this.group)},t.prototype.removeLayer=function(e){var t=this,r=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var n=t.data[e],o=r.lookup(e);o?n?n!==o&&Object.keys(n).forEach((function(r){i.equal(n[r],o[r])||t.group.dirty(e,r)})):(t.group.dirty(e,"__exists"),Object.keys(o).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return n.__assign(n.__assign({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return Ve.call(this.data,t)?n.__assign(n.__assign({},r),e.prototype.findChildRefIds.call(this,t)):r},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(Ye),et=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new Ge(t.group.caching,t.group))||this}return n.__extends(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},t}(Ze);function tt(e,t,r){var n=e[r],o=t[r];return i.equal(n,o)?n:o}function rt(e){return!!(e instanceof Ye&&e.group.caching)}var nt,it,ot=function(){function e(){this.known=new(pe?WeakSet:Set),this.pool=new u.Trie(fe),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return w(e)&&this.known.has(e)},e.prototype.pass=function(e){if(w(e)){var t=function(e){return w(e)?Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(w(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},e}(),at=Object.assign((function(e){if(w(e)){void 0===nt&&st();var t=nt.admit(e),r=it.get(t);return void 0===r&&it.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:st});function st(){nt=new ot,it=new(fe?WeakMap:Map)}function ut(e,t){return new Le(e.message,t.path.slice(),t.query,t.variables)}function ct(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var lt=function(){function t(e){var t=this;this.knownResults=new(fe?WeakMap:Map),this.config=n.__assign(n.__assign({},e),{addTypename:!1!==e.addTypename}),this.canon=e.canon||new ot,this.executeSelectionSet=a.wrap((function(e){var r,i=e.context.canonizeResults,o=ct(e);o[3]=!i;var a=(r=t.executeSelectionSet).peek.apply(r,o);return a?i?n.__assign(n.__assign({},a),{result:t.canon.admit(a.result)}):a:(Xe(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:ct,makeCacheKey:function(e,t,r,n){if(rt(r.store))return r.store.makeCacheKey(e,O(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=a.wrap((function(e){return Xe(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(rt(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return t.prototype.resetCanon=function(){this.canon=new ot},t.prototype.diffQueryAgainstStore=function(t){var r,i=t.store,o=t.query,a=t.rootId,s=void 0===a?"ROOT_QUERY":a,u=t.variables,c=t.returnPartialData,l=void 0===c||c,f=t.canonizeResults,p=void 0===f||f,h=this.config.cache.policies;u=n.__assign(n.__assign({},N((r=C(o),e.invariant(r&&"query"===r.operation,53),r))),u);var d=S(s),v=this.executeSelectionSet({selectionSet:A(o).selectionSet,objectOrReference:d,enclosingRef:d,context:{store:i,query:o,policies:h,variables:u,varString:at(u),canonizeResults:p,fragmentMap:b(j(o)),path:[]}}),y=v.missing&&v.missing.length>0;if(y&&!l)throw v.missing[0];return{result:v.result,missing:v.missing,complete:!y}},t.prototype.isFresh=function(e,t,r,n){if(rt(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(t){var r=this,n=t.selectionSet,i=t.objectOrReference,o=t.enclosingRef,a=t.context;if(O(i)&&!a.policies.rootTypenamesById[i.__ref]&&!a.store.has(i.__ref))return{result:this.canon.empty,missing:[ut(new e.InvariantError(6),a)]};var s=a.variables,u=a.policies,c=a.store,l=[],f={result:null},p=c.getFieldValue(i,"__typename");function h(){return f.missing||(f.missing=[])}function d(e){var t;return e.missing&&(t=h()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof p&&!u.rootIdsByTypename[p]&&l.push({__typename:p});var y=new Set(n.selections);y.forEach((function(t){var n;if(v(t,s))if(M(t)){var c=u.readField({fieldName:t.name.value,field:t,variables:a.variables,from:i},a),f=I(t);a.path.push(f),void 0===c?K.added(t)||h().push(ut(new e.InvariantError(7),a)):Array.isArray(c)?c=d(r.executeSubSelectedArray({field:t,array:c,enclosingRef:o,context:a})):t.selectionSet?null!=c&&(c=d(r.executeSelectionSet({selectionSet:t.selectionSet,objectOrReference:c,enclosingRef:O(c)?c:o,context:a}))):a.canonizeResults&&(c=r.canon.pass(c)),void 0!==c&&l.push(((n={})[f]=c,n)),e.invariant(a.path.pop()===f)}else{var m=_(t,a.fragmentMap);m&&u.fragmentMatches(m,p)&&m.selectionSet.selections.forEach(y.add,y)}}));var m=X(l);return f.result=a.canonizeResults?this.canon.admit(m):m,this.knownResults.set(f.result,n),f},t.prototype.execSubSelectedArrayImpl=function(t){var r,n=this,i=t.field,o=t.array,a=t.enclosingRef,s=t.context;function u(t,n){return t.missing&&(r=r||[]).push.apply(r,t.missing),e.invariant(s.path.pop()===n),t.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),o=o.map((function(t,r){return null===t?null:(s.path.push(r),Array.isArray(t)?u(n.executeSubSelectedArray({field:i,array:t,enclosingRef:a,context:s}),r):i.selectionSet?u(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:t,enclosingRef:O(t)?t:a,context:s}),r):(e.invariant(s.path.pop()===r),t))})),{result:s.canonizeResults?this.canon.admit(o):o,missing:r}},t}();var ft=function(){function t(e,t){this.cache=e,this.reader=t}return t.prototype.writeToStore=function(t,r){var i=this,o=r.query,a=r.result,s=r.dataId,u=r.variables,c=r.overwrite,l=C(o),f=new ee;u=n.__assign(n.__assign({},N(l)),u);var p={store:t,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:at(u),fragmentMap:b(j(o)),overwrite:!!c,incomingById:new Map,clientOnly:!1},h=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!O(h))throw new e.InvariantError(9);return p.incomingById.forEach((function(e,r){var n=e.fields,o=e.mergeTree,a=(e.selections,S(r));if(o.map.size){var s=i.applyMerges(o,a,n,p);if(O(s))return;n=s}t.merge(r,n)})),t.retain(h.__ref),h},t.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,a=e.mergeTree,s=this.cache.policies,u=s.identify(n,i,o.fragmentMap),c=u[0],l=u[1];if("string"==typeof(r=r||c)){var f=o.written[r]||(o.written[r]=[]),p=S(r);if(f.indexOf(i)>=0)return p;if(f.push(i),this.reader&&this.reader.isFresh(n,p,i,o))return p}var h=Object.create(null);l&&(h=o.merge(h,l));var d=r&&s.rootTypenamesById[r]||F(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof d&&(h.__typename=d);var y=new Set(i.selections);if(y.forEach((function(e){var r;if(v(e,o.variables))if(M(e)){var i=I(e),u=n[i],c=o.clientOnly;if(o.clientOnly=c||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0!==u){var l=s.getStoreFieldName({typename:d,fieldName:e.name.value,field:e,variables:o.variables}),f=ht(a,l),p=t.processFieldValue(u,e,o,f),m=void 0;if(e.selectionSet&&!(m=o.store.getFieldValue(p,"__typename"))&&O(p)){var g=o.incomingById.get(p.__ref);m=g&&g.fields.__typename}var b=s.getMergeFunction(d,e.name.value,m);b?f.info={field:e,typename:d,merge:b}:yt(a,l),h=o.merge(h,((r={})[l]=p,r))}else!o.clientOnly&&K.added(e);o.clientOnly=c}else{var w=_(e,o.fragmentMap);w&&s.fragmentMatches(w,d,n,o.variables)&&w.selectionSet.selections.forEach(y.add,y)}})),"string"==typeof r){var m=o.incomingById.get(r);return m?(m.fields=o.merge(m.fields,h),m.mergeTree=dt(m.mergeTree,a),m.selections.forEach(y.add,y),m.selections=y):o.incomingById.set(r,{fields:h,mergeTree:a,selections:y}),S(r)}return h},t.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,ht(n,o));return yt(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},t.prototype.applyMerges=function(t,r,i,o,a){var s,u=this;if(t.map.size&&!O(i)){var c,l=Array.isArray(i)||!O(r)&&!Ue(r)?void 0:r,f=i;l&&!a&&(a=[O(l)?l.__ref:l]);var p=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};t.map.forEach((function(t,r){var n=p(l,r),i=p(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(t,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&e.invariant(a.pop()===r)}})),c&&(i=Array.isArray(f)?f.slice(0):n.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return t.info?this.cache.policies.runMergeFunction(r,i,t.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},t}(),pt=[];function ht(e,t){var r=e.map;return r.has(t)||r.set(t,pt.pop()||{map:new Map}),r.get(t)}function dt(e,t){if(e===t||!t||vt(t))return e;if(!e||vt(e))return t;var r=e.info&&t.info?n.__assign(n.__assign({},e.info),t.info):e.info||t.info,i=e.map.size&&t.map.size,o={info:r,map:i?new Map:e.map.size?e.map:t.map};if(i){var a=new Set(t.map.keys());e.map.forEach((function(e,r){o.map.set(r,dt(e,t.map.get(r))),a.delete(r)})),a.forEach((function(r){o.map.set(r,dt(t.map.get(r),e.map.get(r)))}))}return o}function vt(e){return!e||!(e.info||e.map.size)}function yt(e,t){var r=e.map,n=r.get(t);n&&vt(n)&&(pt.push(n),r.delete(t))}new Set;var mt=new s.Slot,gt=new WeakMap;function bt(e){var t=gt.get(e);return t||gt.set(e,t={vars:new Set,dep:a.dep()}),t}function _t(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){bt(e).dep.dirty(n),wt(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=mt.getValue();s&&(i(s),bt(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),bt(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function wt(e){e.broadcastWatches&&e.broadcastWatches()}function St(e){return void 0!==e.args?e.args:e.field?Q(e.field,e.variables):null}E.setStringify(at);var Ot=function(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=void 0!==n?{id:n}:void 0!==i?{_id:i}:void 0),void 0===n&&(n=i),void 0!==n))return r+":"+("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))},kt=function(){},xt=function(e,t){return t.fieldName},Et=function(e,t,r){return(0,r.mergeObjects)(e,t)},qt=function(e,t){return t},Rt=function(){function t(e){this.config=e,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=!1,this.config=n.__assign({dataIdFromObject:Ot},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,t,r){var n=t&&r?F(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},a=n&&this.getTypePolicy(n),s=a&&a.keyFn||this.config.dataIdFromObject;s;){var u=s(e,o);if(!Array.isArray(u)){i=u;break}s=Mt(u)}return i=i?String(i):void 0,o.keyObject?[i,o.keyObject]:[i]},t.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var i=e[r],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=n.__rest(i,["queryType","mutationType","subscriptionType"]);o&&t.setRootTypename("Query",r),a&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),Ve.call(t.toBeAdded,r)?t.toBeAdded[r].push(u):t.toBeAdded[r]=[u]}))},t.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?Et:!1===t?qt:e.merge}a(n,t.merge),n.keyFn=!1===i?kt:Array.isArray(i)?Mt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?xt:Array.isArray(s)?Ft(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||xt)}))},t.prototype.setRootTypename=function(t,r){void 0===r&&(r=t);var n="ROOT_"+t.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(e.invariant(!i||i===t,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(Be);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},t.prototype.getTypePolicy=function(e){var t=this;if(!Ve.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach((function(e){var i=t.getTypePolicy(e),o=i.fields,a=n.__rest(i,["fields"]);Object.assign(r,a),Object.assign(r.fields,o)}))}var o=this.toBeAdded[e];return o&&o.length&&o.splice(0).forEach((function(r){t.updateTypePolicy(e,r)})),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},t.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&ze(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},t.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},t.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=St(e);o;){var u=o(s,a);if(!Array.isArray(u)){t=u||n;break}o=Ft(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return k(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return k(n,r,i,t)}))),E(e.name.value,n,r)}(e.field,e.variables):E(n,St(e))),!1===t?n:n===We(t)?t:n+":"+t},t.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=We(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=Qt(this,r,e,t,t.store.getStorage(O(r)?r.__ref:r,i));return mt.withValue(this.cache,u,[a,c])}return a}},t.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},t.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===Et?It(n.store)(e,t):s===qt?t:(n.overwrite&&(e=void 0),s(e,t,Qt(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},t}();function Qt(e,t,r,i,o){var a=e.getStoreFieldName(r),s=We(a),u=r.variables||i.variables,c=i.store,l=c.toReference,f=c.canRead;return{args:St(r),field:r.field||null,fieldName:s,storeFieldName:a,variables:u,isReference:O,toReference:l,storage:o,cache:e.cache,canRead:f,readField:function(r,o){var a;if("string"==typeof r)a={fieldName:r,from:arguments.length>1?o:t};else{if(!w(r))return;a=n.__assign({},r),Ve.call(r,"from")||(a.from=t)}return void 0===a.variables&&(a.variables=u),e.readField(a,i)},mergeObjects:It(i.store)}}function It(t){return function(r,i){if(Array.isArray(r)||Array.isArray(i))throw new e.InvariantError(4);if(w(r)&&w(i)){var o=t.getFieldValue(r,"__typename"),a=t.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(O(r)&&Ue(i))return t.merge(r.__ref,i),r;if(Ue(r)&&O(i))return t.merge(r,i.__ref),i;if(Ue(r)&&Ue(i))return n.__assign(n.__assign({},r),i)}return i}}function Ft(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(Tt(t,e,!1)):r.fieldName}}function Mt(e){var t=new u.Trie(fe);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=Pt(n.selectionSet,n.fragmentMap))}var a=n.keyObject=Tt(r,e,!0,i);return n.typename+":"+JSON.stringify(a)}}function Pt(e,t){var r=Object.create(null),n=new Set([e]);return n.forEach((function(e){e.selections.forEach((function(e){if(M(e)){if(e.alias){var i=e.alias.value,o=e.name.value;if(o!==i)(r.aliases||(r.aliases=Object.create(null)))[o]=i}if(e.selectionSet)(r.subsets||(r.subsets=Object.create(null)))[e.name.value]=Pt(e.selectionSet,t)}else{var a=_(e,t);a&&n.add(a.selectionSet)}}))})),r}function Tt(t,r,n,i){var o,a=Object.create(null);return r.forEach((function(r){if(Array.isArray(r)){if("string"==typeof o){var s=i&&i.subsets,u=s&&s[o];a[o]=Tt(t[o],r,n,u)}}else{var c=i&&i.aliases,l=c&&c[r]||r;Ve.call(t,l)?a[o=r]=t[l]:(e.invariant(!n,5),o=void 0)}})),a}var Ct={dataIdFromObject:Ot,addTypename:!0,resultCaching:!0,typePolicies:{}},Dt=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=_t,r.txCount=0,r.config=n.__assign(n.__assign({},Ct),t),r.addTypename=!!r.config.addTypename,r.policies=new Rt({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return n.__extends(t,e),t.prototype.init=function(){var e=this.data=new Ye.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,r=this.storeReader;this.storeWriter=new ft(this,this.storeReader=new lt({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canon:e?void 0:r&&r.canon})),this.maybeBroadcastWatch=a.wrap((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(rt(r)){var n=e.optimistic,i=e.rootId,o=e.variables;return r.makeCacheKey(e.query,e.callback,at({optimistic:n,rootId:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof Le)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(Ve.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t,r=this;return this.watches.size||bt(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&function(e){bt(e).vars.forEach((function(t){return t.forgetCache(e)}))}(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){at.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){return O(e)?e.__ref:this.policies.identify(e)[0]},t.prototype.evict=function(e){if(!e.id){if(Ve.call(e,"id"))return!1;e=n.__assign(n.__assign({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(){return this.init(),this.broadcastWatches(),at.reset(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t=this,r=e.update,i=e.optimistic,o=void 0===i||i,a=e.removeOptimistic,s=e.onWatchUpdated,u=function(e){var n=t,i=n.data,o=n.optimisticData;++t.txCount,e&&(t.data=t.optimisticData=e);try{r(t)}finally{--t.txCount,t.data=i,t.optimisticData=o}},c=new Set;s&&!this.txCount&&this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof a&&(this.optimisticData=this.optimisticData.removeLayer(a)),s&&c.size?(this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e,t){var r=s.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return t.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e)},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=K(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},t.prototype.broadcastWatch=function(e,t){var r=e.lastDiff,n=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,r))||r&&i.equal(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(Ne);function jt(e){return e.hasOwnProperty("graphQLErrors")}e.invariant("boolean"==typeof d,22);var At,Nt=function(e){function t(r){var n,i,o=r.graphQLErrors,a=r.clientErrors,s=r.networkError,u=r.errorMessage,c=r.extraInfo,l=e.call(this,u)||this;return l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(ce((n=l).graphQLErrors)||ce(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+=t+"\n"})),n.networkError&&(i+=n.networkError.message+"\n"),i=i.replace(/\n$/,"")),l.extraInfo=c,l.__proto__=t.prototype,l}return n.__extends(t,e),t}(Error);function Lt(e){return!!e&&e<7}exports.NetworkStatus=void 0,(At=exports.NetworkStatus||(exports.NetworkStatus={}))[At.loading=1]="loading",At[At.setVariables=2]="setVariables",At[At.fetchMore=3]="fetchMore",At[At.refetch=4]="refetch",At[At.poll=6]="poll",At[At.ready=7]="ready",At[At.error=8]="error";var Vt=function(t){function r(e){var r=e.queryManager,i=e.queryInfo,o=e.options,a=t.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=Bt)}catch(e){}var r=!a.observers.size;return a.observers.add(e),a.lastError?e.error&&e.error(a.lastError):a.lastResult&&e.next&&e.next(a.lastResult),r&&a.reobserve().catch((function(){})),function(){a.observers.delete(e)&&!a.observers.size&&a.tearDownQuery()}}))||this;a.observers=new Set,a.subscriptions=new Set,a.observer={next:function(e){(a.lastError||a.isDifferentFromLastResult(e))&&(a.updateLastResult(e),ie(a.observers,"next",e))},error:function(e){a.updateLastResult(n.__assign(n.__assign({},a.lastResult),{error:e,errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1})),ie(a.observers,"error",a.lastError=e)}},a.isTornDown=!1,a.options=o,a.queryId=r.generateQueryId();var s=C(o.query);return a.queryName=s&&s.name&&s.name.value,a.initialFetchPolicy=o.fetchPolicy||"cache-first",a.queryManager=r,a.queryInfo=i,a}return n.__extends(r,t),Object.defineProperty(r.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),r.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},r.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.lastResult,r=this.options.fetchPolicy,i=void 0===r?"cache-first":r,o=this.queryInfo.networkStatus||t&&t.networkStatus||exports.NetworkStatus.ready,a=n.__assign(n.__assign({},t),{loading:Lt(o),networkStatus:o});if(!this.queryManager.transform(this.options.query).hasForcedResolvers){var s=this.queryInfo.getDiff();a.data=s.complete||this.options.returnPartialData?s.result:void 0,s.complete?(a.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==i&&"cache-only"!==i||(a.networkStatus=exports.NetworkStatus.ready,a.loading=!1),delete a.partial):"no-cache"!==i&&(a.partial=!0),s.complete||this.options.partialRefetch||a.loading||a.data||a.error||(a.error=new Nt({clientErrors:s.missing}))}return e&&this.updateLastResult(a),a},r.prototype.isDifferentFromLastResult=function(e){return!i.equal(this.lastResultSnapshot,e)},r.prototype.getLastResult=function(){return this.lastResult},r.prototype.getLastError=function(){return this.lastError},r.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},r.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},r.prototype.refetch=function(e){var t={pollInterval:0},r=this.options.fetchPolicy;return"no-cache"===r?t.fetchPolicy="no-cache":"cache-and-network"!==r&&(t.fetchPolicy="network-only"),e&&!i.equal(this.options.variables,e)&&(t.variables=this.options.variables=n.__assign(n.__assign({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(t,exports.NetworkStatus.refetch)},r.prototype.fetchMore=function(e){var t=this,r=n.__assign(n.__assign({},e.query?e:n.__assign(n.__assign(n.__assign({},this.options),e),{variables:n.__assign(n.__assign({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return r.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,r,exports.NetworkStatus.fetchMore).then((function(n){var i=n.data,o=e.updateQuery;return o?t.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:r.variables})})):t.queryManager.cache.writeQuery({query:r.query,variables:r.variables,data:i}),n})).finally((function(){t.queryManager.stopQuery(i),t.reobserve()}))},r.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError&&e.onError(t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},r.prototype.setOptions=function(e){return this.reobserve(e)},r.prototype.setVariables=function(e){return i.equal(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.initialFetchPolicy,variables:e},exports.NetworkStatus.setVariables):Promise.resolve())},r.prototype.updateQuery=function(e){var t,r=this.queryManager,n=e(r.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(t=this.lastResult)||void 0===t?void 0:t.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});n&&(r.cache.writeQuery({query:this.options.query,data:n,variables:this.variables}),r.broadcastQueries())},r.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},r.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},r.prototype.fetch=function(e,t){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},r.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var r=this.pollingInfo,n=this.options.pollInterval;if(n){if(!r||r.interval!==n){e.invariant(n,13),(r||(this.pollingInfo={})).interval=n;var i=function(){t.pollingInfo&&(Lt(t.queryInfo.networkStatus)?o():t.reobserve({fetchPolicy:"network-only"},exports.NetworkStatus.poll).then(o,o))},o=function(){var e=t.pollingInfo;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(i,e.interval))};o()}}else r&&(clearTimeout(r.timeout),delete this.pollingInfo)}},r.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:re(e),ce(e.errors)||delete this.lastError,t},r.prototype.reobserve=function(e,t){this.isTornDown=!1;var r=t===exports.NetworkStatus.refetch||t===exports.NetworkStatus.fetchMore||t===exports.NetworkStatus.poll,n=this.options.variables,o=r?he(this.options,e):Object.assign(this.options,he(e));r||(this.updatePolling(),e&&e.variables&&!e.fetchPolicy&&!i.equal(e.variables,n)&&(o.fetchPolicy=this.initialFetchPolicy,void 0===t&&(t=exports.NetworkStatus.setVariables)));var a=this.fetch(o,t);return r||(this.concast&&this.concast.removeObserver(this.observer,!0),this.concast=a),a.addObserver(this.observer),a.promise},r.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},r.prototype.hasObservers=function(){return this.observers.size>0},r.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&(this.concast.removeObserver(this.observer),delete this.concast),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},r}(o.Observable);function Bt(e){}function Wt(e){var t=e.fetchPolicy,r=void 0===t?"cache-first":t,n=e.nextFetchPolicy;n&&(e.fetchPolicy="function"==typeof n?n.call(e,r):n)}ae(Vt);var zt=function(){function t(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return t.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=$(t.resolvers,e)})):this.resolvers=$(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,i=e.context,o=e.variables,a=e.onlyRunForcedResolvers,s=void 0!==a&&a;return n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(e){return t?[2,this.resolveDocument(t,r.data,i,o,this.fragmentMatcher,s).then((function(e){return n.__assign(n.__assign({},r),{data:e.result})}))]:[2,r]}))}))},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return y(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return function(e){T(e);var t=U([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=r.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return M(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},t.prototype.prepareContext=function(e){var t=this.cache;return n.__assign(n.__assign({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},t.prototype.addExportedVariables=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return n.__assign(n.__assign({},t),e.exportedVariables)}))]:[2,n.__assign({},t)]}))}))},t.prototype.shouldForceResolvers=function(e){var t=!1;return r.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return r.BREAK}}}),t},t.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Y(e),variables:t,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,t,r,i,o,a){return void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),n.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,p,h,d,v;return n.__generator(this,(function(y){return s=A(e),u=j(e),c=b(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,d=p.client,v={fragmentMap:c,context:n.__assign(n.__assign({},r),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,t,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},t.prototype.resolveSelectionSet=function(t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return n.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[r],c=function(t){return n.__awaiter(l,void 0,void 0,(function(){var c,l;return n.__generator(this,(function(n){return v(t,s)?M(t)?[2,this.resolveField(t,r,i).then((function(e){var r;void 0!==e&&u.push(((r={})[I(t)]=e,r))}))]:(P(t)?c=t:(c=o[t.name.value],e.invariant(c,12)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(r,l,a))?[2,this.resolveSelectionSet(c.selectionSet,r,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(c)).then((function(){return X(u)}))]}))}))},t.prototype.resolveField=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,p,h=this;return n.__generator(this,(function(n){return i=r.variables,o=e.name.value,a=I(e),s=o!==a,u=t[a]||t[o],c=Promise.resolve(u),r.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=t.__typename||r.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?o:a])&&(c=Promise.resolve(mt.withValue(this.cache,p,[t,Q(e,i),r.context,{field:e,fragmentMap:r.fragmentMap}])))),[2,c.then((function(t){return void 0===t&&(t=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(r.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,r):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,r):void 0:t}))]}))}))},t.prototype.resolveSubSelectedArray=function(e,t,r){var n=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?n.resolveSubSelectedArray(e,t,r):e.selectionSet?n.resolveSelectionSet(e.selectionSet,t,r):void 0})))},t}(),Ut=new(fe?WeakMap:Map);function Kt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Ut.set(e,(Ut.get(e)+1)%1e15),r.apply(this,arguments)})}function Jt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Ht=function(){function e(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null,Ut.has(e)||(Ut.set(e,0),Kt(e,"evict"),Kt(e,"modify"),Kt(e,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!i.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),i.equal(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){Jt(this),this.lastDiff=void 0,this.dirty=!1},e.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&i.equal(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var r=this.observableQuery;if(r&&"no-cache"===r.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){void 0===e&&(e=this.variables);var t=this.observableQuery;return{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:!t||!1!==t.options.canonizeResults}},e.prototype.setDiff=function(e){var t=this,r=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||i.equal(r&&r.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():e.reobserve()})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Jt(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Lt(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;if(!r||"no-cache"!==r.options.fetchPolicy){var o=n.__assign(n.__assign({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&i.equal(o,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=o))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===Ut.get(this.cache)&&i.equal(t,r.variables)&&i.equal(e.data,r.result.data))},e.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=ce(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(t.variables)):0!==r&&(Yt(e,t.errorPolicy)?this.cache.performTransaction((function(i){if(n.shouldWrite(e,t.variables))i.writeQuery({query:n.document,data:e.data,variables:t.variables,overwrite:1===r}),n.lastWrite={result:e,variables:t.variables,dmCount:Ut.get(n.cache)};else if(n.lastDiff&&n.lastDiff.diff.complete)return void(e.data=n.lastDiff.diff.result);var o=n.getDiffOptions(t.variables),a=i.diff(o);n.stopped||n.updateWatch(t.variables),n.updateLastDiff(a,o),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},e.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Yt(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!le(e);return!n&&r&&e.data&&(n=!0),n}var Gt=Object.prototype.hasOwnProperty,$t=function(){function t(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(fe?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new zt({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!f,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var t=this;this.queries.forEach((function(e,r){t.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new e.InvariantError(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},t.prototype.mutate=function(t){var r=t.mutation,i=t.variables,o=t.optimisticResponse,a=t.updateQueries,s=t.refetchQueries,u=void 0===s?[]:s,c=t.awaitRefetchQueries,l=void 0!==c&&c,f=t.update,p=t.onQueryUpdated,h=t.errorPolicy,d=void 0===h?"none":h,v=t.fetchPolicy,y=t.keepRootFields,m=t.context;return n.__awaiter(this,void 0,void 0,(function(){var t,s,c;return n.__generator(this,(function(h){switch(h.label){case 0:return e.invariant(r,15),e.invariant(!v||"no-cache"===v,16),t=this.generateMutationId(),r=this.transform(r).document,i=this.getVariables(r,i),this.transform(r).hasClientExports?[4,this.localState.addExportedVariables(r,i,m)]:[3,2];case 1:i=h.sent(),h.label=2;case 2:return s=this.mutationStore&&(this.mutationStore[t]={mutation:r,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:t,document:r,variables:i,fetchPolicy:v,errorPolicy:d,context:m,updateQueries:a,update:f,keepRootFields:y}),this.broadcastQueries(),c=this,[2,new Promise((function(e,h){return oe(c.getObservableFromLink(r,n.__assign(n.__assign({},m),{optimisticResponse:o}),i,!1),(function(e){if(le(e)&&"none"===d)throw new Nt({graphQLErrors:e.errors});s&&(s.loading=!1,s.error=null);var h=n.__assign({},e);return"function"==typeof u&&(u=u(h)),"ignore"===d&&le(h)&&delete h.errors,c.markMutationResult({mutationId:t,result:h,document:r,variables:i,fetchPolicy:v,errorPolicy:d,context:m,update:f,updateQueries:a,awaitRefetchQueries:l,refetchQueries:u,removeOptimistic:o?t:void 0,onQueryUpdated:p,keepRootFields:y})})).subscribe({next:function(t){c.broadcastQueries(),e(t)},error:function(e){s&&(s.loading=!1,s.error=e),o&&c.cache.removeOptimistic(t),c.broadcastQueries(),h(e instanceof Nt?e:new Nt({networkError:e}))}})}))]}}))}))},t.prototype.markMutationResult=function(e,t){var r=this;void 0===t&&(t=this.cache);var i=e.result,o=[],a="no-cache"===e.fetchPolicy;if(!a&&Yt(i,e.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables});var s=e.updateQueries;s&&this.queries.forEach((function(e,n){var a=e.observableQuery,u=a&&a.queryName;if(u&&Gt.call(s,u)){var c=s[u],l=r.queries.get(n),f=l.document,p=l.variables,h=t.diff({query:f,variables:p,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&D(f)||void 0,queryVariables:p});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:p})}}}))}if(o.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(t){a||o.forEach((function(e){return t.write(e)}));var s=e.update;if(s){if(!a){var u=t.diff({id:"ROOT_MUTATION",query:r.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});u.complete&&(i=n.__assign(n.__assign({},i),{data:u.result}))}s(t,i,{context:e.context,variables:e.variables})}a||e.keepRootFields||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return u.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then((function(){return i}))}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,t){var r=this,i="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{r.markMutationResult(n.__assign(n.__assign({},t),{result:{data:i}}),e)}catch(e){}}),t.mutationId)},t.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},t.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},t.prototype.transform=function(e){var t,r=this.transformCache;if(!r.has(e)){var i=this.cache.transformDocument(e),o=(t=this.cache.transformForLink(i),U([J],T(t))),a=this.localState.clientQuery(i),s=o&&this.localState.serverQuery(o),u={document:i,hasClientExports:m(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:N(C(i)),asQuery:n.__assign(n.__assign({},i),{definitions:i.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?n.__assign(n.__assign({},e),{operation:"query"}):e}))})},c=function(e){e&&!r.has(e)&&r.set(e,u)};c(e),c(i),c(a),c(s)}return r.get(e)},t.prototype.getVariables=function(e,t){return n.__assign(n.__assign({},this.transform(e).defaultVars),t)},t.prototype.watchQuery=function(e){void 0===(e=n.__assign(n.__assign({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new Ht(this.cache),r=new Vt({queryManager:this,queryInfo:t,options:e});return this.queries.set(r.queryId,t),t.init({document:e.query,observableQuery:r,variables:e.variables}),r},t.prototype.query=function(t,r){var n=this;return void 0===r&&(r=this.generateQueryId()),e.invariant(t.query,17),e.invariant("Document"===t.query.kind,18),e.invariant(!t.returnPartialData,19),e.invariant(!t.pollInterval,20),this.fetchQuery(r,t).finally((function(){return n.stopQuery(r)}))},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},t.prototype.clearStore=function(){return this.cancelPendingFetches(new e.InvariantError(21)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},t.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},t.prototype.getObservableQueries=function(e){var t=this;void 0===e&&(e="active");var r=new Map,i=new Map,o=new Set;return Array.isArray(e)&&e.forEach((function(e){var r;"string"==typeof e?i.set(e,!1):w(r=e)&&"Document"===r.kind&&Array.isArray(r.definitions)?i.set(t.transform(e).document,!1):w(e)&&e.query&&o.add(e)})),this.queries.forEach((function(t,n){var o=t.observableQuery,a=t.document;if(o){if("all"===e)return void r.set(n,o);var s=o.queryName;if("standby"===o.options.fetchPolicy||!o.hasObservers())return;("active"===e||s&&i.has(s)||a&&i.has(a))&&(r.set(n,o),s&&i.set(s,!0),a&&i.set(a,!0))}})),o.size&&o.forEach((function(e){var i=ve("legacyOneTimeQuery"),o=t.getQuery(i).init({document:e.query,variables:e.variables}),a=new Vt({queryManager:t,queryInfo:o,options:n.__assign(n.__assign({},e),{fetchPolicy:"network-only"})});o.setObservableQuery(a),r.set(i,a)})),r},t.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(o){if("no-cache"!==n&&(Yt(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),le(o))throw new Nt({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new o.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,t,r,i){var a,s,u=this;void 0===i&&(i=null!==(a=null==t?void 0:t.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(e).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:r,operationName:D(c)||void 0,context:this.prepareContext(n.__assign(n.__assign({},t),{forceFetch:!i}))};if(t=p.context,i){var h=l.get(c)||new Map;l.set(c,h);var d=at(r);if(!(s=h.get(d))){var v=new ue([Ee(f,p)]);h.set(d,s=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else s=new ue([Ee(f,p)])}else s=new ue([o.Observable.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=oe(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:t,variables:r})}))),s},t.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId();return oe(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=ce(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Nt({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=jt(t)?t:new Nt({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},t.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),a=this.getQuery(e),s=t.fetchPolicy,u=void 0===s?"cache-first":s,c=t.errorPolicy,l=void 0===c?"none":c,f=t.returnPartialData,p=void 0!==f&&f,h=t.notifyOnNetworkStatusChange,d=void 0!==h&&h,v=t.context,y=void 0===v?{}:v,m=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:l,returnPartialData:p,notifyOnNetworkStatusChange:d,context:y}),g=function(e){return m.variables=e,n.fetchQueryByPolicy(a,m,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return b.cancel(e)}))}));var b=new ue(this.transform(m.query).hasClientExports?this.localState.addExportedVariables(m.query,m.variables,m.context).then(g):g(m.variables));return b.cleanup((function(){n.fetchCancelFns.delete(e),Wt(t)})),b},t.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?ve("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Ht&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),!1}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},t.prototype.fetchQueryByPolicy=function(e,t,r){var i=this,a=t.query,s=t.variables,u=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,f=t.returnPartialData,p=t.context,h=t.notifyOnNetworkStatusChange,d=e.networkStatus;e.init({document:a,variables:s,networkStatus:r});var v=function(){return e.getDiff(s)},y=function(t,r){void 0===r&&(r=e.networkStatus||exports.NetworkStatus.loading);var u=t.result;var c=function(e){return o.Observable.of(n.__assign({data:e,loading:Lt(r),networkStatus:r},t.complete?null:{partial:!0}))};return u&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:u},context:p,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:r===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return i.getResultsFromLink(e,m,{variables:s,context:p,fetchPolicy:u,errorPolicy:l})},b=h&&"number"==typeof d&&d!==r&&Lt(r);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,e.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),e.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(e.getDiff()),g()]:[g()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Ht(this.cache)),this.queries.get(e)},t.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return n.__assign(n.__assign({},t),{clientAwareness:this.clientAwareness})},t}();function Xt(e,t){return he(e,t,t.variables&&{variables:n.__assign(n.__assign({},e.variables),t.variables)})}var Zt=function(){function t(t){var r=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=t.uri,i=t.credentials,o=t.headers,a=t.cache,s=t.ssrMode,u=void 0!==s&&s,c=t.ssrForceFetchDelay,l=void 0===c?0:c,f=t.connectToDevTools,p=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,h=t.queryDeduplication,d=void 0===h||h,v=t.defaultOptions,y=t.assumeImmutableResults,m=void 0!==y&&y,g=t.resolvers,b=t.typeDefs,_=t.fragmentMatcher,w=t.name,S=t.version,O=t.link;if(O||(O=n?new Ae({uri:n,credentials:i,headers:o}):we.empty()),!a)throw new e.InvariantError(10);this.link=O,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=b,l&&setTimeout((function(){return r.disableNetworkFetches=!1}),l),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),p&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.4.1",this.localState=new zt({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new $t({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:S},localState:this.localState,assumeImmutableResults:m,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Xt(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=n.__assign(n.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(t){return this.defaultOptions.query&&(t=Xt(this.defaultOptions.query,t)),e.invariant("cache-and-network"!==t.fetchPolicy,11),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=n.__assign(n.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Xt(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},t.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},t.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},t.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return Ee(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},t.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){})),i},t.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();e.setVerbosity(d?"log":"silent"),exports.setLogVerbosity=e.setVerbosity,exports.Observable=o.Observable,exports.disableExperimentalFragmentVariables=c.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=c.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=c.enableExperimentalFragmentVariables,exports.gql=c.gql,exports.resetCaches=c.resetCaches,exports.ApolloCache=Ne,exports.ApolloClient=Zt,exports.ApolloError=Nt,exports.ApolloLink=we,exports.HttpLink=Ae,exports.InMemoryCache=Dt,exports.MissingFieldError=Le,exports.ObservableQuery=Vt,exports.applyNextFetchPolicy=Wt,exports.checkFetcher=Pe,exports.concat=xe,exports.createHttpLink=je,exports.createSignalIfSupported=Te,exports.defaultDataIdFromObject=Ot,exports.empty=Se,exports.execute=Ee,exports.fallbackHttpConfig=Ie,exports.from=Oe,exports.fromError=ye,exports.fromPromise=function(e){return new o.Observable((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.isApolloError=jt,exports.isReference=O,exports.makeReference=S,exports.makeVar=_t,exports.mergeOptions=Xt,exports.parseAndCheckHttpResponse=Re,exports.rewriteURIForGET=De,exports.selectHttpOptionsAndBody=Fe,exports.selectURI=Ce,exports.serializeFetchParameter=Qe,exports.split=ke,exports.throwServerError=me,exports.toPromise=function(e){var t=!1;return new Promise((function(r,n){e.subscribe({next:function(e){t||(t=!0,r(e))},error:n})}))};
|