@apollo/client 3.4.8 → 3.4.12
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/README.md +2 -2
- package/apollo-client.cjs.js +92 -107
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -0
- package/cache/cache.cjs.js +20 -22
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts +1 -0
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +1 -3
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +2 -2
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +1 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -0
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +4 -4
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +2 -2
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +19 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +49 -35
- package/core/core.cjs.js.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -2
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -3
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +56 -81
- package/link/core/ApolloLink.js +2 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs.js +4 -6
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts +1 -0
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +1 -3
- package/link/core/index.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -0
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs.js +3 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts +1 -0
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -0
- package/link/http/index.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +4 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +8 -5
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -0
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/utils.cjs.js +3 -3
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +11 -11
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +2 -1
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +11 -5
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs.js +15 -9
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.d.ts +1 -0
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -0
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.d.ts.map +1 -1
- package/react/data/OperationData.js +3 -3
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +1 -3
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +6 -8
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts +1 -0
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +1 -0
- package/react/data/index.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs.js +5 -5
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/index.d.ts +1 -0
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +1 -0
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs.js +3 -3
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -0
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -0
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.js +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.d.ts +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +1 -0
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -3
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +10 -10
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -3
- package/react/react.cjs.js.map +1 -1
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +1 -3
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -5
- 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 +2 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/mergeDeep.js +1 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/globals/DEV.js +2 -2
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/{common → globals}/global.d.ts +0 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/{common → globals}/global.js +0 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs.js +57 -0
- package/utilities/globals/globals.cjs.js.map +1 -0
- package/utilities/globals/index.d.ts +5 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +8 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/{common → globals}/maybe.d.ts +0 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/{common → globals}/maybe.js +0 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +7 -0
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +5 -5
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +9 -9
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +2 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -3
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -5
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/observables/subclassing.js +2 -1
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/package.json +1 -3
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -4
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/mocking/mockFetch.js +1 -1
- 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 -2
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js +1 -1
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/utilities.cjs.js +42 -74
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/apollo-core.cjs.js +0 -5768
- package/apollo-core.cjs.js.map +0 -1
- package/apollo-core.cjs.min.js +0 -1
- package/utilities/common/global.d.ts.map +0 -1
- package/utilities/common/global.js.map +0 -1
- package/utilities/common/maybe.d.ts.map +0 -1
- package/utilities/common/maybe.js.map +0 -1
|
@@ -0,0 +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(".."),o=require("graphql"),s=require("optimism"),a=require("@wry/context"),u=require("@wry/trie"),c=require("graphql-tag"),l=require("react");function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){t[r]=e[r]})),t.default=e,Object.freeze(t)}var p=f(l);function h(e){try{return e()}catch(e){}}function d(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 v(e,t){return function(e){var t=[];return o.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function y(e){return e&&v(["client"],e)&&v(["export"],e)}function b(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.__spreadArray([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],r.definitions,!0)})}function g(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 _(e){return null!==e&&"object"==typeof e}function O(e){return{__ref:String(e)}}function w(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function S(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 S(o,e.name,e.value,i)})),e[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var s=(i||{})[n.name.value];e[r.value]=s}else if(function(e){return"ListValue"===e.kind}(n))e[r.value]=n.values.map((function(e){var t={};return S(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 k=["connection","include","skip","client","rest","export"],x=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+"("+E(i)+")"}return r.connection.key}var o=e;if(t){var s=E(t);o+="("+s+")"}return r&&Object.keys(r).forEach((function(e){-1===k.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@"+e+"("+E(r[e])+")":o+="@"+e)})),o}),{setStringify:function(e){var t=E;return E=e,t}}),E=function(e){return JSON.stringify(e,q)};function q(e,t){return _(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function R(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return S(r,n,i,t)})),r}return null}function Q(e){return e.alias?e.alias.value:e.name.value}function M(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(C(o)){if("__typename"===o.name.value)return e[Q(o)]}else{var s=M(e,m(o,r).selectionSet,r);if("string"==typeof s)return s}}}function C(e){return"Field"===e.kind}function I(e){return"InlineFragment"===e.kind}function P(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 D(e){return P(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function T(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function F(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function j(e){var r=D(e);return t.invariant(r&&"query"===r.operation,49),r}function N(e){var r;P(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var s=o.operation;if("query"===s||"mutation"===s||"subscription"===s)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new t.InvariantError(53)}function A(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&S(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 z(e,t){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&z(t[e.name.value],t)}))}function B(e){return z(D(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),g(F(e)))?null:e}function W(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function U(t,r){var n=Object.create(null),i=[],s=Object.create(null),a=[],u=B(o.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(W(t))))return e.arguments&&e.arguments.forEach((function(e){"Variable"===e.value.kind&&i.push({name:e.value.name.value})})),e.selectionSet&&H(e.selectionSet).forEach((function(e){a.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){s[e.name.value]=!0}},Directive:{enter:function(e){if(W(t)(e))return null}}}));return u&&L(i,(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 B(o.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}}}))}(i,u)),u&&L(a,(function(e){return!!e.name&&!s[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return B(o.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(a,u)),u}var K=Object.assign((function(t){return o.visit(P(t),{SelectionSet:{enter:function(t,r,n){if(!n||"OperationDefinition"!==n.kind){var i=t.selections;if(i)if(!i.some((function(e){return C(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(C(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return e.__assign(e.__assign({},t),{selections:e.__spreadArray(e.__spreadArray([],i,!0),[V],!1)})}}}}})}),{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){(C(e)||I(e))&&e.selectionSet?H(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function Y(t){return"query"===N(t).operation?t:o.visit(t,{OperationDefinition:{enter:function(t){return e.__assign(e.__assign({},t),{operation:"query"})}}})}var G=Object.prototype.hasOwnProperty;function X(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return $(e)}function $(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 t(e){void 0===e&&(e=Z),this.reconciler=e,this.isObject=_,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 _(r)&&_(t)?(Object.keys(r).forEach((function(o){if(G.call(t,o)){var s=t[o];if(r[o]!==s){var a=n.reconciler.apply(n,e.__spreadArray([t,r,o],i,!1));a!==s&&((t=n.shallowCopyForMerge(t))[o]=a)}}else(t=n.shallowCopyForMerge(t))[o]=r[o]})),t):r},t.prototype.shallowCopyForMerge=function(t){return _(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}(),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 n.Observable((function(n){var i=n.next,o=n.error,s=n.complete,a=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++a;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--a,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--a,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,a||s&&s.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}function se(e){function t(t){Object.defineProperty(e,t,{value:n.Observable})}return i.canUseSymbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ae(e){return e&&"function"==typeof e.then}var ue=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],ie(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&setTimeout((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?ae(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 e&&(e=[new n.Observable(e)]),ae(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 ce(e){return Array.isArray(e)&&e.length>0}function le(e){return e.errors&&e.errors.length>0||!1}se(ue);var fe="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),pe="function"==typeof WeakSet,he="function"==typeof Symbol&&"function"==typeof Symbol.for;function de(){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 ve=new Map;function ye(e){var t=ve.get(e)||1;return ve.set(e,t+1),e+":"+t+":"+Math.random().toString(36).slice(2)}function be(e){return new n.Observable((function(t){t.error(e)}))}var ge=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 me(e,t){return t?t(e):n.Observable.of()}function _e(e){return"function"==typeof e?new we(e):e}function Oe(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 we=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(_e).reduce((function(e,t){return e.concat(t)}))},r.split=function(e,t,i){var o=_e(t),s=_e(i||new r(me));return Oe(o)&&Oe(s)?new r((function(t){return e(t)?o.request(t)||n.Observable.of():s.request(t)||n.Observable.of()})):new r((function(t,r){return e(t)?o.request(t,r)||n.Observable.of():s.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?T(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(26)}return e}(i))))||n.Observable.of()},r.concat=function(e,t){var i=_e(e);if(Oe(i))return i;var o=_e(t);return Oe(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(me)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,r){throw new t.InvariantError(21)},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}(),Se=we.empty,ke=we.from,xe=we.split,Ee=we.concat,qe=we.execute,Re=Object.prototype.hasOwnProperty;function Qe(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&&ge(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||Re.call(r,"data")||Re.call(r,"errors")||ge(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var Me=function(e,r){var n;try{n=JSON.stringify(e)}catch(e){var i=new t.InvariantError(23);throw i.parseError=e,i}return n},Ce={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Ie=function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=e.__assign(e.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),a=r.http||{};n.forEach((function(t){s=e.__assign(e.__assign(e.__assign({},s),t.options),{headers:e.__assign(e.__assign({},s.headers),Pe(t.headers))}),t.credentials&&(s.credentials=t.credentials),a=e.__assign(e.__assign({},a),t.http)}));var u=t.operationName,c=t.extensions,l=t.variables,f=t.query,p={operationName:u,variables:l};return a.includeExtensions&&(p.extensions=c),a.includeQuery&&(p.query=o.print(f)),{options:s,body:p}};function Pe(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 De=function(e){if(!e&&"undefined"==typeof fetch)throw new t.InvariantError(22)},Te=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 je(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=Me(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Me(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,u=e.indexOf("#");-1!==u&&(s=e.substr(u),a=e.substr(0,u));var c=-1===a.indexOf("?")?"?":"&";return{newURI:a+c+r.join("&")+s}}var Ne=h((function(){return fetch})),Ae=function(t){void 0===t&&(t={});var r=t.uri,i=void 0===r?"/graphql":r,s=t.fetch,a=t.includeExtensions,u=t.useGETForQueries,c=t.includeUnusedVariables,l=void 0!==c&&c,f=e.__rest(t,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);var p={http:{includeExtensions:a},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new we((function(t){var r=Fe(t,i),a=t.getContext(),c={};if(a.clientAwareness){var f=a.clientAwareness,d=f.name,v=f.version;d&&(c["apollographql-client-name"]=d),v&&(c["apollographql-client-version"]=v)}var y,b=e.__assign(e.__assign({},c),a.headers),g={http:a.http,options:a.fetchOptions,credentials:a.credentials,headers:b},m=Ie(t,Ce,p,g),_=m.options,O=m.body;if(O.variables&&!l){var w=new Set(Object.keys(O.variables));o.visit(t.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&w.delete(e.name.value)}}),w.size&&(O.variables=e.__assign({},O.variables),w.forEach((function(e){delete O.variables[e]})))}if(!_.signal){var S=Te(),k=S.controller,x=S.signal;(y=k)&&(_.signal=x)}if(u&&!t.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(_.method="GET"),"GET"===_.method){var E=je(r,O),q=E.newURI,R=E.parseError;if(R)return be(R);r=q}else try{_.body=Me(O)}catch(R){return be(R)}return new n.Observable((function(e){return(s||h((function(){return fetch}))||Ne)(r,_).then((function(e){return t.setContext({response:e}),e})).then(Qe(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(){y&&y.abort()}}))}))},Le=function(t){function r(e){void 0===e&&(e={});var r=t.call(this,Ae(e).request)||this;return r.options=e,r}return e.__extends(r,t),r}(we),Ve=function(){function t(){this.getFragmentDoc=s.wrap(b)}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,s=e.__rest(t,["id","data","fragment","fragmentName"]);return this.write(Object.assign(s,{query:this.getFragmentDoc(i,o),dataId:r,result:n}))},t}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var ze=function(t){function r(e,n,i,o){var s=t.call(this,e)||this;return s.message=e,s.path=n,s.query=i,s.variables=o,s.__proto__=r.prototype,s}return e.__extends(r,t),r}(Error),Be=Object.prototype.hasOwnProperty;var We=/^[_a-z][_0-9a-z]*/i;function Ue(e){var t=e.match(We);return t?t[0]:e}function Ke(e,t,r){return!!_(t)&&(Array.isArray(t)?t.every((function(t){return Ke(e,t,r)})):e.selections.every((function(e){if(C(e)&&d(e,r)){var n=Q(e);return Be.call(t,n)&&(!e.selectionSet||Ke(e.selectionSet,t[n],r))}return!0})))}function Je(e){return _(e)&&!w(e)&&!Array.isArray(e)}var He=Object.create(null),Ye=function(){return He},Ge=Object.create(null),Xe=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 w(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return w(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return O(e);if(w(e))return e;var n=r.policies.identify(e)[0];if(n){var i=O(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),Be.call(this.data,e)){var r=this.data[e];if(r&&Be.call(r,t))return r[t]}return"__typename"===t&&Be.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof tt?this.parent.get(e,t):void 0},r.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Be.call(this.data,e)?this.data[e]:this instanceof tt?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},r.prototype.merge=function(e,r){var n,i=this;w(e)&&(e=e.__ref),w(r)&&(r=r.__ref);var o="string"==typeof e?this.lookup(n=e):e,s="string"==typeof r?this.lookup(n=r):r;if(s){t.invariant("string"==typeof n,1);var a=new ee(nt).merge(o,s);if(this.data[n]=a,a!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(s).forEach((function(e){if(!o||o[e]!==a[e]){u[e]=1;var t=Ue(e);t===e||i.policies.hasKeyArgs(a.__typename,t)||(u[t]=1),void 0!==a[e]||i instanceof tt||delete a[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==a.__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),s=!1,a=!0,u={DELETE:He,INVALIDATE:Ge,isReference:w,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||O(t)}:e,{store:n})}};if(Object.keys(i).forEach((function(c){var l=Ue(c),f=i[c];if(void 0!==f){var p="function"==typeof r?r:r[c]||r[l];if(p){var h=p===Ye?He:p(f,e.__assign(e.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(t,c)}));h===Ge?n.group.dirty(t,c):(h===He&&(h=void 0),h!==f&&(o[c]=h,s=!0,f=h))}void 0!==f&&(a=!1)}})),s)return this.merge(t,o),a&&(this instanceof tt?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"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=Ye,n):Ye)}return!1},r.prototype.evict=function(e){var t=!1;return e.id&&(Be.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof tt&&(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){Be.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&&Be.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 tt?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){Be.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 tt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},r.prototype.findChildRefIds=function(e){if(!Be.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){w(e)&&(t[e.__ref]=!0),_(e)&&Object.keys(e).forEach((function(t){var r=e[t];_(r)&&n.add(r)}))}))}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),$e=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?s.dep():null,this.keyMaker=new u.Trie(fe)},e.prototype.depend=function(e,t){if(this.d){this.d(Ze(e,t));var r=Ue(t);r!==t&&this.d(Ze(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ze(e,t),"__exists"===t?"forget":"setDirty")},e}();function Ze(e,t){return t+"#"+e}function et(e,t){it(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,s=t.call(this,r,new $e(i))||this;return s.stump=new rt(s),s.storageTrie=new u.Trie(fe),o&&s.replace(o),s}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}(Xe||(Xe={}));var tt=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 Be.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}(Xe),rt=function(t){function r(e){return t.call(this,"EntityStore.Stump",e,(function(){}),new $e(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}(tt);function nt(e,t,n){var i=e[n],o=t[n];return r.equal(i,o)?i:o}function it(e){return!!(e instanceof Xe&&e.group.caching)}var ot,st,at=function(){function t(){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 t.prototype.isKnown=function(e){return _(e)&&this.known.has(e)},t.prototype.pass=function(t){if(_(t)){var r=function(t){return _(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(_(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(a=this.pool.lookupArray(n)).array||this.known.add(a.array=n),a.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],s=this.sortedKeys(e);o.push(s.json);var a,u=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var c=a.object=Object.create(i);this.known.add(c),s.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return a.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}(),ut=Object.assign((function(e){if(_(e)){void 0===ot&&ct();var t=ot.admit(e),r=st.get(t);return void 0===r&&st.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:ct});function ct(){ot=new at,st=new(fe?WeakMap:Map)}function lt(e,t){return new ze(e.message,t.path.slice(),t.query,t.variables)}function ft(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var pt=function(){function r(t){var r=this;this.knownResults=new(fe?WeakMap:Map),this.config=e.__assign(e.__assign({},t),{addTypename:!1!==t.addTypename}),this.canon=t.canon||new at,this.executeSelectionSet=s.wrap((function(t){var n,i=t.context.canonizeResults,o=ft(t);o[3]=!i;var s=(n=r.executeSelectionSet).peek.apply(n,o);return s?i?e.__assign(e.__assign({},s),{result:r.canon.admit(s.result)}):s:(et(t.context.store,t.enclosingRef.__ref),r.execSelectionSetImpl(t))}),{max:this.config.resultCacheMaxSize,keyArgs:ft,makeCacheKey:function(e,t,r,n){if(it(r.store))return r.store.makeCacheKey(e,w(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=s.wrap((function(e){return et(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(it(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return r.prototype.resetCanon=function(){this.canon=new at},r.prototype.diffQueryAgainstStore=function(t){var r=t.store,n=t.query,i=t.rootId,o=void 0===i?"ROOT_QUERY":i,s=t.variables,a=t.returnPartialData,u=void 0===a||a,c=t.canonizeResults,l=void 0===c||c,f=this.config.cache.policies;s=e.__assign(e.__assign({},A(j(n))),s);var p=O(o),h=this.executeSelectionSet({selectionSet:N(n).selectionSet,objectOrReference:p,enclosingRef:p,context:{store:r,query:n,policies:f,variables:s,varString:ut(s),canonizeResults:l,fragmentMap:g(F(n)),path:[]}}),d=h.missing&&h.missing.length>0;if(d&&!u)throw h.missing[0];return{result:h.result,missing:h.missing,complete:!d}},r.prototype.isFresh=function(e,t,r,n){if(it(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,s=e.context;if(w(i)&&!s.policies.rootTypenamesById[i.__ref]&&!s.store.has(i.__ref))return{result:this.canon.empty,missing:[lt(new t.InvariantError(5),s)]};var a=s.variables,u=s.policies,c=s.store,l=[],f={result:null},p=c.getFieldValue(i,"__typename");function h(){return f.missing||(f.missing=[])}function v(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(e){var n;if(d(e,a))if(C(e)){var c=u.readField({fieldName:e.name.value,field:e,variables:s.variables,from:i},s),f=Q(e);s.path.push(f),void 0===c?K.added(e)||h().push(lt(new t.InvariantError(6),s)):Array.isArray(c)?c=v(r.executeSubSelectedArray({field:e,array:c,enclosingRef:o,context:s})):e.selectionSet?null!=c&&(c=v(r.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:c,enclosingRef:w(c)?c:o,context:s}))):s.canonizeResults&&(c=r.canon.pass(c)),void 0!==c&&l.push(((n={})[f]=c,n)),t.invariant(s.path.pop()===f)}else{var b=m(e,s.fragmentMap);b&&u.fragmentMatches(b,p)&&b.selectionSet.selections.forEach(y.add,y)}}));var b=$(l);return f.result=s.canonizeResults?this.canon.admit(b):b,this.knownResults.set(f.result,n),f},r.prototype.execSubSelectedArrayImpl=function(e){var r,n=this,i=e.field,o=e.array,s=e.enclosingRef,a=e.context;function u(e,n){return e.missing&&(r=r||[]).push.apply(r,e.missing),t.invariant(a.path.pop()===n),e.result}return i.selectionSet&&(o=o.filter(a.store.canRead)),o=o.map((function(e,r){return null===e?null:(a.path.push(r),Array.isArray(e)?u(n.executeSubSelectedArray({field:i,array:e,enclosingRef:s,context:a}),r):i.selectionSet?u(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,enclosingRef:w(e)?e:s,context:a}),r):(t.invariant(a.path.pop()===r),e))})),{result:a.canonizeResults?this.canon.admit(o):o,missing:r}},r}();var ht=function(){function r(e,t){this.cache=e,this.reader=t}return r.prototype.writeToStore=function(r,n){var i=this,o=n.query,s=n.result,a=n.dataId,u=n.variables,c=n.overwrite,l=D(o),f=new ee;u=e.__assign(e.__assign({},A(l)),u);var p={store:r,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:ut(u),fragmentMap:g(F(o)),overwrite:!!c,incomingById:new Map,clientOnly:!1},h=this.processSelectionSet({result:s||Object.create(null),dataId:a,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!w(h))throw new t.InvariantError(8);return p.incomingById.forEach((function(e,t){var n=e.fields,o=e.mergeTree,s=(e.selections,O(t));if(o&&o.map.size){var a=i.applyMerges(o,s,n,p);if(w(a))return;n=a}r.merge(t,n)})),r.retain(h.__ref),h},r.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,s=e.mergeTree,a=this.cache.policies,u=a.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=O(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 v=r&&a.rootTypenamesById[r]||M(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof v&&(h.__typename=v);var y=new Set(i.selections);if(y.forEach((function(e){var r;if(d(e,o.variables))if(C(e)){var i=Q(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=a.getStoreFieldName({typename:v,fieldName:e.name.value,field:e,variables:o.variables}),f=vt(s,l),p=t.processFieldValue(u,e,o,f),b=void 0;if(e.selectionSet&&!(b=o.store.getFieldValue(p,"__typename"))&&w(p)){var g=o.incomingById.get(p.__ref);b=g&&g.fields.__typename}var _=a.getMergeFunction(v,e.name.value,b);_?f.info={field:e,typename:v,merge:_}:gt(s,l),h=o.merge(h,((r={})[l]=p,r))}else!o.clientOnly&&K.added(e);o.clientOnly=c}else{var O=m(e,o.fragmentMap);O&&a.fragmentMatches(O,v,n,o.variables)&&O.selectionSet.selections.forEach(y.add,y)}})),"string"==typeof r){var b=o.incomingById.get(r);return b?(b.fields=o.merge(b.fields,h),b.mergeTree=yt(b.mergeTree,s),b.selections.forEach(y.add,y),b.selections=y):o.incomingById.set(r,{fields:h,mergeTree:bt(s)?void 0:s,selections:y}),O(r)}return h},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 s=i.processFieldValue(e,t,r,vt(n,o));return gt(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},r.prototype.applyMerges=function(r,n,i,o,s){var a,u=this;if(r.map.size&&!w(i)){var c,l=Array.isArray(i)||!w(n)&&!Je(n)?void 0:n,f=i;l&&!s&&(s=[w(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){s&&s.push(r);var a=u.applyMerges(e,n,i,o,s);a!==i&&(c=c||new Map).set(r,a),s&&t.invariant(s.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,s&&(a=o.store).getStorage.apply(a,s)):i},r}(),dt=[];function vt(e,t){var r=e.map;return r.has(t)||r.set(t,dt.pop()||{map:new Map}),r.get(t)}function yt(t,r){if(t===r||!r||bt(r))return t;if(!t||bt(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 s=new Set(r.map.keys());t.map.forEach((function(e,t){o.map.set(t,yt(e,r.map.get(t))),s.delete(t)})),s.forEach((function(e){o.map.set(e,yt(r.map.get(e),t.map.get(e)))}))}return o}function bt(e){return!e||!(e.info||e.map.size)}function gt(e,t){var r=e.map,n=r.get(t);n&&bt(n)&&(dt.push(n),r.delete(t))}new Set;var mt=new a.Slot,_t=new WeakMap;function Ot(e){var t=_t.get(e);return t||_t.set(e,t={vars:new Set,dep:s.dep()}),t}function wt(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Ot(e).dep.dirty(n),St(e)}));var s=Array.from(r);r.clear(),s.forEach((function(t){return t(e)}))}}else{var a=mt.getValue();a&&(i(a),Ot(a).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),Ot(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function St(e){e.broadcastWatches&&e.broadcastWatches()}function kt(e){return void 0!==e.args?e.args:e.field?R(e.field,e.variables):null}x.setStringify(ut);var xt=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))},Et=function(){},qt=function(e,t){return t.fieldName},Rt=function(e,t,r){return(0,r.mergeObjects)(e,t)},Qt=function(e,t){return t},Mt=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:xt},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?M(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},s=n&&this.getTypePolicy(n),a=s&&s.keyFn||this.config.dataIdFromObject;a;){var u=a(e,o);if(!Array.isArray(u)){i=u;break}a=Dt(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,s=i.mutationType,a=i.subscriptionType,u=e.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),s&&r.setRootTypename("Mutation",n),a&&r.setRootTypename("Subscription",n),Be.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 s(e,t){e.merge="function"==typeof t?t:!0===t?Rt:!1===t?Qt:e.merge}s(n,t.merge),n.keyFn=!1===i?Et:Array.isArray(i)?Dt(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 a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?qt:Array.isArray(a)?Pt(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||qt)}))},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(We);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},r.prototype.getTypePolicy=function(t){var r=this;if(!Be.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,s=e.__rest(i,["fields"]);Object.assign(n,s),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 s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<a.length;++l){var f=a[l];if(f.has(o))return s.has(o)||s.add(o),!0;f.forEach(u),c&&l===a.length-1&&Ke(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 s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=kt(e);o;){var u=o(a,s);if(!Array.isArray(u)){t=u||n;break}o=Pt(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 S(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 S(n,r,i,t)}))),x(e.name.value,n,r)}(e.field,e.variables):x(n,kt(e))),!1===t?n:n===Ue(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=Ue(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=Ct(this,r,e,t,t.store.getStorage(w(r)?r.__ref:r,i));return mt.withValue(this.cache,u,[s,c])}return s}},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,s=r.typename,a=r.merge;return a===Rt?It(n.store)(e,t):a===Qt?t:(n.overwrite&&(e=void 0),a(e,t,Ct(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},r}();function Ct(t,r,n,i,o){var s=t.getStoreFieldName(n),a=Ue(s),u=n.variables||i.variables,c=i.store,l=c.toReference,f=c.canRead;return{args:kt(n),field:n.field||null,fieldName:a,storeFieldName:s,variables:u,isReference:w,toReference:l,storage:o,cache:t.cache,canRead:f,readField:function(n,o){var s;if("string"==typeof n)s={fieldName:n,from:arguments.length>1?o:r};else{if(!_(n))return;s=e.__assign({},n),Be.call(n,"from")||(s.from=r)}return void 0===s.variables&&(s.variables=u),t.readField(s,i)},mergeObjects:It(i.store)}}function It(r){return function(n,i){if(Array.isArray(n)||Array.isArray(i))throw new t.InvariantError(3);if(_(n)&&_(i)){var o=r.getFieldValue(n,"__typename"),s=r.getFieldValue(i,"__typename");if(o&&s&&o!==s)return i;if(w(n)&&Je(i))return r.merge(n.__ref,i),n;if(Je(n)&&w(i))return r.merge(n,i.__ref),i;if(Je(n)&&Je(i))return e.__assign(e.__assign({},n),i)}return i}}function Pt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(Ft(t,e,!1)):r.fieldName}}function Dt(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=Tt(n.selectionSet,n.fragmentMap))}var s=n.keyObject=Ft(r,e,!0,i);return n.typename+":"+JSON.stringify(s)}}function Tt(e,t){var r=Object.create(null),n=new Set([e]);return n.forEach((function(e){e.selections.forEach((function(e){if(C(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]=Tt(e.selectionSet,t)}else{var s=m(e,t);s&&n.add(s.selectionSet)}}))})),r}function Ft(e,r,n,i){var o,s,a=Object.create(null);return r.forEach((function(r){if(Array.isArray(r)){if("string"==typeof s&&"string"==typeof o){var u=i&&i.subsets,c=u&&u[s];a[s]=Ft(e[o],r,n,c)}}else{var l=i&&i.aliases,f=l&&l[r]||r;Be.call(e,f)?a[s=r]=e[o=f]:(t.invariant(!n,4),o=s=void 0)}})),a}var jt={dataIdFromObject:xt,addTypename:!0,resultCaching:!0,typePolicies:{}},Nt=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=wt,n.txCount=0,n.config=e.__assign(e.__assign({},jt),r),n.addTypename=!!n.config.addTypename,n.policies=new Mt({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.data=new Xe.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},n.prototype.resetResultCache=function(e){var t=this,r=this.storeReader;this.storeWriter=new ht(this,this.storeReader=new pt({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canon:e?void 0:r&&r.canon})),this.maybeBroadcastWatch=s.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(it(r)){var n=e.optimistic,i=e.rootId,o=e.variables;return r.makeCacheKey(e.query,e.callback,ut({optimistic:n,rootId:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},n.prototype.restore=function(e){return this.init(),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 ze)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(Be.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=this;return this.watches.size||function(e){Ot(e).vars.forEach((function(t){return t.attachCache(e)}))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&function(e){Ot(e).vars.forEach((function(t){return t.forgetCache(e)}))}(t),t.maybeBroadcastWatch.forget(e)}},n.prototype.gc=function(e){ut.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},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 w(e)?e.__ref:this.policies.identify(e)[0]},n.prototype.evict=function(t){if(!t.id){if(Be.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(),ut.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,s=t.removeOptimistic,a=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;a&&!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 s&&(this.optimisticData=this.optimisticData.removeLayer(s)),a&&c.size?(this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e,t){var r=a.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=K(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}(Ve);function At(e){return e.hasOwnProperty("graphQLErrors")}var Lt,Vt=function(t){function r(e){var n,i,o=e.graphQLErrors,s=e.clientErrors,a=e.networkError,u=e.errorMessage,c=e.extraInfo,l=t.call(this,u)||this;return l.graphQLErrors=o||[],l.clientErrors=s||[],l.networkError=a||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__=r.prototype,l}return e.__extends(r,t),r}(Error);function zt(e){return!!e&&e<7}exports.NetworkStatus=void 0,(Lt=exports.NetworkStatus||(exports.NetworkStatus={}))[Lt.loading=1]="loading",Lt[Lt.setVariables=2]="setVariables",Lt[Lt.fetchMore=3]="fetchMore",Lt[Lt.refetch=4]="refetch",Lt[Lt.poll=6]="poll",Lt[Lt.ready=7]="ready",Lt[Lt.error=8]="error";var Bt=Object.assign,Wt=(Object.hasOwnProperty,function(n){function i(e){var t=e.queryManager,r=e.queryInfo,i=e.options,o=n.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=Ut)}catch(e){}var r=!o.observers.size;o.observers.add(e);var n=o.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&o.reobserve().catch((function(){})),function(){o.observers.delete(e)&&!o.observers.size&&o.tearDownQuery()}}))||this;o.observers=new Set,o.subscriptions=new Set,o.isTornDown=!1,o.options=i,o.queryId=r.queryId||t.generateQueryId();var s=D(i.query);return o.queryName=s&&s.name&&s.name.value,o.initialFetchPolicy=i.fetchPolicy||"cache-first",o.queryManager=t,o.queryInfo=r,o}return e.__extends(i,n),Object.defineProperty(i.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),i.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)}))},i.prototype.getCurrentResult=function(t){void 0===t&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||exports.NetworkStatus.ready,o=e.__assign(e.__assign({},n),{loading:zt(i),networkStatus:i}),s=this.options.fetchPolicy,a=void 0===s?"cache-first":s;if((n||"network-only"!==a&&"no-cache"!==a&&"standby"!==a)&&!this.queryManager.transform(this.options.query).hasForcedResolvers){var u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(o.data=u.result),r.equal(o.data,{})&&(o.data=void 0),u.complete?(o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==a&&"cache-only"!==a||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1),delete o.partial):"no-cache"!==a&&(o.partial=!0)}return t&&this.updateLastResult(o),o},i.prototype.isDifferentFromLastResult=function(e){return!this.last||!r.equal(this.last.result,e)},i.prototype.getLast=function(e,t){var n=this.last;if(n&&n[e]&&(!t||r.equal(n.variables,this.variables)))return n[e]},i.prototype.getLastResult=function(e){return this.getLast("result",e)},i.prototype.getLastError=function(e){return this.getLast("error",e)},i.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},i.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},i.prototype.refetch=function(t){var n={pollInterval:0},i=this.options.fetchPolicy;return"no-cache"===i?n.fetchPolicy="no-cache":"cache-and-network"!==i&&(n.fetchPolicy="network-only"),t&&!r.equal(this.options.variables,t)&&(n.variables=this.options.variables=e.__assign(e.__assign({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,exports.NetworkStatus.refetch)},i.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()}))},i.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()}},i.prototype.setOptions=function(e){return this.reobserve(e)},i.prototype.setVariables=function(e){return r.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())},i.prototype.updateQuery=function(e){var t=this.queryManager,r=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(t.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),t.broadcastQueries())},i.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},i.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},i.prototype.fetch=function(e,t){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},i.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var r=this.pollingInfo,n=this.options.pollInterval;if(n){if(!r||r.interval!==n){t.invariant(n,12),(r||(this.pollingInfo={})).interval=n;var i=function(){e.pollingInfo&&(zt(e.queryInfo.networkStatus)?o():e.reobserve({fetchPolicy:"network-only"},exports.NetworkStatus.poll).then(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)}},i.prototype.updateLastResult=function(t,r){return void 0===r&&(r=this.variables),this.last=e.__assign(e.__assign({},this.last),{result:this.queryManager.assumeImmutableResults?t:re(t),variables:r}),ce(t.errors)||delete this.last.error,this.last},i.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var o=n===exports.NetworkStatus.refetch||n===exports.NetworkStatus.fetchMore||n===exports.NetworkStatus.poll,s=this.options.variables,a=o?de(this.options,t):Bt(this.options,de(t));o||(this.updatePolling(),t&&t.variables&&!t.fetchPolicy&&!r.equal(t.variables,s)&&(a.fetchPolicy=this.initialFetchPolicy,void 0===n&&(n=exports.NetworkStatus.setVariables)));var u=a.variables&&e.__assign({},a.variables),c=this.fetch(a,n),l={next:function(e){i.reportResult(e,u)},error:function(e){i.reportError(e,u)}};return o||(this.concast&&this.observer&&this.concast.removeObserver(this.observer,!0),this.concast=c,this.observer=l),c.addObserver(l),c.promise},i.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},i.prototype.reportResult=function(e,t){(this.getLastError()||this.isDifferentFromLastResult(e))&&(this.updateLastResult(e,t),ie(this.observers,"next",e))},i.prototype.reportError=function(t,r){var n=e.__assign(e.__assign({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1});this.updateLastResult(n,r),ie(this.observers,"error",this.last.error=t)},i.prototype.hasObservers=function(){return this.observers.size>0},i.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},i}(n.Observable));function Ut(e){}function Kt(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)}se(Wt);var Jt=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=X(t.resolvers,e)})):this.resolvers=X(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,s=t.onlyRunForcedResolvers,a=void 0!==s&&s;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,a).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 v(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return function(e){P(e);var t=U([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=o.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return C(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 o.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 o.BREAK}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Y(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(t,r,n,i,o,s){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===s&&(s=!1),e.__awaiter(this,void 0,void 0,(function(){var a,u,c,l,f,p,h,d,v;return e.__generator(this,(function(y){return a=N(t),u=F(t),c=g(u),l=a.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:s},[2,this.resolveSelectionSet(a.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,s,a,u,c,l=this;return e.__generator(this,(function(f){return o=i.fragmentMap,s=i.context,a=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 d(r,a)?C(r)?[2,this.resolveField(r,n,i).then((function(e){var t;void 0!==e&&u.push(((t={})[Q(r)]=e,t))}))]:(I(r)?c=r:(c=o[r.name.value],t.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,s))?[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 $(u)}))]}))}))},r.prototype.resolveField=function(t,r,n){return e.__awaiter(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,p,h=this;return e.__generator(this,(function(e){return i=n.variables,o=t.name.value,s=Q(t),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(l=r.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[a?o:s])&&(c=Promise.resolve(mt.withValue(this.cache,p,[r,R(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}(),Ht=new(fe?WeakMap:Map);function Yt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Ht.set(e,(Ht.get(e)+1)%1e15),r.apply(this,arguments)})}function Gt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Xt=function(){function t(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;Ht.has(r)||(Ht.set(r,0),Yt(r,"evict"),Yt(r,"modify"),Yt(r,"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(){Gt(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){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}},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;Gt(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(zt(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.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===Ht.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=ce(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(t.variables)):0!==r&&($t(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:Ht.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),s=i.diff(o);n.stopped||n.updateWatch(t.variables),n.updateLastDiff(s,o),s.complete&&(e.data=s.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 $t(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 Zt=Object.prototype.hasOwnProperty,er=function(){function r(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,s=e.ssrMode,a=void 0!==s&&s,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 Jt({cache:t}),this.ssrMode=a,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,s=r.updateQueries,a=r.refetchQueries,u=void 0===a?[]:a,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=void 0===v?"network-only":v,b=r.keepRootFields,g=r.context;return e.__awaiter(this,void 0,void 0,(function(){var r,a,c;return e.__generator(this,(function(h){switch(h.label){case 0:return t.invariant(n,14),t.invariant("network-only"===y||"no-cache"===y,15),r=this.generateMutationId(),n=this.transform(n).document,i=this.getVariables(n,i),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,i,g)]:[3,2];case 1:i=h.sent(),h.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[r]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:r,document:n,variables:i,fetchPolicy:y,errorPolicy:d,context:g,updateQueries:s,update:f,keepRootFields:b}),this.broadcastQueries(),c=this,[2,new Promise((function(t,h){return oe(c.getObservableFromLink(n,e.__assign(e.__assign({},g),{optimisticResponse:o}),i,!1),(function(t){if(le(t)&&"none"===d)throw new Vt({graphQLErrors:t.errors});a&&(a.loading=!1,a.error=null);var h=e.__assign({},t);return"function"==typeof u&&(u=u(h)),"ignore"===d&&le(h)&&delete h.errors,c.markMutationResult({mutationId:r,result:h,document:n,variables:i,fetchPolicy:y,errorPolicy:d,context:g,update:f,updateQueries:s,awaitRefetchQueries:l,refetchQueries:u,removeOptimistic:o?r:void 0,onQueryUpdated:p,keepRootFields:b})})).subscribe({next:function(e){c.broadcastQueries(),t(e)},error:function(e){a&&(a.loading=!1,a.error=e),o&&c.cache.removeOptimistic(r),c.broadcastQueries(),h(e instanceof Vt?e:new Vt({networkError:e}))}})}))]}}))}))},r.prototype.markMutationResult=function(t,r){var n=this;void 0===r&&(r=this.cache);var i=t.result,o=[],s="no-cache"===t.fetchPolicy;if(!s&&$t(i,t.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables});var a=t.updateQueries;a&&this.queries.forEach((function(e,t){var s=e.observableQuery,u=s&&s.queryName;if(u&&Zt.call(a,u)){var c=a[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&&T(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){s||o.forEach((function(e){return r.write(e)}));var a=t.update;if(a){if(!s){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}))}a(r,i,{context:t.context,variables:t.variables})}s||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),U([J],P(r))),s=this.localState.clientQuery(i),a=o&&this.localState.serverQuery(o),u={document:i,hasClientExports:y(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:s,serverQuery:a,defaultVars:A(D(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(s),c(a)}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 Xt(this),n=new Wt({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(r){var n=this;void 0===r&&(r="active");var i=new Map,o=new Map,s=new Set;return Array.isArray(r)&&r.forEach((function(e){var t;"string"==typeof e?o.set(e,!1):_(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?o.set(n.transform(e).document,!1):_(e)&&e.query&&s.add(e)})),this.queries.forEach((function(e,t){var n=e.observableQuery,s=e.document;if(n){if("all"===r)return void i.set(t,n);var a=n.queryName;if("standby"===n.options.fetchPolicy||!n.hasObservers())return;("active"===r||a&&o.has(a)||s&&o.has(s))&&(i.set(t,n),a&&o.set(a,!0),s&&o.set(s,!0))}})),s.size&&s.forEach((function(r){var o=ye("legacyOneTimeQuery"),s=n.getQuery(o).init({document:r.query,variables:r.variables}),a=new Wt({queryManager:n,queryInfo:s,options:e.__assign(e.__assign({},r),{fetchPolicy:"network-only"})});t.invariant(a.queryId===o),s.setObservableQuery(a),i.set(o,a)})),i},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,s=e.variables,a=e.context,u=void 0===a?{}:a;r=this.transform(r).document,s=this.getVariables(r,s);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(n){if("no-cache"!==i&&($t(n,o)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),le(n))throw new Vt({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,s,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(s)},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 s,a,u=this;void 0===o&&(o=null!==(s=null==r?void 0:r.queryDeduplication)&&void 0!==s?s:this.queryDeduplication);var c=this.transform(t).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:i,operationName:T(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=ut(i);if(!(a=h.get(d))){var v=new ue([qe(f,p)]);h.set(d,a=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else a=new ue([qe(f,p)])}else a=new ue([n.Observable.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(t).clientQuery;return y&&(a=oe(a,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:i})}))),a},r.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 Vt({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var s={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(s.errors=i.errors),s}),(function(t){var r=At(t)?t:new Vt({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),s=this.getQuery(e),a=t.fetchPolicy,u=void 0===a?"cache-first":a,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,b=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:l,returnPartialData:p,notifyOnNetworkStatusChange:d,context:y}),g=function(e){return b.variables=e,n.fetchQueryByPolicy(s,b,r)};this.fetchCancelFns.set(e,(function(e){setTimeout((function(){return m.cancel(e)}))}));var m=new ue(this.transform(b.query).hasClientExports?this.localState.addExportedVariables(b.query,b.variables,b.context).then(g):g(b.variables));return m.cleanup((function(){n.fetchCancelFns.delete(e),Kt(t)})),m},r.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,s=e.removeOptimistic,a=void 0===s?o?ye("refetchQueries"):void 0:s,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&&a||!1,removeOptimistic:a,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Xt&&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,s=e.diff;if(u){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=u(i,s,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),a&&this.cache.removeOptimistic(a),l},r.prototype.fetchQueryByPolicy=function(t,r,i){var o=this,s=r.query,a=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:s,variables:a,networkStatus:i});var v=function(){return t.getDiff(a)},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:zt(i),networkStatus:i},r.complete?null:{partial:!0}))};return u&&o.transform(s).hasForcedResolvers?o.localState.runResolvers({document:s,remoteResult:{data:u},context:p,variables:a,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},b="no-cache"===u?0:i===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return o.getResultsFromLink(t,b,{variables:a,context:p,fetchPolicy:u,errorPolicy:l})},m=h&&"number"==typeof d&&d!==i&&zt(i);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,t.markReady())]:f||m?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||m?[y(_),g()]:[g()];case"cache-only":return[y(v(),t.markReady())];case"network-only":return m?[y(v()),g()]:[g()];case"no-cache":return m?[y(t.getDiff()),g()]:[g()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Xt(this,e)),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 tr(t,r){return de(t,r,r.variables&&{variables:e.__assign(e.__assign({},t.variables),r.variables)})}var rr=function(){function r(e){var r=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,s=e.cache,a=e.ssrMode,u=void 0!==a&&a,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,b=void 0!==y&&y,g=e.resolvers,m=e.typeDefs,_=e.fragmentMatcher,O=e.name,w=e.version,S=e.link;if(S||(S=n?new Le({uri:n,credentials:i,headers:o}):we.empty()),!s)throw new t.InvariantError(9);this.link=S,this.cache=s,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=m,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.12",this.localState=new Jt({cache:s,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new er({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:O,version:w},localState:this.localState,assumeImmutableResults:b,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=tr(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=tr(this.defaultOptions.query,r)),t.invariant("cache-and-network"!==r.fetchPolicy,10),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=tr(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 qe(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.catch((function(e){})),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}(),nr=he?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function ir(){var e=p.createContext[nr];return e||(Object.defineProperty(p.createContext,nr,{value:e=p.createContext({}),enumerable:!1,writable:!1,configurable:!0}),e.displayName="ApolloContext"),e}var or;exports.DocumentType=void 0,(or=exports.DocumentType||(exports.DocumentType={}))[or.Query=0]="Query",or[or.Mutation=1]="Mutation",or[or.Subscription=2]="Subscription";var sr=new Map;function ar(e){var t;switch(e){case exports.DocumentType.Query:t="Query";break;case exports.DocumentType.Mutation:t="Mutation";break;case exports.DocumentType.Subscription:t="Subscription"}return t}function ur(e){var r,n,i=sr.get(e);if(i)return i;t.invariant(!!e&&!!e.kind,34);var o=e.definitions.filter((function(e){return"FragmentDefinition"===e.kind})),s=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"query"===e.operation})),a=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})),u=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"subscription"===e.operation}));t.invariant(!o.length||s.length||a.length||u.length,35),t.invariant(s.length+a.length+u.length<=1,36),n=s.length?exports.DocumentType.Query:exports.DocumentType.Mutation,s.length||a.length||(n=exports.DocumentType.Subscription);var c=s.length?s:a.length?a:u;t.invariant(1===c.length,37);var l=c[0];r=l.variableDefinitions||[];var f={name:l.name&&"Name"===l.name.kind?l.name.value:"data",type:n,variables:r};return sr.set(e,f),f}var cr=function(){function e(e,t){this.isMounted=!1,this.previousOptions={},this.context={},this.options={},this.options=e||{},this.context=t||{}}return e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(e,t){void 0===t&&(t=!1),t&&!r.equal(this.options,e)&&(this.previousOptions=this.options),this.options=e},e.prototype.unmount=function(){this.isMounted=!1},e.prototype.refreshClient=function(){var e=this.options&&this.options.client||this.context&&this.context.client;t.invariant(!!e,29);var r=!1;return e!==this.client&&(r=!0,this.client=e,this.cleanup()),{client:this.client,isNew:r}},e.prototype.verifyDocumentType=function(e,r){var n=ur(e);ar(r),ar(n.type);t.invariant(n.type===r,30)},e}(),lr=function(t){function n(e){var r=e.options,n=e.context,i=e.setResult,o=t.call(this,r,n)||this;return o.currentObservable={},o.setResult=i,o.initialize(r),o}return e.__extends(n,t),n.prototype.execute=function(t){if(!0===this.getOptions().skip)return this.cleanup(),{loading:!1,error:void 0,data:void 0,variables:this.getOptions().variables};var n=t;this.refreshClient().isNew&&(n=this.getLoadingResult());var i=this.getOptions().shouldResubscribe;return"function"==typeof i&&(i=!!i(this.getOptions())),!1!==i&&this.previousOptions&&Object.keys(this.previousOptions).length>0&&(this.previousOptions.subscription!==this.getOptions().subscription||!r.equal(this.previousOptions.variables,this.getOptions().variables)||this.previousOptions.skip!==this.getOptions().skip)&&(this.cleanup(),n=this.getLoadingResult()),this.initialize(this.getOptions()),this.startSubscription(),this.previousOptions=this.getOptions(),e.__assign(e.__assign({},n),{variables:this.getOptions().variables})},n.prototype.afterExecute=function(){this.isMounted=!0},n.prototype.cleanup=function(){this.endSubscription(),delete this.currentObservable.query},n.prototype.initialize=function(e){this.currentObservable.query||!0===this.getOptions().skip||(this.currentObservable.query=this.refreshClient().client.subscribe({query:e.subscription,variables:e.variables,fetchPolicy:e.fetchPolicy,context:e.context}))},n.prototype.startSubscription=function(){this.currentObservable.subscription||(this.currentObservable.subscription=this.currentObservable.query.subscribe({next:this.updateCurrentData.bind(this),error:this.updateError.bind(this),complete:this.completeSubscription.bind(this)}))},n.prototype.getLoadingResult=function(){return{loading:!0,error:void 0,data:void 0}},n.prototype.updateResult=function(e){this.isMounted&&this.setResult(e)},n.prototype.updateCurrentData=function(e){var t=this.getOptions().onSubscriptionData;this.updateResult({data:e.data,loading:!1,error:void 0}),t&&t({client:this.refreshClient().client,subscriptionData:e})},n.prototype.updateError=function(e){this.updateResult({error:e,loading:!1})},n.prototype.completeSubscription=function(){var e=this;Promise.resolve().then((function(){var t=e.getOptions().onSubscriptionComplete;t&&t(),e.endSubscription()}))},n.prototype.endSubscription=function(){this.currentObservable.subscription&&(this.currentObservable.subscription.unsubscribe(),delete this.currentObservable.subscription)},n}(cr),fr=function(t){function n(e){var r=e.options,n=e.context,i=e.result,o=e.setResult,s=t.call(this,r,n)||this;return s.runMutation=function(e){void 0===e&&(e={}),s.onMutationStart();var t=s.generateNewMutationId();return s.mutate(e).then((function(e){return s.onMutationCompleted(e,t),e})).catch((function(e){var r=s.getOptions().onError;if(s.onMutationError(e,t),r)return r(e),{data:void 0,errors:e};throw e}))},s.verifyDocumentType(r.mutation,exports.DocumentType.Mutation),s.result=i,s.setResult=o,s.mostRecentMutationId=0,s}return e.__extends(n,t),n.prototype.execute=function(t){return this.isMounted=!0,this.verifyDocumentType(this.getOptions().mutation,exports.DocumentType.Mutation),[this.runMutation,e.__assign(e.__assign({},t),{client:this.refreshClient().client})]},n.prototype.afterExecute=function(){return this.isMounted=!0,this.unmount.bind(this)},n.prototype.cleanup=function(){},n.prototype.mutate=function(e){return this.refreshClient().client.mutate(tr(this.getOptions(),e))},n.prototype.onMutationStart=function(){this.result.loading||this.getOptions().ignoreResults||this.updateResult({loading:!0,error:void 0,data:void 0,called:!0})},n.prototype.onMutationCompleted=function(e,t){var r=this.getOptions(),n=r.onCompleted,i=r.ignoreResults,o=e.data,s=e.errors,a=s&&s.length>0?new Vt({graphQLErrors:s}):void 0;this.isMostRecentMutation(t)&&!i&&this.updateResult({called:!0,loading:!1,data:o,error:a}),n&&n(o)},n.prototype.onMutationError=function(e,t){this.isMostRecentMutation(t)&&this.updateResult({loading:!1,error:e,data:void 0,called:!0})},n.prototype.generateNewMutationId=function(){return++this.mostRecentMutationId},n.prototype.isMostRecentMutation=function(e){return this.mostRecentMutationId===e},n.prototype.updateResult=function(e){if(this.isMounted&&(!this.previousResult||!r.equal(this.previousResult,e)))return this.setResult(e),this.previousResult=e,e},n}(cr),pr=function(t){function n(e){var r=e.options,n=e.context,i=e.onNewData,o=t.call(this,r,n)||this;return o.runLazy=!1,o.previous=Object.create(null),o.runLazyQuery=function(e){o.cleanup(),o.runLazy=!0,o.lazyOptions=e,o.onNewData()},o.obsRefetch=function(e){var t;return null===(t=o.currentObservable)||void 0===t?void 0:t.refetch(e)},o.obsFetchMore=function(e){var t;return null===(t=o.currentObservable)||void 0===t?void 0:t.fetchMore(e)},o.obsUpdateQuery=function(e){var t;return null===(t=o.currentObservable)||void 0===t?void 0:t.updateQuery(e)},o.obsStartPolling=function(e){var t;null===(t=o.currentObservable)||void 0===t||t.startPolling(e)},o.obsStopPolling=function(){var e;null===(e=o.currentObservable)||void 0===e||e.stopPolling()},o.obsSubscribeToMore=function(e){var t;return null===(t=o.currentObservable)||void 0===t?void 0:t.subscribeToMore(e)},o.onNewData=i,o}return e.__extends(n,t),n.prototype.execute=function(){this.refreshClient();var e=this.getOptions(),t=e.skip,r=e.query;return(t||r!==this.previous.query)&&(this.removeQuerySubscription(),this.removeObservable(!t),this.previous.query=r),this.updateObservableQuery(),this.getExecuteSsrResult()||this.getExecuteResult()},n.prototype.executeLazy=function(){return this.runLazy?[this.runLazyQuery,this.execute()]:[this.runLazyQuery,{loading:!1,networkStatus:exports.NetworkStatus.ready,called:!1,data:void 0}]},n.prototype.fetchData=function(){var e=this,t=this.getOptions();return!t.skip&&!1!==t.ssr&&new Promise((function(t){return e.startQuerySubscription(t)}))},n.prototype.afterExecute=function(e){var t=(void 0===e?{}:e).lazy,r=void 0!==t&&t;this.isMounted=!0;var n=this.getOptions();return this.currentObservable&&!this.ssrInitiated()&&this.startQuerySubscription(),r&&!this.runLazy||this.handleErrorOrCompleted(),this.previousOptions=n,this.unmount.bind(this)},n.prototype.cleanup=function(){this.removeQuerySubscription(),this.removeObservable(!0),delete this.previous.result},n.prototype.getOptions=function(){var r=t.prototype.getOptions.call(this);return this.lazyOptions&&(r.variables=e.__assign(e.__assign({},r.variables),this.lazyOptions.variables),r.context=e.__assign(e.__assign({},r.context),this.lazyOptions.context)),this.runLazy&&delete r.skip,r},n.prototype.ssrInitiated=function(){return this.context&&this.context.renderPromises},n.prototype.getExecuteSsrResult=function(){var t=this.getOptions(),r=t.ssr,n=t.skip,i=!1===r,o=this.refreshClient().client.disableNetworkFetches,s=e.__assign({loading:!0,networkStatus:exports.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());if(i&&(this.ssrInitiated()||o))return this.previous.result=s,s;if(this.ssrInitiated()){var a=this.getExecuteResult()||s;return a.loading&&!n&&this.context.renderPromises.addQueryPromise(this,(function(){return null})),a}},n.prototype.prepareObservableQueryOptions=function(){var t=this.getOptions();this.verifyDocumentType(t.query,exports.DocumentType.Query);var r=t.displayName||"Query";return!this.ssrInitiated()||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t.fetchPolicy="cache-first"),e.__assign(e.__assign({},t),{displayName:r,context:t.context})},n.prototype.initializeObservableQuery=function(){if(this.ssrInitiated()&&(this.currentObservable=this.context.renderPromises.getSSRObservable(this.getOptions())),!this.currentObservable){var t=this.prepareObservableQueryOptions();this.previous.observableQueryOptions=e.__assign(e.__assign({},t),{children:void 0}),this.currentObservable=this.refreshClient().client.watchQuery(e.__assign({},t)),this.ssrInitiated()&&this.context.renderPromises.registerSSRObservable(this.currentObservable,t)}},n.prototype.updateObservableQuery=function(){if(this.currentObservable){var t=e.__assign(e.__assign({},this.prepareObservableQueryOptions()),{children:void 0});this.getOptions().skip?this.previous.observableQueryOptions=t:r.equal(t,this.previous.observableQueryOptions)||(this.previous.observableQueryOptions=t,this.currentObservable.setOptions(t).catch((function(){})))}else this.initializeObservableQuery()},n.prototype.startQuerySubscription=function(e){var t=this;void 0===e&&(e=this.onNewData),this.currentSubscription||this.getOptions().skip||(this.currentSubscription=this.currentObservable.subscribe({next:function(n){var i=n.loading,o=n.networkStatus,s=n.data,a=t.previous.result;a&&a.loading===i&&a.networkStatus===o&&r.equal(a.data,s)||e()},error:function(n){if(t.resubscribeToQuery(),!n.hasOwnProperty("graphQLErrors"))throw n;var i=t.previous.result;(i&&i.loading||!r.equal(n,t.previous.error))&&(t.previous.error=n,e())}}))},n.prototype.resubscribeToQuery=function(){this.removeQuerySubscription();var e=this.currentObservable;if(e){var t=e.last;try{e.resetLastResults(),this.startQuerySubscription()}finally{e.last=t}}},n.prototype.getExecuteResult=function(){var t=this.observableQueryFields(),r=this.getOptions();if(r.skip)t=e.__assign(e.__assign({},t),{data:void 0,error:void 0,loading:!1,networkStatus:exports.NetworkStatus.ready,called:!0});else if(this.currentObservable){var n=this.currentObservable.getCurrentResult(),i=n.data,o=n.loading,s=n.partial,a=n.networkStatus,u=n.errors,c=n.error;if(u&&u.length>0&&(c=new Vt({graphQLErrors:u})),t=e.__assign(e.__assign({},t),{data:i,loading:o,networkStatus:a,error:c,called:!0}),o);else if(c)Object.assign(t,{data:(this.currentObservable.getLastResult()||{}).data});else{var l=this.currentObservable.options.fetchPolicy;if(r.partialRefetch&&s&&(!i||0===Object.keys(i).length)&&"cache-only"!==l)return Object.assign(t,{loading:!0,networkStatus:exports.NetworkStatus.loading}),t.refetch(),t}}t.client=this.client,this.setOptions(r,!0);var f=this.previous.result;return this.previous.loading=f&&f.loading||!1,t.previousData=f&&(f.data||f.previousData),this.previous.result=t,this.currentObservable&&this.currentObservable.resetQueryStoreErrors(),t},n.prototype.handleErrorOrCompleted=function(){if(this.currentObservable&&this.previous.result){var e=this.previous.result,t=e.data,n=e.loading,i=e.error;if(!n){var o=this.getOptions(),s=o.query,a=o.variables,u=o.onCompleted,c=o.onError,l=o.skip;if(this.previousOptions&&!this.previous.loading&&r.equal(this.previousOptions.query,s)&&r.equal(this.previousOptions.variables,a))return;!u||i||l?c&&i&&c(i):u(t)}}},n.prototype.removeQuerySubscription=function(){this.currentSubscription&&(this.currentSubscription.unsubscribe(),delete this.currentSubscription)},n.prototype.removeObservable=function(e){this.currentObservable&&(this.currentObservable.tearDownQuery(),e&&delete this.currentObservable)},n.prototype.observableQueryFields=function(){var e;return{variables:null===(e=this.currentObservable)||void 0===e?void 0:e.variables,refetch:this.obsRefetch,fetchMore:this.obsFetchMore,updateQuery:this.obsUpdateQuery,startPolling:this.obsStartPolling,stopPolling:this.obsStopPolling,subscribeToMore:this.obsSubscribeToMore}},n}(cr);function hr(t,n,i){void 0===i&&(i=!1);var o=l.useContext(ir()),s=l.useReducer((function(e){return e+1}),0),a=s[0],u=s[1],c=n?e.__assign(e.__assign({},n),{query:t}):{query:t},f=l.useRef(),p=f.current||(f.current=new pr({options:c,context:o,onNewData:function(){p.ssrInitiated()?u():Promise.resolve().then((function(){return f.current&&f.current.isMounted&&u()}))}}));p.setOptions(c),p.context=o;var h,d,v,y={options:e.__assign(e.__assign({},c),{onError:void 0,onCompleted:void 0}),context:o,tick:a},b=(h=function(){return i?p.executeLazy():p.execute()},d=y,(v=l.useRef()).current&&r.equal(d,v.current.key)||(v.current={key:d,value:h()}),v.current.value),g=i?b[1]:b;return l.useEffect((function(){return function(){p.cleanup(),f.current=void 0}}),[]),l.useEffect((function(){return p.afterExecute({lazy:i})}),[g.loading,g.networkStatus,g.error,g.data,p.currentObservable]),b}exports.setLogVerbosity=t.setVerbosity,exports.Observable=n.Observable,exports.disableExperimentalFragmentVariables=c.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=c.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=c.enableExperimentalFragmentVariables,exports.gql=c.gql,exports.resetCaches=c.resetCaches,exports.ApolloCache=Ve,exports.ApolloClient=rr,exports.ApolloConsumer=function(e){var r=ir();return p.createElement(r.Consumer,null,(function(r){return t.invariant(r&&r.client,27),e.children(r.client)}))},exports.ApolloError=Vt,exports.ApolloLink=we,exports.ApolloProvider=function(e){var r=e.client,n=e.children,i=ir();return p.createElement(i.Consumer,null,(function(e){return void 0===e&&(e={}),r&&e.client!==r&&(e=Object.assign({},e,{client:r})),t.invariant(e.client,28),p.createElement(i.Provider,{value:e},n)}))},exports.HttpLink=Le,exports.InMemoryCache=Nt,exports.MissingFieldError=ze,exports.ObservableQuery=Wt,exports.applyNextFetchPolicy=Kt,exports.checkFetcher=De,exports.concat=Ee,exports.createHttpLink=Ae,exports.createSignalIfSupported=Te,exports.defaultDataIdFromObject=xt,exports.empty=Se,exports.execute=qe,exports.fallbackHttpConfig=Ce,exports.from=ke,exports.fromError=be,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.getApolloContext=ir,exports.isApolloError=At,exports.isReference=w,exports.makeReference=O,exports.makeVar=wt,exports.mergeOptions=tr,exports.operationName=ar,exports.parseAndCheckHttpResponse=Qe,exports.parser=ur,exports.resetApolloContext=ir,exports.rewriteURIForGET=je,exports.selectHttpOptionsAndBody=Ie,exports.selectURI=Fe,exports.serializeFetchParameter=Me,exports.split=xe,exports.throwServerError=ge,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})}))},exports.useApolloClient=function(){var e=p.useContext(ir()).client;return t.invariant(e,33),e},exports.useLazyQuery=function(e,t){return hr(e,t,!0)},exports.useMutation=function(t,r){var n=l.useContext(ir()),i=l.useState({called:!1,loading:!1}),o=i[0],s=i[1],a=r?e.__assign(e.__assign({},r),{mutation:t}):{mutation:t},u=l.useRef(),c=(u.current||(u.current=new fr({options:a,context:n,result:o,setResult:s})),u.current);return c.setOptions(a),c.context=n,l.useEffect((function(){return c.afterExecute()})),c.execute(o)},exports.useQuery=function(e,t){return hr(e,t,!1)},exports.useReactiveVar=function(e){var t=e(),r=l.useState(t)[1];return l.useEffect((function(){var n=e();if(t===n)return e.onNextChange(r);r(n)}),[t]),t},exports.useSubscription=function(t,r){l.useReducer((function(e){return e+1}),0)[1];var n=l.useContext(ir()),i=r?e.__assign(e.__assign({},r),{subscription:t}):{subscription:t},o=l.useState({loading:!i.skip,error:void 0,data:void 0}),s=o[0],a=o[1],u=l.useRef(),c=(u.current||(u.current=new lr({options:i,context:n,setResult:a})),u.current);return c.setOptions(i,!0),c.context=n,l.useEffect((function(){return c.afterExecute()})),l.useEffect((function(){return function(){c.cleanup(),u.current=void 0}}),[]),c.execute(s)};
|
package/cache/cache.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var utilities = require('../utilities');
|
|
5
|
+
var globals = require('../utilities/globals');
|
|
7
6
|
var tslib = require('tslib');
|
|
8
7
|
var optimism = require('optimism');
|
|
8
|
+
var utilities = require('../utilities');
|
|
9
9
|
var equality = require('@wry/equality');
|
|
10
10
|
var trie = require('@wry/trie');
|
|
11
11
|
var context = require('@wry/context');
|
|
@@ -203,7 +203,7 @@ exports.EntityStore = (function () {
|
|
|
203
203
|
: newer;
|
|
204
204
|
if (!incoming)
|
|
205
205
|
return;
|
|
206
|
-
__DEV__ ?
|
|
206
|
+
__DEV__ ? globals.invariant(typeof dataId === "string", "store.merge expects a string ID") : globals.invariant(typeof dataId === "string", 1);
|
|
207
207
|
var merged = new utilities.DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
208
208
|
this.data[dataId] = merged;
|
|
209
209
|
if (merged !== existing) {
|
|
@@ -794,7 +794,7 @@ var StoreReader = (function () {
|
|
|
794
794
|
!context.store.has(objectOrReference.__ref)) {
|
|
795
795
|
return {
|
|
796
796
|
result: this.canon.empty,
|
|
797
|
-
missing: [missingFromInvariant(__DEV__ ? new
|
|
797
|
+
missing: [missingFromInvariant(__DEV__ ? new globals.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new globals.InvariantError(5), context)],
|
|
798
798
|
};
|
|
799
799
|
}
|
|
800
800
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -831,9 +831,9 @@ var StoreReader = (function () {
|
|
|
831
831
|
context.path.push(resultName);
|
|
832
832
|
if (fieldValue === void 0) {
|
|
833
833
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
834
|
-
getMissing().push(missingFromInvariant(__DEV__ ? new
|
|
834
|
+
getMissing().push(missingFromInvariant(__DEV__ ? new globals.InvariantError("Can't find field '" + selection.name.value + "' on " + (utilities.isReference(objectOrReference)
|
|
835
835
|
? objectOrReference.__ref + " object"
|
|
836
|
-
: "object " + JSON.stringify(objectOrReference, null, 2))) : new
|
|
836
|
+
: "object " + JSON.stringify(objectOrReference, null, 2))) : new globals.InvariantError(6), context));
|
|
837
837
|
}
|
|
838
838
|
}
|
|
839
839
|
else if (Array.isArray(fieldValue)) {
|
|
@@ -860,7 +860,7 @@ var StoreReader = (function () {
|
|
|
860
860
|
if (fieldValue !== void 0) {
|
|
861
861
|
objectsToMerge.push((_a = {}, _a[resultName] = fieldValue, _a));
|
|
862
862
|
}
|
|
863
|
-
|
|
863
|
+
globals.invariant(context.path.pop() === resultName);
|
|
864
864
|
}
|
|
865
865
|
else {
|
|
866
866
|
var fragment = utilities.getFragmentFromSelection(selection, context.fragmentMap);
|
|
@@ -885,7 +885,7 @@ var StoreReader = (function () {
|
|
|
885
885
|
missing = missing || [];
|
|
886
886
|
missing.push.apply(missing, childResult.missing);
|
|
887
887
|
}
|
|
888
|
-
|
|
888
|
+
globals.invariant(context.path.pop() === i);
|
|
889
889
|
return childResult.result;
|
|
890
890
|
}
|
|
891
891
|
if (field.selectionSet) {
|
|
@@ -915,7 +915,7 @@ var StoreReader = (function () {
|
|
|
915
915
|
if (__DEV__) {
|
|
916
916
|
assertSelectionSetForIdValue(context.store, field, item);
|
|
917
917
|
}
|
|
918
|
-
|
|
918
|
+
globals.invariant(context.path.pop() === i);
|
|
919
919
|
return item;
|
|
920
920
|
});
|
|
921
921
|
return {
|
|
@@ -930,7 +930,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
930
930
|
var workSet_1 = new Set([fieldValue]);
|
|
931
931
|
workSet_1.forEach(function (value) {
|
|
932
932
|
if (utilities.isNonNullObject(value)) {
|
|
933
|
-
__DEV__ ?
|
|
933
|
+
__DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : globals.invariant(!utilities.isReference(value), 7);
|
|
934
934
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
935
935
|
}
|
|
936
936
|
});
|
|
@@ -969,7 +969,7 @@ var StoreWriter = (function () {
|
|
|
969
969
|
context: context,
|
|
970
970
|
});
|
|
971
971
|
if (!utilities.isReference(ref)) {
|
|
972
|
-
throw __DEV__ ? new
|
|
972
|
+
throw __DEV__ ? new globals.InvariantError("Could not identify object " + JSON.stringify(result)) : new globals.InvariantError(8);
|
|
973
973
|
}
|
|
974
974
|
context.incomingById.forEach(function (_a, dataId) {
|
|
975
975
|
var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections;
|
|
@@ -1078,7 +1078,7 @@ var StoreWriter = (function () {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
else if (!context.clientOnly &&
|
|
1080
1080
|
!utilities.addTypenameToDocument.added(selection)) {
|
|
1081
|
-
__DEV__ &&
|
|
1081
|
+
__DEV__ && globals.invariant.error(("Missing field '" + utilities.resultKeyNameFromField(selection) + "' while writing result " + JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
1082
1082
|
}
|
|
1083
1083
|
context.clientOnly = wasClientOnly;
|
|
1084
1084
|
}
|
|
@@ -1158,7 +1158,7 @@ var StoreWriter = (function () {
|
|
|
1158
1158
|
changedFields_1.set(storeFieldName, aVal);
|
|
1159
1159
|
}
|
|
1160
1160
|
if (getStorageArgs) {
|
|
1161
|
-
|
|
1161
|
+
globals.invariant(getStorageArgs.pop() === storeFieldName);
|
|
1162
1162
|
}
|
|
1163
1163
|
});
|
|
1164
1164
|
if (changedFields_1) {
|
|
@@ -1253,7 +1253,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1253
1253
|
}
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
|
-
__DEV__ &&
|
|
1256
|
+
__DEV__ && globals.invariant.warn("Cache data may be lost when replacing the " + fieldName + " field of a " + parentType + " object.\n\nTo address this problem (which is not a bug in Apollo Client), " + (childTypenames.length
|
|
1257
1257
|
? "either ensure all objects of type " +
|
|
1258
1258
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
1259
1259
|
: "") + "define a custom merge function for the " + typeDotName + " field, so InMemoryCache can safely merge these objects:\n\n existing: " + JSON.stringify(existing).slice(0, 1000) + "\n incoming: " + JSON.stringify(incoming).slice(0, 1000) + "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n");
|
|
@@ -1466,7 +1466,7 @@ var Policies = (function () {
|
|
|
1466
1466
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
1467
1467
|
var old = this.rootTypenamesById[rootId];
|
|
1468
1468
|
if (typename !== old) {
|
|
1469
|
-
__DEV__ ?
|
|
1469
|
+
__DEV__ ? globals.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : globals.invariant(!old || old === which, 2);
|
|
1470
1470
|
if (old)
|
|
1471
1471
|
delete this.rootIdsByTypename[old];
|
|
1472
1472
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -1550,7 +1550,7 @@ var Policies = (function () {
|
|
|
1550
1550
|
if (supertypeSet.has(supertype)) {
|
|
1551
1551
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
1552
1552
|
if (checkingFuzzySubtypes) {
|
|
1553
|
-
__DEV__ &&
|
|
1553
|
+
__DEV__ && globals.invariant.warn("Inferring subtype " + typename + " of supertype " + supertype);
|
|
1554
1554
|
}
|
|
1555
1555
|
typenameSupertypeSet.add(supertype);
|
|
1556
1556
|
}
|
|
@@ -1693,11 +1693,11 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
else {
|
|
1696
|
-
__DEV__ &&
|
|
1696
|
+
__DEV__ && globals.invariant.warn("Unexpected readField arguments: " + utilities.stringifyForDisplay(Array.from(arguments)));
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
1699
|
if (__DEV__ && options.from === void 0) {
|
|
1700
|
-
__DEV__ &&
|
|
1700
|
+
__DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments " + utilities.stringifyForDisplay(Array.from(arguments)));
|
|
1701
1701
|
}
|
|
1702
1702
|
if (void 0 === options.variables) {
|
|
1703
1703
|
options.variables = variables;
|
|
@@ -1710,7 +1710,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
1710
1710
|
function makeMergeObjectsFunction(store) {
|
|
1711
1711
|
return function mergeObjects(existing, incoming) {
|
|
1712
1712
|
if (Array.isArray(existing) || Array.isArray(incoming)) {
|
|
1713
|
-
throw __DEV__ ? new
|
|
1713
|
+
throw __DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(3);
|
|
1714
1714
|
}
|
|
1715
1715
|
if (utilities.isNonNullObject(existing) &&
|
|
1716
1716
|
utilities.isNonNullObject(incoming)) {
|
|
@@ -1810,7 +1810,7 @@ function computeKeyObject(response, specifier, strict, aliasMap) {
|
|
|
1810
1810
|
keyObj[lastActualKey = s] = response[lastResponseKey = responseName];
|
|
1811
1811
|
}
|
|
1812
1812
|
else {
|
|
1813
|
-
__DEV__ ?
|
|
1813
|
+
__DEV__ ? globals.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : globals.invariant(!strict, 4);
|
|
1814
1814
|
lastResponseKey = lastActualKey = void 0;
|
|
1815
1815
|
}
|
|
1816
1816
|
}
|
|
@@ -2103,8 +2103,6 @@ var InMemoryCache = (function (_super) {
|
|
|
2103
2103
|
return InMemoryCache;
|
|
2104
2104
|
}(ApolloCache));
|
|
2105
2105
|
|
|
2106
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof utilities.DEV, utilities.DEV) : tsInvariant.invariant("boolean" === typeof utilities.DEV, 1);
|
|
2107
|
-
|
|
2108
2106
|
exports.isReference = utilities.isReference;
|
|
2109
2107
|
exports.makeReference = utilities.makeReference;
|
|
2110
2108
|
exports.ApolloCache = ApolloCache;
|