@apollo/client 3.7.2 → 3.7.3

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("ts-invariant"),r=require("@wry/equality"),n=require("zen-observable-ts");require("symbol-observable");var i=require("graphql"),o=require("optimism"),a=require("@wry/context"),s=require("@wry/trie"),u=require("graphql-tag"),c=require("react");function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e)for(var r in e)t[r]=e[r];return t.default=e,Object.freeze(t)}var f=l(c);function p(e){try{return e()}catch(e){}}function h(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 d(e,t,r){var n=new Set(e),o=n.size;return i.visit(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return i.BREAK}}),r?!n.size:n.size<o}function v(e){return e&&d(["client","export"],e,!0)}function y(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 m(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function g(e,r){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var n=e.name.value;if("function"==typeof r)return r(n);var i=r&&r[n];return t.invariant(i,45),i||null;default:return null}}function b(e){return null!==e&&"object"==typeof e}function _(e){return{__ref:String(e)}}function w(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function O(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 O(o,e.name,e.value,i)})),e[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];e[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))e[r.value]=n.values.map((function(e){var t={};return O(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))e[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new t.InvariantError(54);e[r.value]=null}}var S=["connection","include","skip","client","rest","export"],k=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]})),"".concat(r.connection.key,"(").concat(x(i),")")}return r.connection.key}var o=e;if(t){var a=x(t);o+="(".concat(a,")")}return r&&Object.keys(r).forEach((function(e){-1===S.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(x(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=x;return x=e,t}}),x=function(e){return JSON.stringify(e,E)};function E(e,t){return b(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function q(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return O(r,n,i,t)})),r}return null}function R(e){return e.alias?e.alias.value:e.name.value}function P(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(Q(o)){if("__typename"===o.name.value)return e[R(o)]}else{var a=P(e,g(o,r).selectionSet,r);if("string"==typeof a)return a}}}function Q(e){return"Field"===e.kind}function F(e){return"InlineFragment"===e.kind}function C(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 C(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function I(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function M(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 T(e){var r;C(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new t.InvariantError(53)}function N(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&O(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 A={kind:"Field",name:{kind:"Name",value:"__typename"}};function V(e,t){return!e||e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&V(t[e.name.value],t)}))}function z(e){return V(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),m(M(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 B(t,r){var n=Object.create(null),o=[],a=Object.create(null),s=[],u=z(i.visit(r,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(n[e.name.value]=!0)}},Field:{enter:function(e){if(t&&e.directives&&(t.some((function(e){return e.remove}))&&e.directives&&e.directives.some(W(t))))return e.arguments&&e.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),e.selectionSet&&K(e.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(e){if(W(t)(e))return null}}}));return u&&L(o,(function(e){return!!e.name&&!n[e.name]})).length&&(u=function(t,r){var n=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(t);return z(i.visit(r,{OperationDefinition:{enter:function(r){return e.__assign(e.__assign({},r),{variableDefinitions:r.variableDefinitions?r.variableDefinitions.filter((function(e){return!t.some((function(t){return t.name===e.variable.name.value}))})):[]})}},Field:{enter:function(e){if(t.some((function(e){return e.remove}))){var r=0;if(e.arguments&&e.arguments.forEach((function(e){n(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(n(e))return null}}}))}(o,u)),u&&L(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return z(i.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(s,u)),u}var U=Object.assign((function(t){return i.visit(t,{SelectionSet:{enter:function(t,r,n){if(!n||"OperationDefinition"!==n.kind){var i=t.selections;if(i)if(!i.some((function(e){return Q(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(Q(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return e.__assign(e.__assign({},t),{selections:e.__spreadArray(e.__spreadArray([],i,!0),[A],!1)})}}}}})}),{added:function(e){return e===A}}),H={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 K(e){var t=[];return e.selections.forEach((function(e){(Q(e)||F(e))&&e.selectionSet?K(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function J(t){return"query"===T(t).operation?t:i.visit(t,{OperationDefinition:{enter:function(t){return e.__assign(e.__assign({},t),{operation:"query"})}}})}var G=Object.prototype.hasOwnProperty;function Y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return X(e)}function X(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new Z,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var $=function(e,t,r){return this.merge(e[r],t[r])},Z=function(){function t(e){void 0===e&&(e=$),this.reconciler=e,this.isObject=b,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 b(r)&&b(t)?(Object.keys(r).forEach((function(o){if(G.call(t,o)){var a=t[o];if(r[o]!==a){var s=n.reconciler.apply(n,e.__spreadArray([t,r,o],i,!1));s!==a&&((t=n.shallowCopyForMerge(t))[o]=s)}}else(t=n.shallowCopyForMerge(t))[o]=r[o]})),t):r},t.prototype.shallowCopyForMerge=function(t){return b(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}(),ee=Object.prototype.toString;function te(e){return re(e)}function re(e,t){switch(ee.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]=re(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]=re(e[r],t)})),n;default:return e}}function ne(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function ie(e,t,r){return new n.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}var oe="function"==typeof WeakMap&&"ReactNative"!==p((function(){return navigator.product})),ae="function"==typeof WeakSet,se="function"==typeof Symbol&&"function"==typeof Symbol.for,ue=se&&Symbol.asyncIterator,ce="function"==typeof p((function(){return window.document.createElement})),le=p((function(){return navigator.userAgent.indexOf("jsdom")>=0}))||!1,fe=ce&&!le;function pe(e){function t(t){Object.defineProperty(e,t,{value:n.Observable})}return se&&Symbol.species&&t(Symbol.species),t("@@species"),e}function he(e){return e&&"function"==typeof e.then}var de=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.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],r.notify("next",e),ne(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),r.notify("error",e),ne(r.observers,"error",e))},complete:function(){var e=r.sub;if(null!==e){var t=r.sources.shift();t?he(t)?t.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=t.subscribe(r.handlers):(e&&setTimeout((function(){return e.unsubscribe()})),r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),r.notify("complete"),ne(r.observers,"complete"))}}},r.nextResultListeners=new Set,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)]),he(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))},r.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},r.prototype.notify=function(e,t){var r=this.nextResultListeners;r.size&&(this.nextResultListeners=new Set,r.forEach((function(r){return r(e,t)})))},r.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add((function(r,n){t||(t=!0,e(r,n))}))},r}(n.Observable);function ve(e){return Array.isArray(e)&&e.length>0}function ye(e){return e.errors&&e.errors.length>0||!1}function me(){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}pe(de);var ge=new Map;function be(e){var t=ge.get(e)||1;return ge.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function _e(t,r){return me(t,r,r.variables&&{variables:e.__assign(e.__assign({},t&&t.variables),r.variables)})}function we(e){return new n.Observable((function(t){t.error(e)}))}var Oe=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 Se(e,t){return t?t(e):n.Observable.of()}function ke(e){return"function"==typeof e?new Ee(e):e}function xe(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 Ee=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(ke).reduce((function(e,t){return e.concat(t)}))},r.split=function(e,t,i){var o=ke(t),a=ke(i||new r(Se));return xe(o)&&xe(a)?new r((function(t){return e(t)?o.request(t)||n.Observable.of():a.request(t)||n.Observable.of()})):new r((function(t,r){return e(t)?o.request(t,r)||n.Observable.of():a.request(t,r)||n.Observable.of()}))},r.execute=function(r,i){return r.request(function(t,r){var n=e.__assign({},t);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(t){n="function"==typeof t?e.__assign(e.__assign({},n),t(n)):e.__assign(e.__assign({},n),t)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return e.__assign({},n)}}),r}(i.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?I(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=ke(e);if(xe(i))return i;var o=ke(t);return xe(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(Se)))},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}(),qe=Ee.empty,Re=Ee.from,Pe=Ee.split,Qe=Ee.concat,Fe=Ee.execute;function Ce(e){var t=null,r=null,n=!1,i=[],o=[];function a(e){if(!r){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}i.push(e)}}function s(e){r=e,o.slice().forEach((function(t){t[1](e)})),!t||t()}function u(){n=!0,o.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!t||t()}t=function(){t=null,e.removeListener("data",a),e.removeListener("error",s),e.removeListener("end",u),e.removeListener("finish",u),e.removeListener("close",u)},e.on("data",a),e.on("error",s),e.on("end",u),e.on("finish",u),e.on("close",u);var c={next:function(){return new Promise((function(e,t){return r?t(r):i.length?e({value:i.shift(),done:!1}):n?e({value:void 0,done:!0}):void o.push([e,t])}))}};return ue&&(c[Symbol.asyncIterator]=function(){return this}),c}function De(e){var t={next:function(){return e.read()}};return ue&&(t[Symbol.asyncIterator]=function(){return this}),t}function Ie(e){var t,r,n=e;if(e.body&&(n=e.body),function(e){return!(!ue||!e[Symbol.asyncIterator])}(n))return r=n[Symbol.asyncIterator](),(t={next:function(){return r.next()}})[Symbol.asyncIterator]=function(){return this},t;if(function(e){return!!e.getReader}(n))return De(n.getReader());if(function(e){return!!e.stream}(n))return De(n.stream().getReader());if(function(e){return!!e.arrayBuffer}(n))return function(e){var t=!1,r={next:function(){return t?Promise.resolve({value:void 0,done:!0}):(t=!0,new Promise((function(t,r){e.then((function(e){t({value:e,done:!1})})).catch(r)})))}};return ue&&(r[Symbol.asyncIterator]=function(){return this}),r}(n.arrayBuffer());if(function(e){return!!e.pipe}(n))return Ce(n);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Me=Object.prototype.hasOwnProperty;function je(e){var t={};return e.split("\n").forEach((function(e){var r=e.indexOf(":");if(r>-1){var n=e.slice(0,r).trim().toLowerCase(),i=e.slice(r+1).trim();t[n]=i}})),t}function Te(e,t){if(e.status>=300){Oe(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status))}try{return JSON.parse(t)}catch(n){var r=n;throw r.name="ServerParseError",r.response=e,r.statusCode=e.status,r.bodyText=t,r}}function Ne(e,t){var r,n;"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&(null===(r=t.next)||void 0===r||r.call(t,e.result)),null===(n=t.error)||void 0===n||n.call(t,e))}function Le(e){return function(t){return t.text().then((function(e){return Te(t,e)})).then((function(r){return t.status>=300&&Oe(t,r,"Response not successful: Received status code ".concat(t.status)),Array.isArray(r)||Me.call(r,"data")||Me.call(r,"errors")||Oe(t,r,"Server response was missing for query '".concat(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName,"'.")),r}))}}var Ae=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},Ve={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},ze=function(e,t){return t(e)};function We(t,r){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var a={},s={};n.forEach((function(t){a=e.__assign(e.__assign(e.__assign({},a),t.options),{headers:e.__assign(e.__assign({},a.headers),t.headers)}),t.credentials&&(a.credentials=t.credentials),s=e.__assign(e.__assign({},s),t.http)})),a.headers=Be(a.headers,s.preserveHeaderCase);var u=t.operationName,c=t.extensions,l=t.variables,f=t.query,p={operationName:u,variables:l};return s.includeExtensions&&(p.extensions=c),s.includeQuery&&(p.query=r(f,i.print)),{options:a,body:p}}function Be(e,t){if(!t){var r=Object.create(null);return Object.keys(Object(e)).forEach((function(t){r[t.toLowerCase()]=e[t]})),r}var n=Object.create(null);Object.keys(Object(e)).forEach((function(t){n[t.toLowerCase()]={originalName:t,value:e[t]}}));var i=Object.create(null);return Object.keys(n).forEach((function(e){i[n[e].originalName]=n[e].value})),i}var Ue=function(e){if(!e&&"undefined"==typeof fetch)throw new t.InvariantError(22)},He=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},Ke=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("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=Ae(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Ae(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var Ge=p((function(){return fetch})),Ye=function(t){void 0===t&&(t={});var r=t.uri,o=void 0===r?"/graphql":r,a=t.fetch,s=t.print,u=void 0===s?ze:s,c=t.includeExtensions,l=t.preserveHeaderCase,f=t.useGETForQueries,h=t.includeUnusedVariables,v=void 0!==h&&h,y=e.__rest(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);var m={http:{includeExtensions:c,preserveHeaderCase:l},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Ee((function(t){var r=Ke(t,o),s=t.getContext(),c={};if(s.clientAwareness){var l=s.clientAwareness,h=l.name,y=l.version;h&&(c["apollographql-client-name"]=h),y&&(c["apollographql-client-version"]=y)}var g,b=e.__assign(e.__assign({},c),s.headers),_={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:b},w=We(t,u,Ve,m,_),O=w.options,S=w.body;if(S.variables&&!v){var k=new Set(Object.keys(S.variables));i.visit(t.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&k.delete(e.name.value)}}),k.size&&(S.variables=e.__assign({},S.variables),k.forEach((function(e){delete S.variables[e]})))}if(!O.signal){var x=He(),E=x.controller,q=x.signal;(g=E)&&(O.signal=q)}if(f&&!t.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(O.method="GET"),d(["defer"],t.query)&&(O.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),"GET"===O.method){var R=Je(r,S),P=R.newURI,Q=R.parseError;if(Q)return we(Q);r=P}else try{O.body=Ae(S)}catch(Q){return we(Q)}return new n.Observable((function(n){return(a||p((function(){return fetch}))||Ge)(r,O).then((function(r){var i;t.setContext({response:r});var o=null===(i=r.headers)||void 0===i?void 0:i.get("content-type");return null!==o&&/^multipart\/mixed/i.test(o)?function(t,r){var n,i,o;return e.__awaiter(this,void 0,void 0,(function(){var a,s,u,c,l,f,p,h,d,v,y,m,g,b,_,w,O,S,k,x;return e.__generator(this,(function(e){switch(e.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),s=null===(n=t.headers)||void 0===n?void 0:n.get("content-type"),u="boundary=",c=(null==s?void 0:s.includes(u))?null==s?void 0:s.substring((null==s?void 0:s.indexOf(u))+u.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),f="",p=Ie(t),h=!0,e.label=1;case 1:return h?[4,p.next()]:[3,3];case 2:for(d=e.sent(),v=d.value,y=d.done,m="string"==typeof v?v:a.decode(v),h=!y,g=(f+=m).indexOf(l);g>-1;){if(b=void 0,x=[f.slice(0,g),f.slice(g+l.length)],f=x[1],(b=x[0]).trim()){if(_=b.indexOf("\r\n\r\n"),w=je(b.slice(0,_)),(O=w["content-type"])&&-1===O.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");S=b.slice(_);try{k=Te(t,S.replace("\r\n","")),(Object.keys(k).length>1||"data"in k||"incremental"in k||"errors"in k)&&(null===(i=r.next)||void 0===i||i.call(r,k))}catch(e){Ne(e,r)}}g=f.indexOf(l)}return[3,1];case 3:return null===(o=r.complete)||void 0===o||o.call(r),[2]}}))}))}(r,n):function(e,t,r){Le(t)(e).then((function(e){var t,n;null===(t=r.next)||void 0===t||t.call(r,e),null===(n=r.complete)||void 0===n||n.call(r)})).catch((function(e){return Ne(e,r)}))}(r,t,n)})).catch((function(e){return Ne(e,n)})),function(){g&&g.abort()}}))}))},Xe=function(t){function r(e){void 0===e&&(e={});var r=t.call(this,Ye(e).request)||this;return r.options=e,r}return e.__extends(r,t),r}(Ee);var $e=function(){function t(){this.getFragmentDoc=o.wrap(y)}return t.prototype.batch=function(e){var t,r=this,n="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(r)}),n),t},t.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{rootId:t.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{query:this.getFragmentDoc(t.fragment,t.fragmentName),rootId:t.id,optimistic:r}))},t.prototype.writeQuery=function(t){var r=t.id,n=t.data,i=e.__rest(t,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(t){var r=t.id,n=t.data,i=t.fragment,o=t.fragmentName,a=e.__rest(t,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:r,result:n}))},t.prototype.updateQuery=function(t,r){return this.batch({update:function(n){var i=n.readQuery(t),o=r(i);return null==o?i:(n.writeQuery(e.__assign(e.__assign({},t),{data:o})),o)}})},t.prototype.updateFragment=function(t,r){return this.batch({update:function(n){var i=n.readFragment(t),o=r(i);return null==o?i:(n.writeFragment(e.__assign(e.__assign({},t),{data:o})),o)}})},t}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var Ze=function(t){function r(e,n,i,o){var a,s=t.call(this,e)||this;if(s.message=e,s.path=n,s.query=i,s.variables=o,Array.isArray(s.path)){s.missing=s.message;for(var u=s.path.length-1;u>=0;--u)s.missing=((a={})[s.path[u]]=s.missing,a)}else s.missing=s.path;return s.__proto__=r.prototype,s}return e.__extends(r,t),r}(Error),et=Object.prototype.hasOwnProperty;function tt(e){return null==e}var rt=Array.isArray;function nt(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=tt(n)?tt(i)?void 0:{_id:i}:{id:n}),tt(n)&&!tt(i)&&(n=i),!tt(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var it={dataIdFromObject:nt,addTypename:!0,resultCaching:!0,canonizeResults:!1};function ot(e){var t=e.canonizeResults;return void 0===t?it.canonizeResults:t}var at=/^[_a-z][_0-9a-z]*/i;function st(e){var t=e.match(at);return t?t[0]:e}function ut(e,t,r){return!!b(t)&&(rt(t)?t.every((function(t){return ut(e,t,r)})):e.selections.every((function(e){if(Q(e)&&h(e,r)){var n=R(e);return et.call(t,n)&&(!e.selectionSet||ut(e.selectionSet,t[n],r))}return!0})))}function ct(e){return b(e)&&!w(e)&&!rt(e)}function lt(e,t){var r=m(M(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var ft=Object.create(null),pt=function(){return ft},ht=Object.create(null),dt=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 _(e);if(w(e))return e;var n=r.policies.identify(e)[0];if(n){var i=_(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),et.call(this.data,e)){var r=this.data[e];if(r&&et.call(r,t))return r[t]}return"__typename"===t&&et.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof gt?this.parent.get(e,t):void 0},r.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),et.call(this.data,e)?this.data[e]:this instanceof gt?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,a="string"==typeof r?this.lookup(n=r):r;if(a){t.invariant("string"==typeof n,1);var s=new Z(_t).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=st(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof gt||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},r.prototype.modify=function(t,r){var n=this,i=this.lookup(t);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:ft,INVALIDATE:ht,isReference:w,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||_(t)}:e,{store:n})}};if(Object.keys(i).forEach((function(c){var l=st(c),f=i[c];if(void 0!==f){var p="function"==typeof r?r:r[c]||r[l];if(p){var h=p===pt?ft:p(f,e.__assign(e.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(t,c)}));h===ht?n.group.dirty(t,c):(h===ft&&(h=void 0),h!==f&&(o[c]=h,a=!0,f=h))}void 0!==f&&(s=!1)}})),a)return this.merge(t,o),s&&(this instanceof gt?this.data[t]=void 0:delete this.data[t],this.group.dirty(t,"__exists")),!0}return!1},r.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=pt,n):pt)}return!1},r.prototype.evict=function(e,t){var r=!1;return e.id&&(et.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof gt&&this!==t&&(r=this.parent.evict(e,t)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){et.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&&et.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 gt?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){et.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 gt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},r.prototype.findChildRefIds=function(e){if(!et.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),b(e)&&Object.keys(e).forEach((function(t){var r=e[t];b(r)&&n.add(r)}))}))}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),vt=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?o.dep():null,this.keyMaker=new s.Trie(oe)},e.prototype.depend=function(e,t){if(this.d){this.d(yt(e,t));var r=st(t);r!==t&&this.d(yt(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(yt(e,t),"__exists"===t?"forget":"setDirty")},e}();function yt(e,t){return t+"#"+e}function mt(e,t){wt(e)&&e.group.depend(t,"__exists")}!function(t){var r=function(t){function r(e){var r=e.policies,n=e.resultCaching,i=void 0===n||n,o=e.seed,a=t.call(this,r,new vt(i))||this;return a.stump=new bt(a),a.storageTrie=new s.Trie(oe),o&&a.replace(o),a}return e.__extends(r,t),r.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(t);t.Root=r}(dt||(dt={}));var gt=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 et.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}(dt),bt=function(t){function r(e){return t.call(this,"EntityStore.Stump",e,(function(){}),new vt(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}(gt);function _t(e,t,n){var i=e[n],o=t[n];return r.equal(i,o)?i:o}function wt(e){return!!(e instanceof dt&&e.group.caching)}var Ot,St,kt=function(){function t(){this.known=new(ae?WeakSet:Set),this.pool=new s.Trie(oe),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return b(e)&&this.known.has(e)},t.prototype.pass=function(t){if(b(t)){var r=function(t){return b(t)?rt(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(b(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},t.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},t}(),xt=Object.assign((function(e){if(b(e)){void 0===Ot&&Et();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:Et});function Et(){Ot=new kt,St=new(oe?WeakMap:Map)}function qt(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var Rt=function(){function r(t){var r=this;this.knownResults=new(oe?WeakMap:Map),this.config=me(t,{addTypename:!1!==t.addTypename,canonizeResults:ot(t)}),this.canon=t.canon||new kt,this.executeSelectionSet=o.wrap((function(t){var n,i=t.context.canonizeResults,o=qt(t);o[3]=!i;var a=(n=r.executeSelectionSet).peek.apply(n,o);return a?i?e.__assign(e.__assign({},a),{result:r.canon.admit(a.result)}):a:(mt(t.context.store,t.enclosingRef.__ref),r.execSelectionSetImpl(t))}),{max:this.config.resultCacheMaxSize,keyArgs:qt,makeCacheKey:function(e,t,r,n){if(wt(r.store))return r.store.makeCacheKey(e,w(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=o.wrap((function(e){return mt(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(wt(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return r.prototype.resetCanon=function(){this.canon=new kt},r.prototype.diffQueryAgainstStore=function(t){var r=t.store,n=t.query,i=t.rootId,o=void 0===i?"ROOT_QUERY":i,a=t.variables,s=t.returnPartialData,u=void 0===s||s,c=t.canonizeResults,l=void 0===c?this.config.canonizeResults:c,f=this.config.cache.policies;a=e.__assign(e.__assign({},N(j(n))),a);var p,h=_(o),d=this.executeSelectionSet({selectionSet:T(n).selectionSet,objectOrReference:h,enclosingRef:h,context:e.__assign({store:r,query:n,policies:f,variables:a,varString:xt(a),canonizeResults:l},lt(n,this.config.fragments))});if(d.missing&&(p=[new Ze(Pt(d.missing),d.missing,n,a)],!u))throw p[0];return{result:d.result,complete:!p,missing:p}},r.prototype.isFresh=function(e,t,r,n){if(wt(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,o=e.objectOrReference,a=e.enclosingRef,s=e.context;if(w(o)&&!s.policies.rootTypenamesById[o.__ref]&&!s.store.has(o.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(o.__ref," object")};var u,c=s.variables,l=s.policies,f=s.store.getFieldValue(o,"__typename"),p=[],d=new Z;function v(e,t){var r;return e.missing&&(u=d.merge(u,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof f&&!l.rootIdsByTypename[f]&&p.push({__typename:f});var y=new Set(n.selections);y.forEach((function(e){var n,m;if(h(e,c))if(Q(e)){var b=l.readField({fieldName:e.name.value,field:e,variables:s.variables,from:o},s),_=R(e);void 0===b?U.added(e)||(u=d.merge(u,((n={})[_]="Can't find field '".concat(e.name.value,"' on ").concat(w(o)?o.__ref+" object":"object "+JSON.stringify(o,null,2)),n))):rt(b)?b=v(r.executeSubSelectedArray({field:e,array:b,enclosingRef:a,context:s}),_):e.selectionSet?null!=b&&(b=v(r.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:b,enclosingRef:w(b)?b:a,context:s}),_)):s.canonizeResults&&(b=r.canon.pass(b)),void 0!==b&&p.push(((m={})[_]=b,m))}else{var O=g(e,s.lookupFragment);if(!O&&e.kind===i.Kind.FRAGMENT_SPREAD)throw new t.InvariantError(5);O&&l.fragmentMatches(O,f)&&O.selectionSet.selections.forEach(y.add,y)}}));var m={result:X(p),missing:u},b=s.canonizeResults?this.canon.admit(m):m;return b.result&&this.knownResults.set(b.result,n),b},r.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,a=e.context,s=new Z;function u(e,r){var n;return e.missing&&(t=s.merge(t,((n={})[r]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(a.store.canRead)),i=i.map((function(e,t){return null===e?null:rt(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:a}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:w(e)?e:o,context:a}),t):e})),{result:a.canonizeResults?this.canon.admit(i):i,missing:t}},r}();function Pt(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var Qt=new a.Slot,Ft=new WeakMap;function Ct(e){var t=Ft.get(e);return t||Ft.set(e,t={vars:new Set,dep:o.dep()}),t}function Dt(e){Ct(e).vars.forEach((function(t){return t.forgetCache(e)}))}function It(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Ct(e).dep.dirty(n),Mt(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=Qt.getValue();s&&(i(s),Ct(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),Ct(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function Mt(e){e.broadcastWatches&&e.broadcastWatches()}var jt=Object.create(null);function Tt(e){var t=JSON.stringify(e);return jt[t]||(jt[t]=Object.create(null))}function Nt(e){var r=Tt(e);return r.keyFieldsFn||(r.keyFieldsFn=function(r,n){var i=function(e,t){return n.readField(t,e)},o=n.keyObject=At(e,(function(e){var o=Wt(n.storeObject,e,i);return void 0===o&&r!==n.storeObject&&et.call(r,e[0])&&(o=Wt(r,e,zt)),t.invariant(void 0!==o,2),o}));return"".concat(n.typename,":").concat(JSON.stringify(o))})}function Lt(e){var t=Tt(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,a=At(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Wt(t,e)}else{var a=r.slice(1);if(i&&et.call(i,a)){var s=e.slice(0);return s[0]=a,Wt(i,s)}}else if(n&&ve(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&q(c,i);return l&&Wt(l,e.slice(1))}})),s=JSON.stringify(a);return(t||"{}"!==s)&&(o+=":"+s),o})}function At(e,t){var r=new Z;return Vt(e).reduce((function(e,n){var i,o=t(n);if(void 0!==o){for(var a=n.length-1;a>=0;--a)(i={})[n[a]]=o,o=i;e=r.merge(e,o)}return e}),Object.create(null))}function Vt(e){var t=Tt(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){rt(t)?(Vt(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),rt(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function zt(e,t){return e[t]}function Wt(e,t,r){return r=r||zt,Bt(t.reduce((function e(t,n){return rt(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Bt(e){return b(e)?rt(e)?e.map(Bt):At(Object.keys(e).sort(),(function(t){return Wt(e,t)})):e}function Ut(e){return void 0!==e.args?e.args:e.field?q(e.field,e.variables):null}k.setStringify(xt);var Ht=function(){},Kt=function(e,t){return t.fieldName},Jt=function(e,t,r){return(0,r.mergeObjects)(e,t)},Gt=function(e,t){return t},Yt=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:nt},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(t,r){var n,i=this,o=r&&(r.typename||(null===(n=r.storeObject)||void 0===n?void 0:n.__typename))||t.__typename;if(o===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var a,s=r&&r.storeObject||t,u=e.__assign(e.__assign({},r),{typename:o,storeObject:s,readField:r&&r.readField||function(){var e=$t(arguments,s);return i.readField(e,{store:i.cache.data,variables:e.variables})}}),c=o&&this.getTypePolicy(o),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var f=l(t,u);if(!rt(f)){a=f;break}l=Nt(f)}return a=a?String(a):void 0,u.keyObject?[a,u.keyObject]:[a]},r.prototype.addTypePolicies=function(t){var r=this;Object.keys(t).forEach((function(n){var i=t[n],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=e.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),a&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),et.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},r.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?Jt:!1===t?Gt:e.merge}a(n,t.merge),n.keyFn=!1===i?Ht:rt(i)?Nt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?Kt:rt(s)?Lt(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Kt)}))},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,3),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(at);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},r.prototype.getTypePolicy=function(t){var r=this;if(!et.call(this.typePolicies,t)){var n=this.typePolicies[t]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(t);i&&i.size&&i.forEach((function(t){var i=r.getTypePolicy(t),o=i.fields,a=e.__rest(i,["fields"]);Object.assign(n,a),Object.assign(n.fields,o)}))}var o=this.toBeAdded[t];return o&&o.length&&o.splice(0).forEach((function(e){r.updateTypePolicy(t,e)})),this.typePolicies[t]},r.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},r.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&ut(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},r.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},r.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=Ut(e);o;){var u=o(s,a);if(!rt(u)){t=u||n;break}o=Lt(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 O(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 O(n,r,i,t)}))),k(e.name.value,n,r)}(e.field,e.variables):k(n,Ut(e))),!1===t?n:n===st(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=st(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=Xt(this,r,e,t,t.store.getStorage(w(r)?r.__ref:r,i));return Qt.withValue(this.cache,u,[a,c])}return a}},r.prototype.getReadFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return r&&r.read},r.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},r.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===Jt?Zt(n.store)(e,t):s===Gt?t:(n.overwrite&&(e=void 0),s(e,t,Xt(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},r}();function Xt(e,t,r,n,i){var o=e.getStoreFieldName(r),a=st(o),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Ut(r),field:r.field||null,fieldName:a,storeFieldName:o,variables:s,isReference:w,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField($t(arguments,t,s),n)},mergeObjects:Zt(n.store)}}function $t(t,r,n){var i,o=t[0],a=t[1],s=t.length;return"string"==typeof o?i={fieldName:o,from:s>1?a:r}:(i=e.__assign({},o),et.call(i,"from")||(i.from=r)),void 0===i.variables&&(i.variables=n),i}function Zt(r){return function(n,i){if(rt(n)||rt(i))throw new t.InvariantError(4);if(b(n)&&b(i)){var o=r.getFieldValue(n,"__typename"),a=r.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(w(n)&&ct(i))return r.merge(n.__ref,i),n;if(ct(n)&&w(i))return r.merge(n,i.__ref),i;if(ct(n)&&ct(i))return e.__assign(e.__assign({},n),i)}return i}}function er(t,r,n){var i="".concat(r).concat(n),o=t.flavors.get(i);return o||t.flavors.set(i,o=t.clientOnly===r&&t.deferred===n?t:e.__assign(e.__assign({},t),{clientOnly:r,deferred:n})),o}var tr=function(){function r(e,t,r){this.cache=e,this.reader=t,this.fragments=r}return r.prototype.writeToStore=function(r,n){var i=this,o=n.query,a=n.result,s=n.dataId,u=n.variables,c=n.overwrite,l=D(o),f=new Z;u=e.__assign(e.__assign({},N(l)),u);var p=e.__assign(e.__assign({store:r,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:xt(u)},lt(o,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),h=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!w(h))throw new t.InvariantError(7);return p.incomingById.forEach((function(e,t){var n=e.storeObject,o=e.mergeTree,a=(e.fieldNodeSet,_(t));if(o&&o.map.size){var s=i.applyMerges(o,a,n,p);if(w(s))return;n=s}r.merge(t,n)})),r.retain(h.__ref),h},r.prototype.processSelectionSet=function(t){var r=this,n=t.dataId,i=t.result,o=t.selectionSet,a=t.context,s=t.mergeTree,u=this.cache.policies,c=Object.create(null),l=n&&u.rootTypenamesById[n]||P(i,o,a.fragmentMap)||n&&a.store.get(n,"__typename");"string"==typeof l&&(c.__typename=l);var f=function(){var t=$t(arguments,c,a.variables);if(w(t.from)){var r=a.incomingById.get(t.from.__ref);if(r){var n=u.readField(e.__assign(e.__assign({},t),{from:r.storeObject}),a);if(void 0!==n)return n}}return u.readField(t,a)},p=new Set;this.flattenFields(o,i,a,l).forEach((function(e,t){var n,o=R(t),a=i[o];if(p.add(t),void 0!==a){var h=u.getStoreFieldName({typename:l,fieldName:t.name.value,field:t,variables:e.variables}),d=nr(s,h),v=r.processFieldValue(a,t,t.selectionSet?er(e,!1,!1):e,d),y=void 0;t.selectionSet&&(w(v)||ct(v))&&(y=f("__typename",v));var m=u.getMergeFunction(l,t.name.value,y);m?d.info={field:t,typename:l,merge:m}:ar(s,h),c=e.merge(c,((n={})[h]=v,n))}else 0}));try{var h=u.identify(i,{typename:l,selectionSet:o,fragmentMap:a.fragmentMap,storeObject:c,readField:f}),d=h[0],v=h[1];n=n||d,v&&(c=a.merge(c,v))}catch(e){if(!n)throw e}if("string"==typeof n){var y=_(n),m=a.written[n]||(a.written[n]=[]);if(m.indexOf(o)>=0)return y;if(m.push(o),this.reader&&this.reader.isFresh(i,y,o,a))return y;var g=a.incomingById.get(n);return g?(g.storeObject=a.merge(g.storeObject,c),g.mergeTree=ir(g.mergeTree,s),p.forEach((function(e){return g.fieldNodeSet.add(e)}))):a.incomingById.set(n,{storeObject:c,mergeTree:or(s)?void 0:s,fieldNodeSet:p}),y}return c},r.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?rt(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,nr(n,o));return ar(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},r.prototype.flattenFields=function(e,r,n,o){void 0===o&&(o=P(r,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new s.Trie(!1);return function e(s,l){var f=c.lookup(s,l.clientOnly,l.deferred);f.visited||(f.visited=!0,s.selections.forEach((function(s){if(h(s,n.variables)){var c=l.clientOnly,f=l.deferred;if(c&&f||!ve(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(c=!0),"defer"===t){var r=q(e,n.variables);r&&!1===r.if||(f=!0)}})),Q(s)){var p=a.get(s);p&&(c=c&&p.clientOnly,f=f&&p.deferred),a.set(s,er(n,c,f))}else{var d=g(s,n.lookupFragment);if(!d&&s.kind===i.Kind.FRAGMENT_SPREAD)throw new t.InvariantError(8);d&&u.fragmentMatches(d,o,r,n.variables)&&e(d.selectionSet,er(n,c,f))}}})))}(e,n),a},r.prototype.applyMerges=function(r,n,i,o,a){var s,u=this;if(r.map.size&&!w(i)){var c,l=rt(i)||!w(n)&&!ct(n)?void 0:n,f=i;l&&!a&&(a=[w(l)?l.__ref:l]);var p=function(e,t){return rt(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};r.map.forEach((function(e,r){var n=p(l,r),i=p(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(e,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&t.invariant(a.pop()===r)}})),c&&(i=rt(f)?f.slice(0):e.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return r.info?this.cache.policies.runMergeFunction(n,i,r.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},r}(),rr=[];function nr(e,t){var r=e.map;return r.has(t)||r.set(t,rr.pop()||{map:new Map}),r.get(t)}function ir(t,r){if(t===r||!r||or(r))return t;if(!t||or(t))return r;var n=t.info&&r.info?e.__assign(e.__assign({},t.info),r.info):t.info||r.info,i=t.map.size&&r.map.size,o={info:n,map:i?new Map:t.map.size?t.map:r.map};if(i){var a=new Set(r.map.keys());t.map.forEach((function(e,t){o.map.set(t,ir(e,r.map.get(t))),a.delete(t)})),a.forEach((function(e){o.map.set(e,ir(r.map.get(e),t.map.get(e)))}))}return o}function or(e){return!e||!(e.info||e.map.size)}function ar(e,t){var r=e.map,n=r.get(t);n&&or(n)&&(rr.push(n),r.delete(t))}new Set;var sr=function(t){function n(e){void 0===e&&(e={});var r=t.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=It,r.txCount=0,r.config=function(e){return me(it,e)}(e),r.addTypename=!!r.config.addTypename,r.policies=new Yt({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return e.__extends(n,t),n.prototype.init=function(){var e=this.data=new dt.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,n=this.config.fragments;this.storeWriter=new tr(this,this.storeReader=new Rt({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ot(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=o.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(wt(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,xt({optimistic:n,id: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(et.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){Ct(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&&Dt(t),t.maybeBroadcastWatch.forget(e)}},n.prototype.gc=function(e){xt.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){if(w(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){}},n.prototype.evict=function(t){if(!t.id){if(et.call(t,"id"))return!1;t=e.__assign(e.__assign({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},n.prototype.reset=function(e){var t=this;return this.init(),xt.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Dt(this)):this.broadcastWatches(),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,n=this,i=t.update,o=t.optimistic,a=void 0===o||o,s=t.removeOptimistic,u=t.onWatchUpdated,c=function(e){var t=n,o=t.data,a=t.optimisticData;++n.txCount,e&&(n.data=n.optimisticData=e);try{return r=i(n)}finally{--n.txCount,n.data=o,n.optimisticData=a}},l=new Set;return u&&!this.txCount&&this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof a?this.optimisticData=this.optimisticData.addLayer(a,c):!1===a?c(this.data):c(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),u&&l.size?(this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e,t){var r=u.call(this,e,t);return!1!==r&&l.delete(e),r}})),l.size&&l.forEach((function(e){return n.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(t),r},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=U(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.transformForLink=function(e){var t=this.config.fragments;return t?t.transform(e):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(e);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}($e);function ur(e){return e.hasOwnProperty("graphQLErrors")}var cr,lr=function(t){function r(e){var n,i,o=e.graphQLErrors,a=e.clientErrors,s=e.networkError,u=e.errorMessage,c=e.extraInfo,l=t.call(this,u)||this;return l.name="ApolloError",l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(ve((n=l).graphQLErrors)||ve(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+="".concat(t,"\n")})),n.networkError&&(i+="".concat(n.networkError.message,"\n")),i=i.replace(/\n$/,"")),l.extraInfo=c,l.__proto__=r.prototype,l}return e.__extends(r,t),r}(Error);function fr(e){return!!e&&e<7}exports.NetworkStatus=void 0,(cr=exports.NetworkStatus||(exports.NetworkStatus={}))[cr.loading=1]="loading",cr[cr.setVariables=2]="setVariables",cr[cr.fetchMore=3]="fetchMore",cr[cr.refetch=4]="refetch",cr[cr.poll=6]="poll",cr[cr.ready=7]="ready",cr[cr.error=8]="error";var pr=Object.assign,hr=(Object.hasOwnProperty,function(n){function i(t){var r=t.queryManager,i=t.queryInfo,o=t.options,a=n.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=vr)}catch(e){}var r=!a.observers.size;a.observers.add(e);var n=a.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&a.reobserve().catch((function(){})),function(){a.observers.delete(e)&&!a.observers.size&&a.tearDownQuery()}}))||this;a.observers=new Set,a.subscriptions=new Set,a.queryInfo=i,a.queryManager=r,a.isTornDown=!1;var s=r.defaultOptions.watchQuery,u=(void 0===s?{}:s).fetchPolicy,c=void 0===u?"cache-first":u,l=o.fetchPolicy,f=void 0===l?c:l,p=o.initialFetchPolicy,h=void 0===p?"standby"===f?c:f:p;a.options=e.__assign(e.__assign({},o),{initialFetchPolicy:h,fetchPolicy:f}),a.queryId=i.queryId||r.generateQueryId();var d=D(a.query);return a.queryName=d&&d.name&&d.name.value,a}return e.__extends(i,n),Object.defineProperty(i.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),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:fr(i),networkStatus:i}),a=this.options.fetchPolicy,s=void 0===a?"cache-first":a;if("network-only"===s||"no-cache"===s||"standby"===s||this.queryManager.transform(this.options.query).hasForcedResolvers);else{var u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(o.data=u.result),r.equal(o.data,{})&&(o.data=void 0),u.complete?(delete o.partial,!u.complete||o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==s&&"cache-only"!==s||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1)):o.partial=!0}return t&&this.updateLastResult(o),o},i.prototype.isDifferentFromLastResult=function(e,t){return!this.last||!r.equal(this.last.result,e)||t&&!r.equal(this.last.variables,t)},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 n.fetchPolicy="cache-and-network"===i?i:"no-cache"===i?"no-cache":"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(e.__assign({},this.options),{query:this.query}),t),{variables:e.__assign(e.__assign({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId(),o=this.queryInfo,a=o.networkStatus;o.networkStatus=exports.NetworkStatus.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(i,n,exports.NetworkStatus.fetchMore).then((function(e){return r.queryManager.removeQuery(i),o.networkStatus===exports.NetworkStatus.fetchMore&&(o.networkStatus=a),r.queryManager.cache.batch({update:function(i){var o=t.updateQuery;o?i.updateQuery({query:r.query,variables:r.variables,returnPartialData:!0,optimistic:!1},(function(t){return o(t,{fetchMoreResult:e.data,variables:n.variables})})):i.writeQuery({query:n.query,variables:n.variables,data:e.data})},onWatchUpdated:function(e){s.add(e.query)}}),e})).finally((function(){s.has(r.query)||dr(r)}))},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.options.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.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var r=t.fetchPolicy,n=void 0===r?"cache-first":r,i=t.initialFetchPolicy,o=void 0===i?n:i;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:o}):t.fetchPolicy="variables-changed"===e?o:t.nextFetchPolicy)}return t.fetchPolicy},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&&(fr(e.queryInfo.networkStatus)?o():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"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:te(t),variables:r}),ve(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,a=this.options.variables,s=this.options.fetchPolicy,u=me(this.options,t||{}),c=o?u:pr(this.options,u);o||(this.updatePolling(),t&&t.variables&&!r.equal(t.variables,a)&&"standby"!==c.fetchPolicy&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),void 0===n&&(n=exports.NetworkStatus.setVariables)));var l=c.variables&&e.__assign({},c.variables),f=this.fetch(c,n),p={next:function(e){i.reportResult(e,l)},error:function(e){i.reportError(e,l)}};return o||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=p),f.addObserver(p),f.promise},i.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},i.prototype.reportResult=function(e,t){var r=this.getLastError();(r||this.isDifferentFromLastResult(e,t))&&((r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),ne(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),ne(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 dr(e){var t=e.options,r=t.fetchPolicy,n=t.nextFetchPolicy;return"cache-and-network"===r||"network-only"===r?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,"function"==typeof n?n.apply(this,arguments):r}}):e.reobserve()}function vr(e){}pe(hr);var yr=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=Y(t.resolvers,e)})):this.resolvers=Y(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(t){var r=t.document,n=t.remoteResult,i=t.context,o=t.variables,a=t.onlyRunForcedResolvers,s=void 0!==a&&a;return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,s).then((function(t){return e.__assign(e.__assign({},n),{data:t.result})}))]:[2,n]}))}))},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return d(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return function(e){C(e);var t=B([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=i.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return Q(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},r.prototype.prepareContext=function(t){var r=this.cache;return e.__assign(e.__assign({},t),{cache:r,getCacheKey:function(e){return r.identify(e)}})},r.prototype.addExportedVariables=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,r)||{},this.prepareContext(n),r).then((function(t){return e.__assign(e.__assign({},r),t.exportedVariables)}))]:[2,e.__assign({},r)]}))}))},r.prototype.shouldForceResolvers=function(e){var t=!1;return i.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return i.BREAK}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:J(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(t,r,n,i,o,a){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),e.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,p,h,d,v;return e.__generator(this,(function(y){return s=T(t),u=M(t),c=m(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,d=p.client,v={fragmentMap:c,context:e.__assign(e.__assign({},n),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,r,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},r.prototype.resolveSelectionSet=function(r,n,i){return e.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return e.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[n],c=function(r){return e.__awaiter(l,void 0,void 0,(function(){var c,l;return e.__generator(this,(function(e){return h(r,s)?Q(r)?[2,this.resolveField(r,n,i).then((function(e){var t;void 0!==e&&u.push(((t={})[R(r)]=e,t))}))]:(F(r)?c=r:(c=o[r.name.value],t.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,a))?[2,this.resolveSelectionSet(c.selectionSet,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(r.selections.map(c)).then((function(){return X(u)}))]}))}))},r.prototype.resolveField=function(t,r,n){return e.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,p,h=this;return e.__generator(this,(function(e){return i=n.variables,o=t.name.value,a=R(t),s=o!==a,u=r[a]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(l=r.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?o:a])&&(c=Promise.resolve(Qt.withValue(this.cache,p,[r,q(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}(),mr=new(oe?WeakMap:Map);function gr(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return mr.set(e,(mr.get(e)+1)%1e15),r.apply(this,arguments)})}function br(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var _r=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;mr.has(r)||(mr.set(r,0),gr(r,"evict"),gr(r,"modify"),gr(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(){br(this),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){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0: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():dr(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;br(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(fr(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===mr.get(this.cache)&&r.equal(t,n.variables)&&r.equal(e.data,n.result.data))},t.prototype.markResult=function(e,t,r,n){var i=this,o=ve(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&ve(e.incremental)){var a=this.getDiff().result,s=new Z;e.incremental.forEach((function(e){for(var t=e.data,r=e.path,n=e.errors,i=r.length-1;i>=0;--i){var u=r[i],c=!isNaN(+u)?[]:{};c[u]=t,t=c}n&&o.push.apply(o,n),a=s.merge(a,t)})),e.data=a}this.graphQLErrors=o,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(wr(e,r.errorPolicy)?this.cache.performTransaction((function(o){if(i.shouldWrite(e,r.variables))o.writeQuery({query:t,data:e.data,variables:r.variables,overwrite:1===n}),i.lastWrite={result:e,variables:r.variables,dmCount:mr.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete)return void(e.data=i.lastDiff.diff.result);var a=i.getDiffOptions(r.variables),s=o.diff(a);i.stopped||i.updateWatch(r.variables),i.updateLastDiff(s,a),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 wr(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!ye(e);return!n&&r&&e.data&&(n=!0),n}var Or=Object.prototype.hasOwnProperty,Sr=function(){function r(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.queryDeduplication,o=void 0!==i&&i,a=e.onBroadcast,s=e.ssrMode,u=void 0!==s&&s,c=e.clientAwareness,l=void 0===c?{}:c,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(oe?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=l,this.localState=f||new yr({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=a)&&(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,i,o=r.mutation,a=r.variables,s=r.optimisticResponse,u=r.updateQueries,c=r.refetchQueries,l=void 0===c?[]:c,f=r.awaitRefetchQueries,p=void 0!==f&&f,h=r.update,d=r.onQueryUpdated,v=r.fetchPolicy,y=void 0===v?(null===(n=this.defaultOptions.mutate)||void 0===n?void 0:n.fetchPolicy)||"network-only":v,m=r.errorPolicy,g=void 0===m?(null===(i=this.defaultOptions.mutate)||void 0===i?void 0:i.errorPolicy)||"none":m,b=r.keepRootFields,_=r.context;return e.__awaiter(this,void 0,void 0,(function(){var r,n,i,c,f,v;return e.__generator(this,(function(m){switch(m.label){case 0:return t.invariant(o,14),t.invariant("network-only"===y||"no-cache"===y,15),r=this.generateMutationId(),n=this.transform(o),i=n.document,c=n.hasClientExports,o=this.cache.transformForLink(i),a=this.getVariables(o,a),c?[4,this.localState.addExportedVariables(o,a,_)]:[3,2];case 1:a=m.sent(),m.label=2;case 2:return f=this.mutationStore&&(this.mutationStore[r]={mutation:o,variables:a,loading:!0,error:null}),s&&this.markMutationOptimistic(s,{mutationId:r,document:o,variables:a,fetchPolicy:y,errorPolicy:g,context:_,updateQueries:u,update:h,keepRootFields:b}),this.broadcastQueries(),v=this,[2,new Promise((function(t,n){return ie(v.getObservableFromLink(o,e.__assign(e.__assign({},_),{optimisticResponse:s}),a,!1),(function(t){if(ye(t)&&"none"===g)throw new lr({graphQLErrors:t.errors});f&&(f.loading=!1,f.error=null);var n=e.__assign({},t);return"function"==typeof l&&(l=l(n)),"ignore"===g&&ye(n)&&delete n.errors,v.markMutationResult({mutationId:r,result:n,document:o,variables:a,fetchPolicy:y,errorPolicy:g,context:_,update:h,updateQueries:u,awaitRefetchQueries:p,refetchQueries:l,removeOptimistic:s?r:void 0,onQueryUpdated:d,keepRootFields:b})})).subscribe({next:function(e){v.broadcastQueries(),t(e)},error:function(e){f&&(f.loading=!1,f.error=e),s&&v.cache.removeOptimistic(r),v.broadcastQueries(),n(e instanceof lr?e:new lr({networkError:e}))}})}))]}}))}))},r.prototype.markMutationResult=function(t,r){var n=this;void 0===r&&(r=this.cache);var i=t.result,o=[],a="no-cache"===t.fetchPolicy;if(!a&&wr(i,t.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables});var s=t.updateQueries;s&&this.queries.forEach((function(e,t){var a=e.observableQuery,u=a&&a.queryName;if(u&&Or.call(s,u)){var c=s[u],l=n.queries.get(t),f=l.document,p=l.variables,h=r.diff({query:f,variables:p,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&I(f)||void 0,queryVariables:p});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:p})}}}))}if(o.length>0||t.refetchQueries||t.update||t.onQueryUpdated||t.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(r){a||o.forEach((function(e){return r.write(e)}));var s=t.update;if(s){if(!a){var u=r.diff({id:"ROOT_MUTATION",query:n.transform(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0});u.complete&&!i.incremental&&(i=e.__assign(e.__assign({},i),{data:u.result}))}s(r,i,{context:t.context,variables:t.variables})}a||t.keepRootFields||r.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:t.refetchQueries,optimistic:!1,removeOptimistic:t.removeOptimistic,onQueryUpdated:t.onQueryUpdated||null}).forEach((function(e){return u.push(e)})),t.awaitRefetchQueries||t.onQueryUpdated)return Promise.all(u).then((function(){return i}))}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(t,r){var n=this,i="function"==typeof t?t(r.variables):t;return this.cache.recordOptimisticTransaction((function(t){try{n.markMutationResult(e.__assign(e.__assign({},r),{result:{data:i}}),t)}catch(e){}}),r.mutationId)},r.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(t){var r=this.transformCache;if(!r.has(t)){var n=this.cache.transformDocument(t),i=B([H],C(n)),o=this.localState.clientQuery(n),a=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:v(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:a,defaultVars:N(D(n)),asQuery:e.__assign(e.__assign({},n),{definitions:n.definitions.map((function(t){return"OperationDefinition"===t.kind&&"query"!==t.operation?e.__assign(e.__assign({},t),{operation:"query"}):t}))})},u=function(e){e&&!r.has(e)&&r.set(e,s)};u(t),u(n),u(o),u(a)}return r.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 _r(this),n=new hr({queryManager:this,queryInfo:r,options:t});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.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(e){return void 0===e&&(e={discardWatches:!0}),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(e)},r.prototype.getObservableQueries=function(r){var n=this;void 0===r&&(r="active");var i=new Map,o=new Map,a=new Set;return Array.isArray(r)&&r.forEach((function(e){var t;"string"==typeof e?o.set(e,!1):b(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?o.set(n.transform(e).document,!1):b(e)&&e.query&&a.add(e)})),this.queries.forEach((function(e,t){var n=e.observableQuery,a=e.document;if(n){if("all"===r)return void i.set(t,n);var s=n.queryName;if("standby"===n.options.fetchPolicy||"active"===r&&!n.hasObservers())return;("active"===r||s&&o.has(s)||a&&o.has(a))&&(i.set(t,n),s&&o.set(s,!0),a&&o.set(a,!0))}})),a.size&&a.forEach((function(r){var o=be("legacyOneTimeQuery"),a=n.getQuery(o).init({document:r.query,variables:r.variables}),s=new hr({queryManager:n,queryInfo:a,options:e.__assign(e.__assign({},r),{fetchPolicy:"network-only"})});t.invariant(s.queryId===o),a.setObservableQuery(s),i.set(o,s)})),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,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(n){if("no-cache"!==i&&(wr(n,o)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),ye(n))throw new lr({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new n.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(t,r,i,o){var a,s,u=this;void 0===o&&(o=null!==(a=null==r?void 0:r.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(t).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:i,operationName:I(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=xt(i);if(!(s=h.get(d))){var v=new de([Fe(f,p)]);h.set(d,s=v),v.beforeNext((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else s=new de([Fe(f,p)])}else s=new de([n.Observable.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(t).clientQuery;return y&&(s=ie(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:i})}))),s},r.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(this.transform(e.document).document);return ie(this.getObservableFromLink(i,r.context,r.variables),(function(o){var a=ve(o.errors)?o.errors.slice(0):[];"incremental"in o&&ve(o.incremental)&&o.incremental.forEach((function(e){e.errors&&a.push.apply(a,e.errors)}));var s=ve(a);if(n>=e.lastRequestId){if(s&&"none"===r.errorPolicy)throw e.markError(new lr({graphQLErrors:a}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:exports.NetworkStatus.ready};return s&&"ignore"!==r.errorPolicy&&(u.errors=a,u.networkStatus=exports.NetworkStatus.error),u}),(function(t){var r=ur(t)?t:new lr({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},r.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),a=this.getQuery(e),s=this.defaultOptions.watchQuery,u=t.fetchPolicy,c=void 0===u?s&&s.fetchPolicy||"cache-first":u,l=t.errorPolicy,f=void 0===l?s&&s.errorPolicy||"none":l,p=t.returnPartialData,h=void 0!==p&&p,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,y=t.context,m=void 0===y?{}:y,g=Object.assign({},t,{query:i,variables:o,fetchPolicy:c,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:v,context:m}),b=function(e){g.variables=e;var i=n.fetchQueryByPolicy(a,g,r);return"standby"!==g.fetchPolicy&&i.length>0&&a.observableQuery&&a.observableQuery.applyNextFetchPolicy("after-fetch",t),i},_=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,(function(e){_(),setTimeout((function(){return w.cancel(e)}))}));var w=new de(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(b):b(g.variables));return w.promise.then(_,_),w},r.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?be("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof _r&&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),i}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},r.prototype.fetchQueryByPolicy=function(t,r,i){var o=this,a=r.query,s=r.variables,u=r.fetchPolicy,c=r.refetchWritePolicy,l=r.errorPolicy,f=r.returnPartialData,p=r.context,h=r.notifyOnNetworkStatusChange,d=t.networkStatus;t.init({document:this.transform(a).document,variables:s,networkStatus:i});var v=function(){return t.getDiff(s)},y=function(r,i){void 0===i&&(i=t.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(t){return n.Observable.of(e.__assign({data:t,loading:fr(i),networkStatus:i},r.complete?null:{partial:!0}))};return u&&o.transform(a).hasForcedResolvers?o.localState.runResolvers({document:a,remoteResult:{data:u},context:p,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:i===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return o.getResultsFromLink(t,m,{variables:s,context:p,fetchPolicy:u,errorPolicy:l})},b=h&&"number"==typeof d&&d!==i&&fr(i);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,t.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),t.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(t.getDiff()),g()]:[g()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new _r(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}(),kr=function(){function r(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,a=e.cache,s=e.ssrMode,u=void 0!==s&&s,c=e.ssrForceFetchDelay,l=void 0===c?0:c,f=e.connectToDevTools,p=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,h=e.queryDeduplication,d=void 0===h||h,v=e.defaultOptions,y=e.assumeImmutableResults,m=void 0!==y&&y,g=e.resolvers,b=e.typeDefs,_=e.fragmentMatcher,w=e.name,O=e.version,S=e.link;if(S||(S=n?new Xe({uri:n,credentials:i,headers:o}):Ee.empty()),!a)throw new t.InvariantError(9);this.link=S,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||Object.create(null),this.typeDefs=b,l&&setTimeout((function(){return r.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.7.2",this.localState=new yr({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Sr({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:O},localState:this.localState,assumeImmutableResults:m,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=_e(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=_e(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=_e(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 Fe(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).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({discardWatches:!0})})).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}(),xr=se?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Er(){var e=f.createContext[xr];return e||(Object.defineProperty(f.createContext,xr,{value:e=f.createContext({}),enumerable:!1,writable:!1,configurable:!0}),e.displayName="ApolloContext"),e}function qr(e){var r=c.useContext(Er()),n=e||r.client;return t.invariant(!!n,31),n}var Rr,Pr=f.useSyncExternalStore||function(e,t,r){var n=t();var i=f.useState({inst:{value:n,getSnapshot:t}}),o=i[0].inst,a=i[1];return fe?f.useLayoutEffect((function(){Object.assign(o,{value:n,getSnapshot:t}),Qr(o)&&a({inst:o})}),[e,n,t]):Object.assign(o,{value:n,getSnapshot:t}),f.useEffect((function(){return Qr(o)&&a({inst:o}),e((function(){Qr(o)&&a({inst:o})}))}),[e]),n};function Qr(e){var t=e.value,r=e.getSnapshot;try{return t!==r()}catch(e){return!0}}exports.DocumentType=void 0,(Rr=exports.DocumentType||(exports.DocumentType={}))[Rr.Query=0]="Query",Rr[Rr.Mutation=1]="Mutation",Rr[Rr.Subscription=2]="Subscription";var Fr=new Map;function Cr(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 Dr(e){var r,n,i=Fr.get(e);if(i)return i;t.invariant(!!e&&!!e.kind,32);for(var o=[],a=[],s=[],u=[],c=0,l=e.definitions;c<l.length;c++){var f=l[c];if("FragmentDefinition"!==f.kind){if("OperationDefinition"===f.kind)switch(f.operation){case"query":a.push(f);break;case"mutation":s.push(f);break;case"subscription":u.push(f)}}else o.push(f)}t.invariant(!o.length||a.length||s.length||u.length,33),t.invariant(a.length+s.length+u.length<=1,34),n=a.length?exports.DocumentType.Query:exports.DocumentType.Mutation,a.length||s.length||(n=exports.DocumentType.Subscription);var p=a.length?a:s.length?s:u;t.invariant(1===p.length,35);var h=p[0];r=h.variableDefinitions||[];var d={name:h.name&&"Name"===h.name.kind?h.name.value:"data",type:n,variables:r};return Fr.set(e,d),d}function Ir(e,r){var n=Dr(e);Cr(r),Cr(n.type);t.invariant(n.type===r,36)}var Mr=Object.prototype.hasOwnProperty;function jr(e,t){var r=c.useRef();r.current&&e===r.current.client&&t===r.current.query||(r.current=new Tr(e,t,r.current));var n=r.current,i=c.useState(0);i[0];var o=i[1];return n.forceUpdate=function(){o((function(e){return e+1}))},n}var Tr=function(){function t(e,t,r){this.client=e,this.query=t,this.asyncResolveFns=new Set,this.optionsToIgnoreOnce=new(ae?WeakSet:Set),this.ssrDisabledResult={loading:!0,data:void 0,error:void 0,networkStatus:exports.NetworkStatus.loading},this.skipStandbyResult={loading:!1,data:void 0,error:void 0,networkStatus:exports.NetworkStatus.ready},this.toQueryResultCache=new(oe?WeakMap:Map),Ir(t,exports.DocumentType.Query);var n=r&&r.result,i=n&&n.data;i&&(this.previousData=i)}return t.prototype.forceUpdate=function(){},t.prototype.asyncUpdate=function(){var e=this;return new Promise((function(t){e.asyncResolveFns.add(t),e.optionsToIgnoreOnce.add(e.watchQueryOptions),e.forceUpdate()}))},t.prototype.useQuery=function(e){var t=this;this.renderPromises=c.useContext(Er()).renderPromises,this.useOptions(e);var n=this.useObservableQuery(),i=Pr(c.useCallback((function(){if(t.renderPromises)return function(){};var e=function(){var e=t.result,i=n.getCurrentResult();e&&e.loading===i.loading&&e.networkStatus===i.networkStatus&&r.equal(e.data,i.data)||t.setResult(i)},i=function(a){var s=n.last;o.unsubscribe();try{n.resetLastResults(),o=n.subscribe(e,i)}finally{n.last=s}if(!Mr.call(a,"graphQLErrors"))throw a;var u=t.result;(!u||u&&u.loading||!r.equal(a,u.error))&&t.setResult({data:u&&u.data,error:a,loading:!1,networkStatus:exports.NetworkStatus.error})},o=n.subscribe(e,i);return function(){return o.unsubscribe()}}),[n,this.renderPromises,this.client.disableNetworkFetches]),(function(){return t.getCurrentResult()}),(function(){return t.getCurrentResult()}));this.unsafeHandlePartialRefetch(i);var o=this.toQueryResult(i);return!o.loading&&this.asyncResolveFns.size&&(this.asyncResolveFns.forEach((function(e){return e(o)})),this.asyncResolveFns.clear()),o},t.prototype.useOptions=function(e){var n,i=this.createWatchQueryOptions(this.queryHookOptions=e),o=this.watchQueryOptions;!this.optionsToIgnoreOnce.has(o)&&r.equal(i,o)||(this.watchQueryOptions=i,o&&this.observable&&(this.optionsToIgnoreOnce.delete(o),this.observable.reobserve(this.getObsQueryOptions()),this.previousData=(null===(n=this.result)||void 0===n?void 0:n.data)||this.previousData,this.result=void 0)),this.onCompleted=e.onCompleted||t.prototype.onCompleted,this.onError=e.onError||t.prototype.onError,!this.renderPromises&&!this.client.disableNetworkFetches||!1!==this.queryHookOptions.ssr||this.queryHookOptions.skip?this.queryHookOptions.skip||"standby"===this.watchQueryOptions.fetchPolicy?this.result=this.skipStandbyResult:this.result!==this.ssrDisabledResult&&this.result!==this.skipStandbyResult||(this.result=void 0):this.result=this.ssrDisabledResult},t.prototype.getObsQueryOptions=function(){var e=[],t=this.client.defaultOptions.watchQuery;return t&&e.push(t),this.queryHookOptions.defaultOptions&&e.push(this.queryHookOptions.defaultOptions),e.push(me(this.observable&&this.observable.options,this.watchQueryOptions)),e.reduce(_e)},t.prototype.createWatchQueryOptions=function(t){var r;void 0===t&&(t={});var n=t.skip;t.ssr,t.onCompleted,t.onError,t.defaultOptions;var i=e.__rest(t,["skip","ssr","onCompleted","onError","defaultOptions"]),o=Object.assign(i,{query:this.query});if(!this.renderPromises||"network-only"!==o.fetchPolicy&&"cache-and-network"!==o.fetchPolicy||(o.fetchPolicy="cache-first"),o.variables||(o.variables={}),n){var a=o.fetchPolicy,s=void 0===a?this.getDefaultFetchPolicy():a,u=o.initialFetchPolicy,c=void 0===u?s:u;Object.assign(o,{initialFetchPolicy:c,fetchPolicy:"standby"})}else o.fetchPolicy||(o.fetchPolicy=(null===(r=this.observable)||void 0===r?void 0:r.options.initialFetchPolicy)||this.getDefaultFetchPolicy());return o},t.prototype.getDefaultFetchPolicy=function(){var e,t;return(null===(e=this.queryHookOptions.defaultOptions)||void 0===e?void 0:e.fetchPolicy)||(null===(t=this.client.defaultOptions.watchQuery)||void 0===t?void 0:t.fetchPolicy)||"cache-first"},t.prototype.onCompleted=function(e){},t.prototype.onError=function(e){},t.prototype.useObservableQuery=function(){var e=this.observable=this.renderPromises&&this.renderPromises.getSSRObservable(this.watchQueryOptions)||this.observable||this.client.watchQuery(this.getObsQueryOptions());this.obsQueryFields=c.useMemo((function(){return{refetch:e.refetch.bind(e),reobserve:e.reobserve.bind(e),fetchMore:e.fetchMore.bind(e),updateQuery:e.updateQuery.bind(e),startPolling:e.startPolling.bind(e),stopPolling:e.stopPolling.bind(e),subscribeToMore:e.subscribeToMore.bind(e)}}),[e]);var t=!(!1===this.queryHookOptions.ssr||this.queryHookOptions.skip);return this.renderPromises&&t&&(this.renderPromises.registerSSRObservable(e),e.getCurrentResult().loading&&this.renderPromises.addObservableQueryPromise(e)),e},t.prototype.setResult=function(e){var t=this.result;t&&t.data&&(this.previousData=t.data),this.result=e,this.forceUpdate(),this.handleErrorOrCompleted(e)},t.prototype.handleErrorOrCompleted=function(e){var t=this;e.loading||Promise.resolve().then((function(){e.error?t.onError(e.error):e.data&&t.onCompleted(e.data)})).catch((function(e){}))},t.prototype.getCurrentResult=function(){return this.result||this.handleErrorOrCompleted(this.result=this.observable.getCurrentResult()),this.result},t.prototype.toQueryResult=function(t){var r=this.toQueryResultCache.get(t);if(r)return r;var n=t.data;t.partial;var i=e.__rest(t,["data","partial"]);return this.toQueryResultCache.set(t,r=e.__assign(e.__assign(e.__assign({data:n},i),this.obsQueryFields),{client:this.client,observable:this.observable,variables:this.observable.variables,called:!this.queryHookOptions.skip,previousData:this.previousData})),!r.error&&ve(t.errors)&&(r.error=new lr({graphQLErrors:t.errors})),r},t.prototype.unsafeHandlePartialRefetch=function(e){!e.partial||!this.queryHookOptions.partialRefetch||e.loading||e.data&&0!==Object.keys(e.data).length||"cache-only"===this.observable.options.fetchPolicy||(Object.assign(e,{loading:!0,networkStatus:exports.NetworkStatus.refetch}),this.observable.refetch())},t}(),Nr=["refetch","reobserve","fetchMore","updateQuery","startPolling","subscribeToMore"];function Lr(e){var t={data:e.result,complete:!!e.complete};return e.missing&&(t.missing=X(e.missing.map((function(e){return e.missing})))),t}exports.setLogVerbosity=t.setVerbosity,exports.Observable=n.Observable,exports.disableExperimentalFragmentVariables=u.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=u.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=u.enableExperimentalFragmentVariables,exports.gql=u.gql,exports.resetCaches=u.resetCaches,exports.ApolloCache=$e,exports.ApolloClient=kr,exports.ApolloConsumer=function(e){var r=Er();return f.createElement(r.Consumer,null,(function(r){return t.invariant(r&&r.client,27),e.children(r.client)}))},exports.ApolloError=lr,exports.ApolloLink=Ee,exports.ApolloProvider=function(e){var r=e.client,n=e.children,i=Er();return f.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),f.createElement(i.Provider,{value:e},n)}))},exports.HttpLink=Xe,exports.InMemoryCache=sr,exports.MissingFieldError=Ze,exports.ObservableQuery=hr,exports.checkFetcher=Ue,exports.concat=Qe,exports.createHttpLink=Ye,exports.createSignalIfSupported=He,exports.defaultDataIdFromObject=nt,exports.defaultPrinter=ze,exports.empty=qe,exports.execute=Fe,exports.fallbackHttpConfig=Ve,exports.from=Re,exports.fromError=we,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=Er,exports.isApolloError=ur,exports.isReference=w,exports.makeReference=_,exports.makeVar=It,exports.mergeOptions=_e,exports.operationName=Cr,exports.parseAndCheckHttpResponse=Le,exports.parser=Dr,exports.resetApolloContext=Er,exports.rewriteURIForGET=Je,exports.selectHttpOptionsAndBody=function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return n.unshift(r),We.apply(void 0,e.__spreadArray([t,ze],n,!1))},exports.selectHttpOptionsAndBodyInternal=We,exports.selectURI=Ke,exports.serializeFetchParameter=Ae,exports.split=Pe,exports.throwServerError=Oe,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=qr,exports.useFragment_experimental=function(t){var n=qr().cache,i=t.fragment,o=t.fragmentName,a=t.from,s=t.optimistic,u=void 0===s||s,l=e.__rest(t,["fragment","fragmentName","from","optimistic"]),f=e.__assign(e.__assign({},l),{id:"string"==typeof a?a:n.identify(a),query:n.getFragmentDoc(i,o),optimistic:u}),p=c.useRef(),h=n.diff(f);return Pr((function(t){return n.watch(e.__assign(e.__assign({},f),{immediate:!0,callback:function(e){r.equal(e,h)||(p.current=Lr(h=e),t())}}))}),(function(){var e=Lr(h);return p.current&&r.equal(p.current.data,e.data)?p.current:p.current=e}))},exports.useLazyQuery=function(t,r){var n=jr(qr(r&&r.client),t),i=c.useRef(),o=i.current?_e(r,i.current):r,a=n.useQuery(e.__assign(e.__assign({},o),{skip:!i.current})),s=a.observable.options.initialFetchPolicy||n.getDefaultFetchPolicy(),u=Object.assign(a,{called:!!i.current}),l=c.useMemo((function(){for(var e={},t=function(t){var r=u[t];e[t]=function(){return i.current||(i.current=Object.create(null),n.forceUpdate()),r.apply(this,arguments)}},r=0,o=Nr;r<o.length;r++){t(o[r])}return e}),[]);return Object.assign(u,l),[c.useCallback((function(t){i.current=t?e.__assign(e.__assign({},t),{fetchPolicy:t.fetchPolicy||s}):{fetchPolicy:s};var r=n.asyncUpdate().then((function(e){return Object.assign(e,l)}));return r.catch((function(){})),r}),[]),u]},exports.useMutation=function(t,n){var i=qr(null==n?void 0:n.client);Ir(t,exports.DocumentType.Mutation);var o=c.useState({called:!1,loading:!1,client:i}),a=o[0],s=o[1],u=c.useRef({result:a,mutationId:0,isMounted:!0,client:i,mutation:t,options:n});Object.assign(u.current,{client:i,options:n,mutation:t});var l=c.useCallback((function(t){void 0===t&&(t={});var n=u.current,i=n.client,o=n.options,a=n.mutation,c=e.__assign(e.__assign({},o),{mutation:a});u.current.result.loading||c.ignoreResults||!u.current.isMounted||s(u.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:i});var l=++u.current.mutationId,f=_e(c,t);return i.mutate(f).then((function(e){var n,o,a,c=e.data,p=e.errors,h=p&&p.length>0?new lr({graphQLErrors:p}):void 0;if(l===u.current.mutationId&&!f.ignoreResults){var d={called:!0,loading:!1,data:c,error:h,client:i};u.current.isMounted&&!r.equal(u.current.result,d)&&s(u.current.result=d)}return null===(o=null===(n=u.current.options)||void 0===n?void 0:n.onCompleted)||void 0===o||o.call(n,e.data,f),null===(a=t.onCompleted)||void 0===a||a.call(t,e.data,f),e})).catch((function(e){var n,o,a,c;if(l===u.current.mutationId&&u.current.isMounted){var p={loading:!1,error:e,data:void 0,called:!0,client:i};r.equal(u.current.result,p)||s(u.current.result=p)}if((null===(n=u.current.options)||void 0===n?void 0:n.onError)||f.onError)return null===(a=null===(o=u.current.options)||void 0===o?void 0:o.onError)||void 0===a||a.call(o,e,f),null===(c=t.onError)||void 0===c||c.call(t,e,f),{data:void 0,errors:e};throw e}))}),[]),f=c.useCallback((function(){u.current.isMounted&&s({called:!1,loading:!1,client:i})}),[]);return c.useEffect((function(){return u.current.isMounted=!0,function(){u.current.isMounted=!1}}),[]),[l,e.__assign({reset:f},a)]},exports.useQuery=function(e,t){return void 0===t&&(t=Object.create(null)),jr(qr(t.client),e).useQuery(t)},exports.useReactiveVar=function(e){var t=e(),r=c.useState(t)[1];return c.useEffect((function(){var n=e();if(t===n)return e.onNextChange(r);r(n)}),[t]),t},exports.useSubscription=function(e,t){var n=c.useRef(!1),i=qr(null==t?void 0:t.client);Ir(e,exports.DocumentType.Subscription);var o=c.useState({loading:!(null==t?void 0:t.skip),error:void 0,data:void 0,variables:null==t?void 0:t.variables}),a=o[0],s=o[1];n.current||(n.current=!0,null==t||t.onSubscriptionData,null==t||t.onSubscriptionComplete);var u=c.useState((function(){return(null==t?void 0:t.skip)?null:i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})})),l=u[0],f=u[1],p=c.useRef(!1);c.useEffect((function(){return function(){p.current=!0}}),[]);var h=c.useRef({client:i,subscription:e,options:t});return c.useEffect((function(){var n,o,a,u,c=null==t?void 0:t.shouldResubscribe;"function"==typeof c&&(c=!!c(t)),(null==t?void 0:t.skip)?(!(null==t?void 0:t.skip)!=!(null===(n=h.current.options)||void 0===n?void 0:n.skip)||p.current)&&(s({loading:!1,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),f(null),p.current=!1):(!1===c||i===h.current.client&&e===h.current.subscription&&(null==t?void 0:t.fetchPolicy)===(null===(o=h.current.options)||void 0===o?void 0:o.fetchPolicy)&&!(null==t?void 0:t.skip)==!(null===(a=h.current.options)||void 0===a?void 0:a.skip)&&r.equal(null==t?void 0:t.variables,null===(u=h.current.options)||void 0===u?void 0:u.variables))&&!p.current||(s({loading:!0,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),f(i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})),p.current=!1),Object.assign(h.current,{client:i,subscription:e,options:t})}),[i,e,t,p.current]),c.useEffect((function(){if(l){var e=l.subscribe({next:function(e){var r,n,o={loading:!1,data:e.data,error:void 0,variables:null==t?void 0:t.variables};s(o),(null===(r=h.current.options)||void 0===r?void 0:r.onData)?h.current.options.onData({client:i,data:o}):(null===(n=h.current.options)||void 0===n?void 0:n.onSubscriptionData)&&h.current.options.onSubscriptionData({client:i,subscriptionData:o})},error:function(e){var r,n;s({loading:!1,data:void 0,error:e,variables:null==t?void 0:t.variables}),null===(n=null===(r=h.current.options)||void 0===r?void 0:r.onError)||void 0===n||n.call(r,e)},complete:function(){var e,t;(null===(e=h.current.options)||void 0===e?void 0:e.onComplete)?h.current.options.onComplete():(null===(t=h.current.options)||void 0===t?void 0:t.onSubscriptionComplete)&&h.current.options.onSubscriptionComplete()}});return function(){e.unsubscribe()}}}),[l]),a};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("ts-invariant"),r=require("@wry/equality"),n=require("zen-observable-ts");require("symbol-observable");var i=require("graphql"),o=require("optimism"),a=require("@wry/context"),s=require("@wry/trie"),u=require("graphql-tag"),c=require("react");function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e)for(var r in e)t[r]=e[r];return t.default=e,Object.freeze(t)}var f=l(c);function h(e){try{return e()}catch(e){}}function p(e,r){var n=e.directives;return!n||!n.length||function(e){var r=[];e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var n=e.arguments;e.name.value;t.invariant(n&&1===n.length,40);var i=n[0];t.invariant(i.name&&"if"===i.name.value,41);var o=i.value;t.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),42),r.push({directive:e,ifArgument:i})}}));return r}(n).every((function(e){var n=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=r&&r[i.value.name.value],t.invariant(void 0!==o,39)):o=i.value.value,"skip"===n.name.value?!o:o}))}function d(e,t,r){var n=new Set(e),o=n.size;return i.visit(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return i.BREAK}}),r?!n.size:n.size<o}function v(e){return e&&d(["client","export"],e,!0)}function y(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 m(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function g(e,r){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var n=e.name.value;if("function"==typeof r)return r(n);var i=r&&r[n];return t.invariant(i,45),i||null;default:return null}}function b(e){return null!==e&&"object"==typeof e}function _(e){return{__ref:String(e)}}function w(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function O(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 O(o,e.name,e.value,i)})),e[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];e[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))e[r.value]=n.values.map((function(e){var t={};return O(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))e[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new t.InvariantError(54);e[r.value]=null}}var S=["connection","include","skip","client","rest","export"],k=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]})),"".concat(r.connection.key,"(").concat(x(i),")")}return r.connection.key}var o=e;if(t){var a=x(t);o+="(".concat(a,")")}return r&&Object.keys(r).forEach((function(e){-1===S.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(x(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=x;return x=e,t}}),x=function(e){return JSON.stringify(e,E)};function E(e,t){return b(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function q(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return O(r,n,i,t)})),r}return null}function R(e){return e.alias?e.alias.value:e.name.value}function P(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(Q(o)){if("__typename"===o.name.value)return e[R(o)]}else{var a=P(e,g(o,r).selectionSet,r);if("string"==typeof a)return a}}}function Q(e){return"Field"===e.kind}function F(e){return"InlineFragment"===e.kind}function C(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 C(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function I(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function M(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function T(e){var r=D(e);return t.invariant(r&&"query"===r.operation,49),r}function j(e){var r;C(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new t.InvariantError(53)}function N(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&O(t,e.variable.name,e.defaultValue)})),t}function A(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 L={kind:"Field",name:{kind:"Name",value:"__typename"}};function V(e,t){return!e||e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&V(t[e.name.value],t)}))}function z(e){return V(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),m(M(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 B(t,r){var n=Object.create(null),o=[],a=Object.create(null),s=[],u=z(i.visit(r,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(n[e.name.value]=!0)}},Field:{enter:function(e){if(t&&e.directives&&(t.some((function(e){return e.remove}))&&e.directives&&e.directives.some(W(t))))return e.arguments&&e.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),e.selectionSet&&K(e.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(e){if(W(t)(e))return null}}}));return u&&A(o,(function(e){return!!e.name&&!n[e.name]})).length&&(u=function(t,r){var n=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(t);return z(i.visit(r,{OperationDefinition:{enter:function(r){return e.__assign(e.__assign({},r),{variableDefinitions:r.variableDefinitions?r.variableDefinitions.filter((function(e){return!t.some((function(t){return t.name===e.variable.name.value}))})):[]})}},Field:{enter:function(e){if(t.some((function(e){return e.remove}))){var r=0;if(e.arguments&&e.arguments.forEach((function(e){n(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(n(e))return null}}}))}(o,u)),u&&A(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return z(i.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(s,u)),u}var U=Object.assign((function(t){return i.visit(t,{SelectionSet:{enter:function(t,r,n){if(!n||"OperationDefinition"!==n.kind){var i=t.selections;if(i)if(!i.some((function(e){return Q(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(Q(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return e.__assign(e.__assign({},t),{selections:e.__spreadArray(e.__spreadArray([],i,!0),[L],!1)})}}}}})}),{added:function(e){return e===L}}),H={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 K(e){var t=[];return e.selections.forEach((function(e){(Q(e)||F(e))&&e.selectionSet?K(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function J(t){return"query"===j(t).operation?t:i.visit(t,{OperationDefinition:{enter:function(t){return e.__assign(e.__assign({},t),{operation:"query"})}}})}var G=Object.prototype.hasOwnProperty;function Y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return X(e)}function X(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new Z,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var $=function(e,t,r){return this.merge(e[r],t[r])},Z=function(){function t(e){void 0===e&&(e=$),this.reconciler=e,this.isObject=b,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 b(r)&&b(t)?(Object.keys(r).forEach((function(o){if(G.call(t,o)){var a=t[o];if(r[o]!==a){var s=n.reconciler.apply(n,e.__spreadArray([t,r,o],i,!1));s!==a&&((t=n.shallowCopyForMerge(t))[o]=s)}}else(t=n.shallowCopyForMerge(t))[o]=r[o]})),t):r},t.prototype.shallowCopyForMerge=function(t){return b(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}(),ee=Object.prototype.toString;function te(e){return re(e)}function re(e,t){switch(ee.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]=re(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]=re(e[r],t)})),n;default:return e}}function ne(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function ie(e,t,r){return new n.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},h=e.subscribe(f);return function(){return h.unsubscribe()}}))}var oe="function"==typeof WeakMap&&"ReactNative"!==h((function(){return navigator.product})),ae="function"==typeof WeakSet,se="function"==typeof Symbol&&"function"==typeof Symbol.for,ue=se&&Symbol.asyncIterator,ce="function"==typeof h((function(){return window.document.createElement})),le=h((function(){return navigator.userAgent.indexOf("jsdom")>=0}))||!1,fe=ce&&!le;function he(e){function t(t){Object.defineProperty(e,t,{value:n.Observable})}return se&&Symbol.species&&t(Symbol.species),t("@@species"),e}function pe(e){return e&&"function"==typeof e.then}var de=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.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],r.notify("next",e),ne(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),r.notify("error",e),ne(r.observers,"error",e))},complete:function(){var e=r.sub;if(null!==e){var t=r.sources.shift();t?pe(t)?t.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=t.subscribe(r.handlers):(e&&setTimeout((function(){return e.unsubscribe()})),r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),r.notify("complete"),ne(r.observers,"complete"))}}},r.nextResultListeners=new Set,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)]),pe(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))},r.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},r.prototype.notify=function(e,t){var r=this.nextResultListeners;r.size&&(this.nextResultListeners=new Set,r.forEach((function(r){return r(e,t)})))},r.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add((function(r,n){t||(t=!0,e(r,n))}))},r}(n.Observable);function ve(e){return Array.isArray(e)&&e.length>0}function ye(e){return"incremental"in e}function me(e,t){var r=e,n=new Z;return ye(t)&&ve(t.incremental)&&t.incremental.forEach((function(e){for(var t=e.data,i=e.path,o=i.length-1;o>=0;--o){var a=i[o],s=!isNaN(+a)?[]:{};s[a]=t,t=s}r=n.merge(r,t)})),r}function ge(e){return ve(be(e))}function be(e){var t=ve(e.errors)?e.errors.slice(0):[];return ye(e)&&ve(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function _e(){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}he(de);var we=new Map;function Oe(e){var t=we.get(e)||1;return we.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Se(t,r){return _e(t,r,r.variables&&{variables:e.__assign(e.__assign({},t&&t.variables),r.variables)})}function ke(e){return new n.Observable((function(t){t.error(e)}))}var xe=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 Ee(e,t){return t?t(e):n.Observable.of()}function qe(e){return"function"==typeof e?new Pe(e):e}function Re(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 Pe=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(qe).reduce((function(e,t){return e.concat(t)}))},r.split=function(e,t,i){var o=qe(t),a=qe(i||new r(Ee));return Re(o)&&Re(a)?new r((function(t){return e(t)?o.request(t)||n.Observable.of():a.request(t)||n.Observable.of()})):new r((function(t,r){return e(t)?o.request(t,r)||n.Observable.of():a.request(t,r)||n.Observable.of()}))},r.execute=function(r,i){return r.request(function(t,r){var n=e.__assign({},t);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(t){n="function"==typeof t?e.__assign(e.__assign({},n),t(n)):e.__assign(e.__assign({},n),t)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return e.__assign({},n)}}),r}(i.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?I(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=qe(e);if(Re(i))return i;var o=qe(t);return Re(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(Ee)))},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}(),Qe=Pe.empty,Fe=Pe.from,Ce=Pe.split,De=Pe.concat,Ie=Pe.execute;function Me(e){var t=null,r=null,n=!1,i=[],o=[];function a(e){if(!r){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}i.push(e)}}function s(e){r=e,o.slice().forEach((function(t){t[1](e)})),!t||t()}function u(){n=!0,o.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!t||t()}t=function(){t=null,e.removeListener("data",a),e.removeListener("error",s),e.removeListener("end",u),e.removeListener("finish",u),e.removeListener("close",u)},e.on("data",a),e.on("error",s),e.on("end",u),e.on("finish",u),e.on("close",u);var c={next:function(){return new Promise((function(e,t){return r?t(r):i.length?e({value:i.shift(),done:!1}):n?e({value:void 0,done:!0}):void o.push([e,t])}))}};return ue&&(c[Symbol.asyncIterator]=function(){return this}),c}function Te(e){var t={next:function(){return e.read()}};return ue&&(t[Symbol.asyncIterator]=function(){return this}),t}function je(e){var t,r,n=e;if(e.body&&(n=e.body),function(e){return!(!ue||!e[Symbol.asyncIterator])}(n))return r=n[Symbol.asyncIterator](),(t={next:function(){return r.next()}})[Symbol.asyncIterator]=function(){return this},t;if(function(e){return!!e.getReader}(n))return Te(n.getReader());if(function(e){return!!e.stream}(n))return Te(n.stream().getReader());if(function(e){return!!e.arrayBuffer}(n))return function(e){var t=!1,r={next:function(){return t?Promise.resolve({value:void 0,done:!0}):(t=!0,new Promise((function(t,r){e.then((function(e){t({value:e,done:!1})})).catch(r)})))}};return ue&&(r[Symbol.asyncIterator]=function(){return this}),r}(n.arrayBuffer());if(function(e){return!!e.pipe}(n))return Me(n);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Ne=Object.prototype.hasOwnProperty;function Ae(e){var t={};return e.split("\n").forEach((function(e){var r=e.indexOf(":");if(r>-1){var n=e.slice(0,r).trim().toLowerCase(),i=e.slice(r+1).trim();t[n]=i}})),t}function Le(e,t){if(e.status>=300){xe(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status))}try{return JSON.parse(t)}catch(n){var r=n;throw r.name="ServerParseError",r.response=e,r.statusCode=e.status,r.bodyText=t,r}}function Ve(e,t){var r,n;"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&(null===(r=t.next)||void 0===r||r.call(t,e.result)),null===(n=t.error)||void 0===n||n.call(t,e))}function ze(e){return function(t){return t.text().then((function(e){return Le(t,e)})).then((function(r){return t.status>=300&&xe(t,r,"Response not successful: Received status code ".concat(t.status)),Array.isArray(r)||Ne.call(r,"data")||Ne.call(r,"errors")||xe(t,r,"Server response was missing for query '".concat(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName,"'.")),r}))}}var We=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},Be={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Ue=function(e,t){return t(e)};function He(t,r){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var a={},s={};n.forEach((function(t){a=e.__assign(e.__assign(e.__assign({},a),t.options),{headers:e.__assign(e.__assign({},a.headers),t.headers)}),t.credentials&&(a.credentials=t.credentials),s=e.__assign(e.__assign({},s),t.http)})),a.headers=Ke(a.headers,s.preserveHeaderCase);var u=t.operationName,c=t.extensions,l=t.variables,f=t.query,h={operationName:u,variables:l};return s.includeExtensions&&(h.extensions=c),s.includeQuery&&(h.query=r(f,i.print)),{options:a,body:h}}function Ke(e,t){if(!t){var r=Object.create(null);return Object.keys(Object(e)).forEach((function(t){r[t.toLowerCase()]=e[t]})),r}var n=Object.create(null);Object.keys(Object(e)).forEach((function(t){n[t.toLowerCase()]={originalName:t,value:e[t]}}));var i=Object.create(null);return Object.keys(n).forEach((function(e){i[n[e].originalName]=n[e].value})),i}var Je=function(e){if(!e&&"undefined"==typeof fetch)throw new t.InvariantError(22)},Ge=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},Ye=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function Xe(e,t){var r=[],n=function(e,t){r.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=We(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=We(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var $e=h((function(){return fetch})),Ze=function(t){void 0===t&&(t={});var r=t.uri,o=void 0===r?"/graphql":r,a=t.fetch,s=t.print,u=void 0===s?Ue:s,c=t.includeExtensions,l=t.preserveHeaderCase,f=t.useGETForQueries,p=t.includeUnusedVariables,v=void 0!==p&&p,y=e.__rest(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);var m={http:{includeExtensions:c,preserveHeaderCase:l},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Pe((function(t){var r=Ye(t,o),s=t.getContext(),c={};if(s.clientAwareness){var l=s.clientAwareness,p=l.name,y=l.version;p&&(c["apollographql-client-name"]=p),y&&(c["apollographql-client-version"]=y)}var g,b=e.__assign(e.__assign({},c),s.headers),_={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:b},w=He(t,u,Be,m,_),O=w.options,S=w.body;if(S.variables&&!v){var k=new Set(Object.keys(S.variables));i.visit(t.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&k.delete(e.name.value)}}),k.size&&(S.variables=e.__assign({},S.variables),k.forEach((function(e){delete S.variables[e]})))}if(!O.signal){var x=Ge(),E=x.controller,q=x.signal;(g=E)&&(O.signal=q)}if(f&&!t.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(O.method="GET"),d(["defer"],t.query)&&(O.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),"GET"===O.method){var R=Xe(r,S),P=R.newURI,Q=R.parseError;if(Q)return ke(Q);r=P}else try{O.body=We(S)}catch(Q){return ke(Q)}return new n.Observable((function(n){return(a||h((function(){return fetch}))||$e)(r,O).then((function(r){var i;t.setContext({response:r});var o=null===(i=r.headers)||void 0===i?void 0:i.get("content-type");return null!==o&&/^multipart\/mixed/i.test(o)?function(t,r){var n,i,o;return e.__awaiter(this,void 0,void 0,(function(){var a,s,u,c,l,f,h,p,d,v,y,m,g,b,_,w,O,S,k,x;return e.__generator(this,(function(e){switch(e.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),s=null===(n=t.headers)||void 0===n?void 0:n.get("content-type"),u="boundary=",c=(null==s?void 0:s.includes(u))?null==s?void 0:s.substring((null==s?void 0:s.indexOf(u))+u.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),f="",h=je(t),p=!0,e.label=1;case 1:return p?[4,h.next()]:[3,3];case 2:for(d=e.sent(),v=d.value,y=d.done,m="string"==typeof v?v:a.decode(v),p=!y,g=(f+=m).indexOf(l);g>-1;){if(b=void 0,x=[f.slice(0,g),f.slice(g+l.length)],f=x[1],(b=x[0]).trim()){if(_=b.indexOf("\r\n\r\n"),w=Ae(b.slice(0,_)),(O=w["content-type"])&&-1===O.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");S=b.slice(_);try{k=Le(t,S.replace("\r\n","")),(Object.keys(k).length>1||"data"in k||"incremental"in k||"errors"in k)&&(null===(i=r.next)||void 0===i||i.call(r,k))}catch(e){Ve(e,r)}}g=f.indexOf(l)}return[3,1];case 3:return null===(o=r.complete)||void 0===o||o.call(r),[2]}}))}))}(r,n):function(e,t,r){ze(t)(e).then((function(e){var t,n;null===(t=r.next)||void 0===t||t.call(r,e),null===(n=r.complete)||void 0===n||n.call(r)})).catch((function(e){return Ve(e,r)}))}(r,t,n)})).catch((function(e){return Ve(e,n)})),function(){g&&g.abort()}}))}))},et=function(t){function r(e){void 0===e&&(e={});var r=t.call(this,Ze(e).request)||this;return r.options=e,r}return e.__extends(r,t),r}(Pe),tt=function(){function t(){this.getFragmentDoc=o.wrap(y)}return t.prototype.batch=function(e){var t,r=this,n="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(r)}),n),t},t.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{rootId:t.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{query:this.getFragmentDoc(t.fragment,t.fragmentName),rootId:t.id,optimistic:r}))},t.prototype.writeQuery=function(t){var r=t.id,n=t.data,i=e.__rest(t,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(t){var r=t.id,n=t.data,i=t.fragment,o=t.fragmentName,a=e.__rest(t,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:r,result:n}))},t.prototype.updateQuery=function(t,r){return this.batch({update:function(n){var i=n.readQuery(t),o=r(i);return null==o?i:(n.writeQuery(e.__assign(e.__assign({},t),{data:o})),o)}})},t.prototype.updateFragment=function(t,r){return this.batch({update:function(n){var i=n.readFragment(t),o=r(i);return null==o?i:(n.writeFragment(e.__assign(e.__assign({},t),{data:o})),o)}})},t}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var rt=function(t){function r(e,n,i,o){var a,s=t.call(this,e)||this;if(s.message=e,s.path=n,s.query=i,s.variables=o,Array.isArray(s.path)){s.missing=s.message;for(var u=s.path.length-1;u>=0;--u)s.missing=((a={})[s.path[u]]=s.missing,a)}else s.missing=s.path;return s.__proto__=r.prototype,s}return e.__extends(r,t),r}(Error),nt=Object.prototype.hasOwnProperty;function it(e){return null==e}var ot=Array.isArray;function at(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=it(n)?it(i)?void 0:{_id:i}:{id:n}),it(n)&&!it(i)&&(n=i),!it(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var st={dataIdFromObject:at,addTypename:!0,resultCaching:!0,canonizeResults:!1};function ut(e){var t=e.canonizeResults;return void 0===t?st.canonizeResults:t}var ct=/^[_a-z][_0-9a-z]*/i;function lt(e){var t=e.match(ct);return t?t[0]:e}function ft(e,t,r){return!!b(t)&&(ot(t)?t.every((function(t){return ft(e,t,r)})):e.selections.every((function(e){if(Q(e)&&p(e,r)){var n=R(e);return nt.call(t,n)&&(!e.selectionSet||ft(e.selectionSet,t[n],r))}return!0})))}function ht(e){return b(e)&&!w(e)&&!ot(e)}function pt(e,t){var r=m(M(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var dt=Object.create(null),vt=function(){return dt},yt=Object.create(null),mt=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 _(e);if(w(e))return e;var n=r.policies.identify(e)[0];if(n){var i=_(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),nt.call(this.data,e)){var r=this.data[e];if(r&&nt.call(r,t))return r[t]}return"__typename"===t&&nt.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof wt?this.parent.get(e,t):void 0},r.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),nt.call(this.data,e)?this.data[e]:this instanceof wt?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,a="string"==typeof r?this.lookup(n=r):r;if(a){t.invariant("string"==typeof n,1);var s=new Z(St).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=lt(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof wt||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},r.prototype.modify=function(t,r){var n=this,i=this.lookup(t);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:dt,INVALIDATE:yt,isReference:w,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||_(t)}:e,{store:n})}};if(Object.keys(i).forEach((function(c){var l=lt(c),f=i[c];if(void 0!==f){var h="function"==typeof r?r:r[c]||r[l];if(h){var p=h===vt?dt:h(f,e.__assign(e.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(t,c)}));p===yt?n.group.dirty(t,c):(p===dt&&(p=void 0),p!==f&&(o[c]=p,a=!0,f=p))}void 0!==f&&(s=!1)}})),a)return this.merge(t,o),s&&(this instanceof wt?this.data[t]=void 0:delete this.data[t],this.group.dirty(t,"__exists")),!0}return!1},r.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=vt,n):vt)}return!1},r.prototype.evict=function(e,t){var r=!1;return e.id&&(nt.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof wt&&this!==t&&(r=this.parent.evict(e,t)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){nt.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&&nt.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 wt?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){nt.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 wt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},r.prototype.findChildRefIds=function(e){if(!nt.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),b(e)&&Object.keys(e).forEach((function(t){var r=e[t];b(r)&&n.add(r)}))}))}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),gt=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?o.dep():null,this.keyMaker=new s.Trie(oe)},e.prototype.depend=function(e,t){if(this.d){this.d(bt(e,t));var r=lt(t);r!==t&&this.d(bt(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(bt(e,t),"__exists"===t?"forget":"setDirty")},e}();function bt(e,t){return t+"#"+e}function _t(e,t){kt(e)&&e.group.depend(t,"__exists")}!function(t){var r=function(t){function r(e){var r=e.policies,n=e.resultCaching,i=void 0===n||n,o=e.seed,a=t.call(this,r,new gt(i))||this;return a.stump=new Ot(a),a.storageTrie=new s.Trie(oe),o&&a.replace(o),a}return e.__extends(r,t),r.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(t);t.Root=r}(mt||(mt={}));var wt=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 nt.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}(mt),Ot=function(t){function r(e){return t.call(this,"EntityStore.Stump",e,(function(){}),new gt(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}(wt);function St(e,t,n){var i=e[n],o=t[n];return r.equal(i,o)?i:o}function kt(e){return!!(e instanceof mt&&e.group.caching)}var xt,Et,qt=function(){function t(){this.known=new(ae?WeakSet:Set),this.pool=new s.Trie(oe),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return b(e)&&this.known.has(e)},t.prototype.pass=function(t){if(b(t)){var r=function(t){return b(t)?ot(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(b(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},t.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},t}(),Rt=Object.assign((function(e){if(b(e)){void 0===xt&&Pt();var t=xt.admit(e),r=Et.get(t);return void 0===r&&Et.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:Pt});function Pt(){xt=new qt,Et=new(oe?WeakMap:Map)}function Qt(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var Ft=function(){function r(t){var r=this;this.knownResults=new(oe?WeakMap:Map),this.config=_e(t,{addTypename:!1!==t.addTypename,canonizeResults:ut(t)}),this.canon=t.canon||new qt,this.executeSelectionSet=o.wrap((function(t){var n,i=t.context.canonizeResults,o=Qt(t);o[3]=!i;var a=(n=r.executeSelectionSet).peek.apply(n,o);return a?i?e.__assign(e.__assign({},a),{result:r.canon.admit(a.result)}):a:(_t(t.context.store,t.enclosingRef.__ref),r.execSelectionSetImpl(t))}),{max:this.config.resultCacheMaxSize,keyArgs:Qt,makeCacheKey:function(e,t,r,n){if(kt(r.store))return r.store.makeCacheKey(e,w(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=o.wrap((function(e){return _t(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(kt(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return r.prototype.resetCanon=function(){this.canon=new qt},r.prototype.diffQueryAgainstStore=function(t){var r=t.store,n=t.query,i=t.rootId,o=void 0===i?"ROOT_QUERY":i,a=t.variables,s=t.returnPartialData,u=void 0===s||s,c=t.canonizeResults,l=void 0===c?this.config.canonizeResults:c,f=this.config.cache.policies;a=e.__assign(e.__assign({},N(T(n))),a);var h,p=_(o),d=this.executeSelectionSet({selectionSet:j(n).selectionSet,objectOrReference:p,enclosingRef:p,context:e.__assign({store:r,query:n,policies:f,variables:a,varString:Rt(a),canonizeResults:l},pt(n,this.config.fragments))});if(d.missing&&(h=[new rt(Ct(d.missing),d.missing,n,a)],!u))throw h[0];return{result:d.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,r,n){if(kt(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,o=e.objectOrReference,a=e.enclosingRef,s=e.context;if(w(o)&&!s.policies.rootTypenamesById[o.__ref]&&!s.store.has(o.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(o.__ref," object")};var u,c=s.variables,l=s.policies,f=s.store.getFieldValue(o,"__typename"),h=[],d=new Z;function v(e,t){var r;return e.missing&&(u=d.merge(u,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof f&&!l.rootIdsByTypename[f]&&h.push({__typename:f});var y=new Set(n.selections);y.forEach((function(e){var n,m;if(p(e,c))if(Q(e)){var b=l.readField({fieldName:e.name.value,field:e,variables:s.variables,from:o},s),_=R(e);void 0===b?U.added(e)||(u=d.merge(u,((n={})[_]="Can't find field '".concat(e.name.value,"' on ").concat(w(o)?o.__ref+" object":"object "+JSON.stringify(o,null,2)),n))):ot(b)?b=v(r.executeSubSelectedArray({field:e,array:b,enclosingRef:a,context:s}),_):e.selectionSet?null!=b&&(b=v(r.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:b,enclosingRef:w(b)?b:a,context:s}),_)):s.canonizeResults&&(b=r.canon.pass(b)),void 0!==b&&h.push(((m={})[_]=b,m))}else{var O=g(e,s.lookupFragment);if(!O&&e.kind===i.Kind.FRAGMENT_SPREAD)throw new t.InvariantError(5);O&&l.fragmentMatches(O,f)&&O.selectionSet.selections.forEach(y.add,y)}}));var m={result:X(h),missing:u},b=s.canonizeResults?this.canon.admit(m):m;return b.result&&this.knownResults.set(b.result,n),b},r.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,a=e.context,s=new Z;function u(e,r){var n;return e.missing&&(t=s.merge(t,((n={})[r]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(a.store.canRead)),i=i.map((function(e,t){return null===e?null:ot(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:a}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:w(e)?e:o,context:a}),t):e})),{result:a.canonizeResults?this.canon.admit(i):i,missing:t}},r}();function Ct(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var Dt=new a.Slot,It=new WeakMap;function Mt(e){var t=It.get(e);return t||It.set(e,t={vars:new Set,dep:o.dep()}),t}function Tt(e){Mt(e).vars.forEach((function(t){return t.forgetCache(e)}))}function jt(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Mt(e).dep.dirty(n),Nt(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=Dt.getValue();s&&(i(s),Mt(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),Mt(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function Nt(e){e.broadcastWatches&&e.broadcastWatches()}var At=Object.create(null);function Lt(e){var t=JSON.stringify(e);return At[t]||(At[t]=Object.create(null))}function Vt(e){var r=Lt(e);return r.keyFieldsFn||(r.keyFieldsFn=function(r,n){var i=function(e,t){return n.readField(t,e)},o=n.keyObject=Wt(e,(function(e){var o=Ht(n.storeObject,e,i);return void 0===o&&r!==n.storeObject&&nt.call(r,e[0])&&(o=Ht(r,e,Ut)),t.invariant(void 0!==o,2),o}));return"".concat(n.typename,":").concat(JSON.stringify(o))})}function zt(e){var t=Lt(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,a=Wt(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Ht(t,e)}else{var a=r.slice(1);if(i&&nt.call(i,a)){var s=e.slice(0);return s[0]=a,Ht(i,s)}}else if(n&&ve(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&q(c,i);return l&&Ht(l,e.slice(1))}})),s=JSON.stringify(a);return(t||"{}"!==s)&&(o+=":"+s),o})}function Wt(e,t){var r=new Z;return Bt(e).reduce((function(e,n){var i,o=t(n);if(void 0!==o){for(var a=n.length-1;a>=0;--a)(i={})[n[a]]=o,o=i;e=r.merge(e,o)}return e}),Object.create(null))}function Bt(e){var t=Lt(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){ot(t)?(Bt(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),ot(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function Ut(e,t){return e[t]}function Ht(e,t,r){return r=r||Ut,Kt(t.reduce((function e(t,n){return ot(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Kt(e){return b(e)?ot(e)?e.map(Kt):Wt(Object.keys(e).sort(),(function(t){return Ht(e,t)})):e}function Jt(e){return void 0!==e.args?e.args:e.field?q(e.field,e.variables):null}k.setStringify(Rt);var Gt=function(){},Yt=function(e,t){return t.fieldName},Xt=function(e,t,r){return(0,r.mergeObjects)(e,t)},$t=function(e,t){return t},Zt=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:at},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(t,r){var n,i=this,o=r&&(r.typename||(null===(n=r.storeObject)||void 0===n?void 0:n.__typename))||t.__typename;if(o===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var a,s=r&&r.storeObject||t,u=e.__assign(e.__assign({},r),{typename:o,storeObject:s,readField:r&&r.readField||function(){var e=tr(arguments,s);return i.readField(e,{store:i.cache.data,variables:e.variables})}}),c=o&&this.getTypePolicy(o),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var f=l(t,u);if(!ot(f)){a=f;break}l=Vt(f)}return a=a?String(a):void 0,u.keyObject?[a,u.keyObject]:[a]},r.prototype.addTypePolicies=function(t){var r=this;Object.keys(t).forEach((function(n){var i=t[n],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=e.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),a&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),nt.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},r.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?Xt:!1===t?$t:e.merge}a(n,t.merge),n.keyFn=!1===i?Gt:ot(i)?Vt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?Yt:ot(s)?zt(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Yt)}))},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,3),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(ct);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},r.prototype.getTypePolicy=function(t){var r=this;if(!nt.call(this.typePolicies,t)){var n=this.typePolicies[t]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(t);i&&i.size&&i.forEach((function(t){var i=r.getTypePolicy(t),o=i.fields,a=e.__rest(i,["fields"]);Object.assign(n,a),Object.assign(n.fields,o)}))}var o=this.toBeAdded[t];return o&&o.length&&o.splice(0).forEach((function(e){r.updateTypePolicy(t,e)})),this.typePolicies[t]},r.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},r.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&ft(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},r.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},r.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=Jt(e);o;){var u=o(s,a);if(!ot(u)){t=u||n;break}o=zt(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 O(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 O(n,r,i,t)}))),k(e.name.value,n,r)}(e.field,e.variables):k(n,Jt(e))),!1===t?n:n===lt(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=lt(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=er(this,r,e,t,t.store.getStorage(w(r)?r.__ref:r,i));return Dt.withValue(this.cache,u,[a,c])}return a}},r.prototype.getReadFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return r&&r.read},r.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},r.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===Xt?rr(n.store)(e,t):s===$t?t:(n.overwrite&&(e=void 0),s(e,t,er(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},r}();function er(e,t,r,n,i){var o=e.getStoreFieldName(r),a=lt(o),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Jt(r),field:r.field||null,fieldName:a,storeFieldName:o,variables:s,isReference:w,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(tr(arguments,t,s),n)},mergeObjects:rr(n.store)}}function tr(t,r,n){var i,o=t[0],a=t[1],s=t.length;return"string"==typeof o?i={fieldName:o,from:s>1?a:r}:(i=e.__assign({},o),nt.call(i,"from")||(i.from=r)),void 0===i.variables&&(i.variables=n),i}function rr(r){return function(n,i){if(ot(n)||ot(i))throw new t.InvariantError(4);if(b(n)&&b(i)){var o=r.getFieldValue(n,"__typename"),a=r.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(w(n)&&ht(i))return r.merge(n.__ref,i),n;if(ht(n)&&w(i))return r.merge(n,i.__ref),i;if(ht(n)&&ht(i))return e.__assign(e.__assign({},n),i)}return i}}function nr(t,r,n){var i="".concat(r).concat(n),o=t.flavors.get(i);return o||t.flavors.set(i,o=t.clientOnly===r&&t.deferred===n?t:e.__assign(e.__assign({},t),{clientOnly:r,deferred:n})),o}var ir=function(){function r(e,t,r){this.cache=e,this.reader=t,this.fragments=r}return r.prototype.writeToStore=function(r,n){var i=this,o=n.query,a=n.result,s=n.dataId,u=n.variables,c=n.overwrite,l=D(o),f=new Z;u=e.__assign(e.__assign({},N(l)),u);var h=e.__assign(e.__assign({store:r,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:Rt(u)},pt(o,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),p=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:h});if(!w(p))throw new t.InvariantError(7);return h.incomingById.forEach((function(e,t){var n=e.storeObject,o=e.mergeTree,a=(e.fieldNodeSet,_(t));if(o&&o.map.size){var s=i.applyMerges(o,a,n,h);if(w(s))return;n=s}r.merge(t,n)})),r.retain(p.__ref),p},r.prototype.processSelectionSet=function(t){var r=this,n=t.dataId,i=t.result,o=t.selectionSet,a=t.context,s=t.mergeTree,u=this.cache.policies,c=Object.create(null),l=n&&u.rootTypenamesById[n]||P(i,o,a.fragmentMap)||n&&a.store.get(n,"__typename");"string"==typeof l&&(c.__typename=l);var f=function(){var t=tr(arguments,c,a.variables);if(w(t.from)){var r=a.incomingById.get(t.from.__ref);if(r){var n=u.readField(e.__assign(e.__assign({},t),{from:r.storeObject}),a);if(void 0!==n)return n}}return u.readField(t,a)},h=new Set;this.flattenFields(o,i,a,l).forEach((function(e,t){var n,o=R(t),a=i[o];if(h.add(t),void 0!==a){var p=u.getStoreFieldName({typename:l,fieldName:t.name.value,field:t,variables:e.variables}),d=ar(s,p),v=r.processFieldValue(a,t,t.selectionSet?nr(e,!1,!1):e,d),y=void 0;t.selectionSet&&(w(v)||ht(v))&&(y=f("__typename",v));var m=u.getMergeFunction(l,t.name.value,y);m?d.info={field:t,typename:l,merge:m}:cr(s,p),c=e.merge(c,((n={})[p]=v,n))}else 0}));try{var p=u.identify(i,{typename:l,selectionSet:o,fragmentMap:a.fragmentMap,storeObject:c,readField:f}),d=p[0],v=p[1];n=n||d,v&&(c=a.merge(c,v))}catch(e){if(!n)throw e}if("string"==typeof n){var y=_(n),m=a.written[n]||(a.written[n]=[]);if(m.indexOf(o)>=0)return y;if(m.push(o),this.reader&&this.reader.isFresh(i,y,o,a))return y;var g=a.incomingById.get(n);return g?(g.storeObject=a.merge(g.storeObject,c),g.mergeTree=sr(g.mergeTree,s),h.forEach((function(e){return g.fieldNodeSet.add(e)}))):a.incomingById.set(n,{storeObject:c,mergeTree:ur(s)?void 0:s,fieldNodeSet:h}),y}return c},r.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?ot(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,ar(n,o));return cr(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},r.prototype.flattenFields=function(e,r,n,o){void 0===o&&(o=P(r,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new s.Trie(!1);return function e(s,l){var f=c.lookup(s,l.clientOnly,l.deferred);f.visited||(f.visited=!0,s.selections.forEach((function(s){if(p(s,n.variables)){var c=l.clientOnly,f=l.deferred;if(c&&f||!ve(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(c=!0),"defer"===t){var r=q(e,n.variables);r&&!1===r.if||(f=!0)}})),Q(s)){var h=a.get(s);h&&(c=c&&h.clientOnly,f=f&&h.deferred),a.set(s,nr(n,c,f))}else{var d=g(s,n.lookupFragment);if(!d&&s.kind===i.Kind.FRAGMENT_SPREAD)throw new t.InvariantError(8);d&&u.fragmentMatches(d,o,r,n.variables)&&e(d.selectionSet,nr(n,c,f))}}})))}(e,n),a},r.prototype.applyMerges=function(r,n,i,o,a){var s,u=this;if(r.map.size&&!w(i)){var c,l=ot(i)||!w(n)&&!ht(n)?void 0:n,f=i;l&&!a&&(a=[w(l)?l.__ref:l]);var h=function(e,t){return ot(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};r.map.forEach((function(e,r){var n=h(l,r),i=h(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(e,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&t.invariant(a.pop()===r)}})),c&&(i=ot(f)?f.slice(0):e.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return r.info?this.cache.policies.runMergeFunction(n,i,r.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},r}(),or=[];function ar(e,t){var r=e.map;return r.has(t)||r.set(t,or.pop()||{map:new Map}),r.get(t)}function sr(t,r){if(t===r||!r||ur(r))return t;if(!t||ur(t))return r;var n=t.info&&r.info?e.__assign(e.__assign({},t.info),r.info):t.info||r.info,i=t.map.size&&r.map.size,o={info:n,map:i?new Map:t.map.size?t.map:r.map};if(i){var a=new Set(r.map.keys());t.map.forEach((function(e,t){o.map.set(t,sr(e,r.map.get(t))),a.delete(t)})),a.forEach((function(e){o.map.set(e,sr(r.map.get(e),t.map.get(e)))}))}return o}function ur(e){return!e||!(e.info||e.map.size)}function cr(e,t){var r=e.map,n=r.get(t);n&&ur(n)&&(or.push(n),r.delete(t))}new Set;var lr=function(t){function n(e){void 0===e&&(e={});var r=t.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=jt,r.txCount=0,r.config=function(e){return _e(st,e)}(e),r.addTypename=!!r.config.addTypename,r.policies=new Zt({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return e.__extends(n,t),n.prototype.init=function(){var e=this.data=new mt.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,n=this.config.fragments;this.storeWriter=new ir(this,this.storeReader=new Ft({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ut(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=o.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(kt(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,Rt({optimistic:n,id: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 rt)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(nt.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){Mt(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&&Tt(t),t.maybeBroadcastWatch.forget(e)}},n.prototype.gc=function(e){Rt.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){if(w(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){}},n.prototype.evict=function(t){if(!t.id){if(nt.call(t,"id"))return!1;t=e.__assign(e.__assign({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},n.prototype.reset=function(e){var t=this;return this.init(),Rt.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Tt(this)):this.broadcastWatches(),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,n=this,i=t.update,o=t.optimistic,a=void 0===o||o,s=t.removeOptimistic,u=t.onWatchUpdated,c=function(e){var t=n,o=t.data,a=t.optimisticData;++n.txCount,e&&(n.data=n.optimisticData=e);try{return r=i(n)}finally{--n.txCount,n.data=o,n.optimisticData=a}},l=new Set;return u&&!this.txCount&&this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof a?this.optimisticData=this.optimisticData.addLayer(a,c):!1===a?c(this.data):c(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),u&&l.size?(this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e,t){var r=u.call(this,e,t);return!1!==r&&l.delete(e),r}})),l.size&&l.forEach((function(e){return n.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(t),r},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=U(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},n.prototype.transformForLink=function(e){var t=this.config.fragments;return t?t.transform(e):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(e);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}(tt);function fr(e){return e.hasOwnProperty("graphQLErrors")}var hr,pr=function(t){function r(e){var n,i,o=e.graphQLErrors,a=e.clientErrors,s=e.networkError,u=e.errorMessage,c=e.extraInfo,l=t.call(this,u)||this;return l.name="ApolloError",l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(ve((n=l).graphQLErrors)||ve(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+="".concat(t,"\n")})),n.networkError&&(i+="".concat(n.networkError.message,"\n")),i=i.replace(/\n$/,"")),l.extraInfo=c,l.__proto__=r.prototype,l}return e.__extends(r,t),r}(Error);function dr(e){return!!e&&e<7}exports.NetworkStatus=void 0,(hr=exports.NetworkStatus||(exports.NetworkStatus={}))[hr.loading=1]="loading",hr[hr.setVariables=2]="setVariables",hr[hr.fetchMore=3]="fetchMore",hr[hr.refetch=4]="refetch",hr[hr.poll=6]="poll",hr[hr.ready=7]="ready",hr[hr.error=8]="error";var vr=Object.assign,yr=(Object.hasOwnProperty,function(n){function i(t){var r=t.queryManager,i=t.queryInfo,o=t.options,a=n.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=gr)}catch(e){}var r=!a.observers.size;a.observers.add(e);var n=a.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&a.reobserve().catch((function(){})),function(){a.observers.delete(e)&&!a.observers.size&&a.tearDownQuery()}}))||this;a.observers=new Set,a.subscriptions=new Set,a.queryInfo=i,a.queryManager=r,a.isTornDown=!1;var s=r.defaultOptions.watchQuery,u=(void 0===s?{}:s).fetchPolicy,c=void 0===u?"cache-first":u,l=o.fetchPolicy,f=void 0===l?c:l,h=o.initialFetchPolicy,p=void 0===h?"standby"===f?c:f:h;a.options=e.__assign(e.__assign({},o),{initialFetchPolicy:p,fetchPolicy:f}),a.queryId=i.queryId||r.generateQueryId();var d=D(a.query);return a.queryName=d&&d.name&&d.name.value,a}return e.__extends(i,n),Object.defineProperty(i.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),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:dr(i),networkStatus:i}),a=this.options.fetchPolicy,s=void 0===a?"cache-first":a;if("network-only"===s||"no-cache"===s||"standby"===s||this.queryManager.transform(this.options.query).hasForcedResolvers);else{var u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(o.data=u.result),r.equal(o.data,{})&&(o.data=void 0),u.complete?(delete o.partial,!u.complete||o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==s&&"cache-only"!==s||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1)):o.partial=!0}return t&&this.updateLastResult(o),o},i.prototype.isDifferentFromLastResult=function(e,t){return!this.last||!r.equal(this.last.result,e)||t&&!r.equal(this.last.variables,t)},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 n.fetchPolicy="cache-and-network"===i?i:"no-cache"===i?"no-cache":"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(e.__assign({},this.options),{query:this.query}),t),{variables:e.__assign(e.__assign({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId(),o=this.queryInfo,a=o.networkStatus;o.networkStatus=exports.NetworkStatus.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(i,n,exports.NetworkStatus.fetchMore).then((function(e){return r.queryManager.removeQuery(i),o.networkStatus===exports.NetworkStatus.fetchMore&&(o.networkStatus=a),r.queryManager.cache.batch({update:function(i){var o=t.updateQuery;o?i.updateQuery({query:r.query,variables:r.variables,returnPartialData:!0,optimistic:!1},(function(t){return o(t,{fetchMoreResult:e.data,variables:n.variables})})):i.writeQuery({query:n.query,variables:n.variables,data:e.data})},onWatchUpdated:function(e){s.add(e.query)}}),e})).finally((function(){s.has(r.query)||mr(r)}))},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.options.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.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var r=t.fetchPolicy,n=void 0===r?"cache-first":r,i=t.initialFetchPolicy,o=void 0===i?n:i;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:o}):t.fetchPolicy="variables-changed"===e?o:t.nextFetchPolicy)}return t.fetchPolicy},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&&(dr(e.queryInfo.networkStatus)?o():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"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:te(t),variables:r}),ve(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,a=this.options.variables,s=this.options.fetchPolicy,u=_e(this.options,t||{}),c=o?u:vr(this.options,u);o||(this.updatePolling(),t&&t.variables&&!r.equal(t.variables,a)&&"standby"!==c.fetchPolicy&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),void 0===n&&(n=exports.NetworkStatus.setVariables)));var l=c.variables&&e.__assign({},c.variables),f=this.fetch(c,n),h={next:function(e){i.reportResult(e,l)},error:function(e){i.reportError(e,l)}};return o||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=h),f.addObserver(h),f.promise},i.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},i.prototype.reportResult=function(e,t){var r=this.getLastError();(r||this.isDifferentFromLastResult(e,t))&&((r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),ne(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),ne(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 mr(e){var t=e.options,r=t.fetchPolicy,n=t.nextFetchPolicy;return"cache-and-network"===r||"network-only"===r?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,"function"==typeof n?n.apply(this,arguments):r}}):e.reobserve()}function gr(e){}he(yr);var br=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=Y(t.resolvers,e)})):this.resolvers=Y(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(t){var r=t.document,n=t.remoteResult,i=t.context,o=t.variables,a=t.onlyRunForcedResolvers,s=void 0!==a&&a;return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,s).then((function(t){return e.__assign(e.__assign({},n),{data:t.result})}))]:[2,n]}))}))},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return d(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return function(e){C(e);var t=B([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=i.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return Q(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},r.prototype.prepareContext=function(t){var r=this.cache;return e.__assign(e.__assign({},t),{cache:r,getCacheKey:function(e){return r.identify(e)}})},r.prototype.addExportedVariables=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,r)||{},this.prepareContext(n),r).then((function(t){return e.__assign(e.__assign({},r),t.exportedVariables)}))]:[2,e.__assign({},r)]}))}))},r.prototype.shouldForceResolvers=function(e){var t=!1;return i.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return i.BREAK}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:J(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(t,r,n,i,o,a){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),e.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,h,p,d,v;return e.__generator(this,(function(y){return s=j(t),u=M(t),c=m(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",p=(h=this).cache,d=h.client,v={fragmentMap:c,context:e.__assign(e.__assign({},n),{cache:p,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,r,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},r.prototype.resolveSelectionSet=function(r,n,i){return e.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return e.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[n],c=function(r){return e.__awaiter(l,void 0,void 0,(function(){var c,l;return e.__generator(this,(function(e){return p(r,s)?Q(r)?[2,this.resolveField(r,n,i).then((function(e){var t;void 0!==e&&u.push(((t={})[R(r)]=e,t))}))]:(F(r)?c=r:(c=o[r.name.value],t.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,a))?[2,this.resolveSelectionSet(c.selectionSet,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(r.selections.map(c)).then((function(){return X(u)}))]}))}))},r.prototype.resolveField=function(t,r,n){return e.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,h,p=this;return e.__generator(this,(function(e){return i=n.variables,o=t.name.value,a=R(t),s=o!==a,u=r[a]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(l=r.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(h=f[s?o:a])&&(c=Promise.resolve(Dt.withValue(this.cache,h,[r,q(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)?p.resolveSubSelectedArray(t,e,n):t.selectionSet?p.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}(),_r=new(oe?WeakMap:Map);function wr(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return _r.set(e,(_r.get(e)+1)%1e15),r.apply(this,arguments)})}function Or(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Sr=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;_r.has(r)||(_r.set(r,0),wr(r,"evict"),wr(r,"modify"),wr(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(){Or(this),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){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0: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():mr(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Or(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(dr(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===_r.get(this.cache)&&r.equal(t,n.variables)&&r.equal(e.data,n.result.data))},t.prototype.markResult=function(e,t,r,n){var i=this,o=new Z,a=ve(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&ve(e.incremental)){var s=me(this.getDiff().result,e);e.data=s}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=a,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(kr(e,r.errorPolicy)?this.cache.performTransaction((function(o){if(i.shouldWrite(e,r.variables))o.writeQuery({query:t,data:e.data,variables:r.variables,overwrite:1===n}),i.lastWrite={result:e,variables:r.variables,dmCount:_r.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete)return void(e.data=i.lastDiff.diff.result);var a=i.getDiffOptions(r.variables),s=o.diff(a);i.stopped||i.updateWatch(r.variables),i.updateLastDiff(s,a),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 kr(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!ge(e);return!n&&r&&e.data&&(n=!0),n}var xr=Object.prototype.hasOwnProperty,Er=function(){function r(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.queryDeduplication,o=void 0!==i&&i,a=e.onBroadcast,s=e.ssrMode,u=void 0!==s&&s,c=e.clientAwareness,l=void 0===c?{}:c,f=e.localState,h=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(oe?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=l,this.localState=f||new br({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!h,(this.onBroadcast=a)&&(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,i,o=r.mutation,a=r.variables,s=r.optimisticResponse,u=r.updateQueries,c=r.refetchQueries,l=void 0===c?[]:c,f=r.awaitRefetchQueries,h=void 0!==f&&f,p=r.update,d=r.onQueryUpdated,v=r.fetchPolicy,y=void 0===v?(null===(n=this.defaultOptions.mutate)||void 0===n?void 0:n.fetchPolicy)||"network-only":v,m=r.errorPolicy,g=void 0===m?(null===(i=this.defaultOptions.mutate)||void 0===i?void 0:i.errorPolicy)||"none":m,b=r.keepRootFields,_=r.context;return e.__awaiter(this,void 0,void 0,(function(){var r,n,i,c,f,v;return e.__generator(this,(function(m){switch(m.label){case 0:return t.invariant(o,14),t.invariant("network-only"===y||"no-cache"===y,15),r=this.generateMutationId(),n=this.transform(o),i=n.document,c=n.hasClientExports,o=this.cache.transformForLink(i),a=this.getVariables(o,a),c?[4,this.localState.addExportedVariables(o,a,_)]:[3,2];case 1:a=m.sent(),m.label=2;case 2:return f=this.mutationStore&&(this.mutationStore[r]={mutation:o,variables:a,loading:!0,error:null}),s&&this.markMutationOptimistic(s,{mutationId:r,document:o,variables:a,fetchPolicy:y,errorPolicy:g,context:_,updateQueries:u,update:p,keepRootFields:b}),this.broadcastQueries(),v=this,[2,new Promise((function(t,n){return ie(v.getObservableFromLink(o,e.__assign(e.__assign({},_),{optimisticResponse:s}),a,!1),(function(t){if(ge(t)&&"none"===g)throw new pr({graphQLErrors:be(t)});f&&(f.loading=!1,f.error=null);var n=e.__assign({},t);return"function"==typeof l&&(l=l(n)),"ignore"===g&&ge(n)&&delete n.errors,v.markMutationResult({mutationId:r,result:n,document:o,variables:a,fetchPolicy:y,errorPolicy:g,context:_,update:p,updateQueries:u,awaitRefetchQueries:h,refetchQueries:l,removeOptimistic:s?r:void 0,onQueryUpdated:d,keepRootFields:b})})).subscribe({next:function(e){v.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||t(e)},error:function(e){f&&(f.loading=!1,f.error=e),s&&v.cache.removeOptimistic(r),v.broadcastQueries(),n(e instanceof pr?e:new pr({networkError:e}))}})}))]}}))}))},r.prototype.markMutationResult=function(t,r){var n=this;void 0===r&&(r=this.cache);var i=t.result,o=[],a="no-cache"===t.fetchPolicy;if(!a&&kr(i,t.errorPolicy)){if(ye(i)||o.push({result:i.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables}),ye(i)&&ve(i.incremental)){var s=me(r.diff({id:"ROOT_MUTATION",query:this.transform(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0}).result,i);void 0!==s&&(i.data=s,o.push({result:s,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables}))}var u=t.updateQueries;u&&this.queries.forEach((function(e,t){var a=e.observableQuery,s=a&&a.queryName;if(s&&xr.call(u,s)){var c=u[s],l=n.queries.get(t),f=l.document,h=l.variables,p=r.diff({query:f,variables:h,returnPartialData:!0,optimistic:!1}),d=p.result;if(p.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&I(f)||void 0,queryVariables:h});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:h})}}}))}if(o.length>0||t.refetchQueries||t.update||t.onQueryUpdated||t.removeOptimistic){var c=[];if(this.refetchQueries({updateCache:function(r){a||o.forEach((function(e){return r.write(e)}));var s,u=t.update,c=!(ye(s=i)||function(e){return"hasNext"in e&&"data"in e}(s))||ye(i)&&!i.hasNext;if(u){if(!a){var l=r.diff({id:"ROOT_MUTATION",query:n.transform(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0});l.complete&&("incremental"in(i=e.__assign(e.__assign({},i),{data:l.result}))&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}c&&u(r,i,{context:t.context,variables:t.variables})}a||t.keepRootFields||!c||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 c.push(e)})),t.awaitRefetchQueries||t.onQueryUpdated)return Promise.all(c).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=this.transformCache;if(!r.has(t)){var n=this.cache.transformDocument(t),i=B([H],C(n)),o=this.localState.clientQuery(n),a=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:v(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:a,defaultVars:N(D(n)),asQuery:e.__assign(e.__assign({},n),{definitions:n.definitions.map((function(t){return"OperationDefinition"===t.kind&&"query"!==t.operation?e.__assign(e.__assign({},t),{operation:"query"}):t}))})},u=function(e){e&&!r.has(e)&&r.set(e,s)};u(t),u(n),u(o),u(a)}return r.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 Sr(this),n=new yr({queryManager:this,queryInfo:r,options:t});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.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(e){return void 0===e&&(e={discardWatches:!0}),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(e)},r.prototype.getObservableQueries=function(r){var n=this;void 0===r&&(r="active");var i=new Map,o=new Map,a=new Set;return Array.isArray(r)&&r.forEach((function(e){var t;"string"==typeof e?o.set(e,!1):b(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?o.set(n.transform(e).document,!1):b(e)&&e.query&&a.add(e)})),this.queries.forEach((function(e,t){var n=e.observableQuery,a=e.document;if(n){if("all"===r)return void i.set(t,n);var s=n.queryName;if("standby"===n.options.fetchPolicy||"active"===r&&!n.hasObservers())return;("active"===r||s&&o.has(s)||a&&o.has(a))&&(i.set(t,n),s&&o.set(s,!0),a&&o.set(a,!0))}})),a.size&&a.forEach((function(r){var o=Oe("legacyOneTimeQuery"),a=n.getQuery(o).init({document:r.query,variables:r.variables}),s=new yr({queryManager:n,queryInfo:a,options:e.__assign(e.__assign({},r),{fetchPolicy:"network-only"})});t.invariant(s.queryId===o),a.setObservableQuery(s),i.set(o,s)})),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,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(n){if("no-cache"!==i&&(kr(n,o)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),ge(n))throw new pr({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new n.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(t,r,i,o){var a,s,u=this;void 0===o&&(o=null!==(a=null==r?void 0:r.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(t).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,h={query:c,variables:i,operationName:I(c)||void 0,context:this.prepareContext(e.__assign(e.__assign({},r),{forceFetch:!o}))};if(r=h.context,o){var p=l.get(c)||new Map;l.set(c,p);var d=Rt(i);if(!(s=p.get(d))){var v=new de([Ie(f,h)]);p.set(d,s=v),v.beforeNext((function(){p.delete(d)&&p.size<1&&l.delete(c)}))}}else s=new de([Ie(f,h)])}else s=new de([n.Observable.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(t).clientQuery;return y&&(s=ie(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:i})}))),s},r.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(this.transform(e.document).document);return ie(this.getObservableFromLink(i,r.context,r.variables),(function(o){var a=be(o),s=a.length>0;if(n>=e.lastRequestId){if(s&&"none"===r.errorPolicy)throw e.markError(new pr({graphQLErrors:a}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:exports.NetworkStatus.ready};return s&&"ignore"!==r.errorPolicy&&(u.errors=a,u.networkStatus=exports.NetworkStatus.error),u}),(function(t){var r=fr(t)?t:new pr({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},r.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),a=this.getQuery(e),s=this.defaultOptions.watchQuery,u=t.fetchPolicy,c=void 0===u?s&&s.fetchPolicy||"cache-first":u,l=t.errorPolicy,f=void 0===l?s&&s.errorPolicy||"none":l,h=t.returnPartialData,p=void 0!==h&&h,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,y=t.context,m=void 0===y?{}:y,g=Object.assign({},t,{query:i,variables:o,fetchPolicy:c,errorPolicy:f,returnPartialData:p,notifyOnNetworkStatusChange:v,context:m}),b=function(e){g.variables=e;var i=n.fetchQueryByPolicy(a,g,r);return"standby"!==g.fetchPolicy&&i.length>0&&a.observableQuery&&a.observableQuery.applyNextFetchPolicy("after-fetch",t),i},_=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,(function(e){_(),setTimeout((function(){return w.cancel(e)}))}));var w=new de(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(b):b(g.variables));return w.promise.then(_,_),w},r.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?Oe("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Sr&&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),i}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},r.prototype.fetchQueryByPolicy=function(t,r,i){var o=this,a=r.query,s=r.variables,u=r.fetchPolicy,c=r.refetchWritePolicy,l=r.errorPolicy,f=r.returnPartialData,h=r.context,p=r.notifyOnNetworkStatusChange,d=t.networkStatus;t.init({document:this.transform(a).document,variables:s,networkStatus:i});var v=function(){return t.getDiff(s)},y=function(r,i){void 0===i&&(i=t.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(t){return n.Observable.of(e.__assign({data:t,loading:dr(i),networkStatus:i},r.complete?null:{partial:!0}))};return u&&o.transform(a).hasForcedResolvers?o.localState.runResolvers({document:a,remoteResult:{data:u},context:h,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:i===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return o.getResultsFromLink(t,m,{variables:s,context:h,fetchPolicy:u,errorPolicy:l})},b=p&&"number"==typeof d&&d!==i&&dr(i);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,t.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),t.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(t.getDiff()),g()]:[g()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Sr(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}(),qr=function(){function r(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,a=e.cache,s=e.ssrMode,u=void 0!==s&&s,c=e.ssrForceFetchDelay,l=void 0===c?0:c,f=e.connectToDevTools,h=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,p=e.queryDeduplication,d=void 0===p||p,v=e.defaultOptions,y=e.assumeImmutableResults,m=void 0!==y&&y,g=e.resolvers,b=e.typeDefs,_=e.fragmentMatcher,w=e.name,O=e.version,S=e.link;if(S||(S=n?new et({uri:n,credentials:i,headers:o}):Pe.empty()),!a)throw new t.InvariantError(9);this.link=S,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||Object.create(null),this.typeDefs=b,l&&setTimeout((function(){return r.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),h&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.7.3",this.localState=new br({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Er({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:O},localState:this.localState,assumeImmutableResults:m,onBroadcast:h?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=Se(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=Se(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=Se(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 Ie(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).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({discardWatches:!0})})).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}(),Rr=se?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Pr(){var e=f.createContext[Rr];return e||(Object.defineProperty(f.createContext,Rr,{value:e=f.createContext({}),enumerable:!1,writable:!1,configurable:!0}),e.displayName="ApolloContext"),e}function Qr(e){var r=c.useContext(Pr()),n=e||r.client;return t.invariant(!!n,31),n}var Fr,Cr=f.useSyncExternalStore||function(e,t,r){var n=t();var i=f.useState({inst:{value:n,getSnapshot:t}}),o=i[0].inst,a=i[1];return fe?f.useLayoutEffect((function(){Object.assign(o,{value:n,getSnapshot:t}),Dr(o)&&a({inst:o})}),[e,n,t]):Object.assign(o,{value:n,getSnapshot:t}),f.useEffect((function(){return Dr(o)&&a({inst:o}),e((function(){Dr(o)&&a({inst:o})}))}),[e]),n};function Dr(e){var t=e.value,r=e.getSnapshot;try{return t!==r()}catch(e){return!0}}exports.DocumentType=void 0,(Fr=exports.DocumentType||(exports.DocumentType={}))[Fr.Query=0]="Query",Fr[Fr.Mutation=1]="Mutation",Fr[Fr.Subscription=2]="Subscription";var Ir=new Map;function Mr(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 Tr(e){var r,n,i=Ir.get(e);if(i)return i;t.invariant(!!e&&!!e.kind,32);for(var o=[],a=[],s=[],u=[],c=0,l=e.definitions;c<l.length;c++){var f=l[c];if("FragmentDefinition"!==f.kind){if("OperationDefinition"===f.kind)switch(f.operation){case"query":a.push(f);break;case"mutation":s.push(f);break;case"subscription":u.push(f)}}else o.push(f)}t.invariant(!o.length||a.length||s.length||u.length,33),t.invariant(a.length+s.length+u.length<=1,34),n=a.length?exports.DocumentType.Query:exports.DocumentType.Mutation,a.length||s.length||(n=exports.DocumentType.Subscription);var h=a.length?a:s.length?s:u;t.invariant(1===h.length,35);var p=h[0];r=p.variableDefinitions||[];var d={name:p.name&&"Name"===p.name.kind?p.name.value:"data",type:n,variables:r};return Ir.set(e,d),d}function jr(e,r){var n=Tr(e);Mr(r),Mr(n.type);t.invariant(n.type===r,36)}var Nr=Object.prototype.hasOwnProperty;function Ar(e,t){var r=c.useRef();r.current&&e===r.current.client&&t===r.current.query||(r.current=new Lr(e,t,r.current));var n=r.current,i=c.useState(0);i[0];var o=i[1];return n.forceUpdate=function(){o((function(e){return e+1}))},n}var Lr=function(){function t(e,t,r){this.client=e,this.query=t,this.asyncResolveFns=new Set,this.optionsToIgnoreOnce=new(ae?WeakSet:Set),this.ssrDisabledResult={loading:!0,data:void 0,error:void 0,networkStatus:exports.NetworkStatus.loading},this.skipStandbyResult={loading:!1,data:void 0,error:void 0,networkStatus:exports.NetworkStatus.ready},this.toQueryResultCache=new(oe?WeakMap:Map),jr(t,exports.DocumentType.Query);var n=r&&r.result,i=n&&n.data;i&&(this.previousData=i)}return t.prototype.forceUpdate=function(){},t.prototype.asyncUpdate=function(){var e=this;return new Promise((function(t){e.asyncResolveFns.add(t),e.optionsToIgnoreOnce.add(e.watchQueryOptions),e.forceUpdate()}))},t.prototype.useQuery=function(e){var t=this;this.renderPromises=c.useContext(Pr()).renderPromises,this.useOptions(e);var n=this.useObservableQuery(),i=Cr(c.useCallback((function(){if(t.renderPromises)return function(){};var e=function(){var e=t.result,i=n.getCurrentResult();e&&e.loading===i.loading&&e.networkStatus===i.networkStatus&&r.equal(e.data,i.data)||t.setResult(i)},i=function(a){var s=n.last;o.unsubscribe();try{n.resetLastResults(),o=n.subscribe(e,i)}finally{n.last=s}if(!Nr.call(a,"graphQLErrors"))throw a;var u=t.result;(!u||u&&u.loading||!r.equal(a,u.error))&&t.setResult({data:u&&u.data,error:a,loading:!1,networkStatus:exports.NetworkStatus.error})},o=n.subscribe(e,i);return function(){return o.unsubscribe()}}),[n,this.renderPromises,this.client.disableNetworkFetches]),(function(){return t.getCurrentResult()}),(function(){return t.getCurrentResult()}));this.unsafeHandlePartialRefetch(i);var o=this.toQueryResult(i);return!o.loading&&this.asyncResolveFns.size&&(this.asyncResolveFns.forEach((function(e){return e(o)})),this.asyncResolveFns.clear()),o},t.prototype.useOptions=function(e){var n,i=this.createWatchQueryOptions(this.queryHookOptions=e),o=this.watchQueryOptions;!this.optionsToIgnoreOnce.has(o)&&r.equal(i,o)||(this.watchQueryOptions=i,o&&this.observable&&(this.optionsToIgnoreOnce.delete(o),this.observable.reobserve(this.getObsQueryOptions()),this.previousData=(null===(n=this.result)||void 0===n?void 0:n.data)||this.previousData,this.result=void 0)),this.onCompleted=e.onCompleted||t.prototype.onCompleted,this.onError=e.onError||t.prototype.onError,!this.renderPromises&&!this.client.disableNetworkFetches||!1!==this.queryHookOptions.ssr||this.queryHookOptions.skip?this.queryHookOptions.skip||"standby"===this.watchQueryOptions.fetchPolicy?this.result=this.skipStandbyResult:this.result!==this.ssrDisabledResult&&this.result!==this.skipStandbyResult||(this.result=void 0):this.result=this.ssrDisabledResult},t.prototype.getObsQueryOptions=function(){var e=[],t=this.client.defaultOptions.watchQuery;return t&&e.push(t),this.queryHookOptions.defaultOptions&&e.push(this.queryHookOptions.defaultOptions),e.push(_e(this.observable&&this.observable.options,this.watchQueryOptions)),e.reduce(Se)},t.prototype.createWatchQueryOptions=function(t){var r;void 0===t&&(t={});var n=t.skip;t.ssr,t.onCompleted,t.onError,t.defaultOptions;var i=e.__rest(t,["skip","ssr","onCompleted","onError","defaultOptions"]),o=Object.assign(i,{query:this.query});if(!this.renderPromises||"network-only"!==o.fetchPolicy&&"cache-and-network"!==o.fetchPolicy||(o.fetchPolicy="cache-first"),o.variables||(o.variables={}),n){var a=o.fetchPolicy,s=void 0===a?this.getDefaultFetchPolicy():a,u=o.initialFetchPolicy,c=void 0===u?s:u;Object.assign(o,{initialFetchPolicy:c,fetchPolicy:"standby"})}else o.fetchPolicy||(o.fetchPolicy=(null===(r=this.observable)||void 0===r?void 0:r.options.initialFetchPolicy)||this.getDefaultFetchPolicy());return o},t.prototype.getDefaultFetchPolicy=function(){var e,t;return(null===(e=this.queryHookOptions.defaultOptions)||void 0===e?void 0:e.fetchPolicy)||(null===(t=this.client.defaultOptions.watchQuery)||void 0===t?void 0:t.fetchPolicy)||"cache-first"},t.prototype.onCompleted=function(e){},t.prototype.onError=function(e){},t.prototype.useObservableQuery=function(){var e=this.observable=this.renderPromises&&this.renderPromises.getSSRObservable(this.watchQueryOptions)||this.observable||this.client.watchQuery(this.getObsQueryOptions());this.obsQueryFields=c.useMemo((function(){return{refetch:e.refetch.bind(e),reobserve:e.reobserve.bind(e),fetchMore:e.fetchMore.bind(e),updateQuery:e.updateQuery.bind(e),startPolling:e.startPolling.bind(e),stopPolling:e.stopPolling.bind(e),subscribeToMore:e.subscribeToMore.bind(e)}}),[e]);var t=!(!1===this.queryHookOptions.ssr||this.queryHookOptions.skip);return this.renderPromises&&t&&(this.renderPromises.registerSSRObservable(e),e.getCurrentResult().loading&&this.renderPromises.addObservableQueryPromise(e)),e},t.prototype.setResult=function(e){var t=this.result;t&&t.data&&(this.previousData=t.data),this.result=e,this.forceUpdate(),this.handleErrorOrCompleted(e)},t.prototype.handleErrorOrCompleted=function(e){var t=this;e.loading||Promise.resolve().then((function(){e.error?t.onError(e.error):e.data&&t.onCompleted(e.data)})).catch((function(e){}))},t.prototype.getCurrentResult=function(){return this.result||this.handleErrorOrCompleted(this.result=this.observable.getCurrentResult()),this.result},t.prototype.toQueryResult=function(t){var r=this.toQueryResultCache.get(t);if(r)return r;var n=t.data;t.partial;var i=e.__rest(t,["data","partial"]);return this.toQueryResultCache.set(t,r=e.__assign(e.__assign(e.__assign({data:n},i),this.obsQueryFields),{client:this.client,observable:this.observable,variables:this.observable.variables,called:!this.queryHookOptions.skip,previousData:this.previousData})),!r.error&&ve(t.errors)&&(r.error=new pr({graphQLErrors:t.errors})),r},t.prototype.unsafeHandlePartialRefetch=function(e){!e.partial||!this.queryHookOptions.partialRefetch||e.loading||e.data&&0!==Object.keys(e.data).length||"cache-only"===this.observable.options.fetchPolicy||(Object.assign(e,{loading:!0,networkStatus:exports.NetworkStatus.refetch}),this.observable.refetch())},t}(),Vr=["refetch","reobserve","fetchMore","updateQuery","startPolling","subscribeToMore"];function zr(e){var t={data:e.result,complete:!!e.complete};return e.missing&&(t.missing=X(e.missing.map((function(e){return e.missing})))),t}exports.setLogVerbosity=t.setVerbosity,exports.Observable=n.Observable,exports.disableExperimentalFragmentVariables=u.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=u.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=u.enableExperimentalFragmentVariables,exports.gql=u.gql,exports.resetCaches=u.resetCaches,exports.ApolloCache=tt,exports.ApolloClient=qr,exports.ApolloConsumer=function(e){var r=Pr();return f.createElement(r.Consumer,null,(function(r){return t.invariant(r&&r.client,27),e.children(r.client)}))},exports.ApolloError=pr,exports.ApolloLink=Pe,exports.ApolloProvider=function(e){var r=e.client,n=e.children,i=Pr();return f.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),f.createElement(i.Provider,{value:e},n)}))},exports.HttpLink=et,exports.InMemoryCache=lr,exports.MissingFieldError=rt,exports.ObservableQuery=yr,exports.checkFetcher=Je,exports.concat=De,exports.createHttpLink=Ze,exports.createSignalIfSupported=Ge,exports.defaultDataIdFromObject=at,exports.defaultPrinter=Ue,exports.empty=Qe,exports.execute=Ie,exports.fallbackHttpConfig=Be,exports.from=Fe,exports.fromError=ke,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=Pr,exports.isApolloError=fr,exports.isReference=w,exports.makeReference=_,exports.makeVar=jt,exports.mergeOptions=Se,exports.operationName=Mr,exports.parseAndCheckHttpResponse=ze,exports.parser=Tr,exports.resetApolloContext=Pr,exports.rewriteURIForGET=Xe,exports.selectHttpOptionsAndBody=function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return n.unshift(r),He.apply(void 0,e.__spreadArray([t,Ue],n,!1))},exports.selectHttpOptionsAndBodyInternal=He,exports.selectURI=Ye,exports.serializeFetchParameter=We,exports.split=Ce,exports.throwServerError=xe,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=Qr,exports.useFragment_experimental=function(t){var n=Qr().cache,i=t.fragment,o=t.fragmentName,a=t.from,s=t.optimistic,u=void 0===s||s,l=e.__rest(t,["fragment","fragmentName","from","optimistic"]),f=e.__assign(e.__assign({},l),{id:"string"==typeof a?a:n.identify(a),query:n.getFragmentDoc(i,o),optimistic:u}),h=c.useRef(),p=n.diff(f);return Cr((function(t){return n.watch(e.__assign(e.__assign({},f),{immediate:!0,callback:function(e){r.equal(e,p)||(h.current=zr(p=e),t())}}))}),(function(){var e=zr(p);return h.current&&r.equal(h.current.data,e.data)?h.current:h.current=e}))},exports.useLazyQuery=function(t,r){var n=Ar(Qr(r&&r.client),t),i=c.useRef(),o=i.current?Se(r,i.current):r,a=n.useQuery(e.__assign(e.__assign({},o),{skip:!i.current})),s=a.observable.options.initialFetchPolicy||n.getDefaultFetchPolicy(),u=Object.assign(a,{called:!!i.current}),l=c.useMemo((function(){for(var e={},t=function(t){var r=u[t];e[t]=function(){return i.current||(i.current=Object.create(null),n.forceUpdate()),r.apply(this,arguments)}},r=0,o=Vr;r<o.length;r++){t(o[r])}return e}),[]);return Object.assign(u,l),[c.useCallback((function(t){i.current=t?e.__assign(e.__assign({},t),{fetchPolicy:t.fetchPolicy||s}):{fetchPolicy:s};var r=n.asyncUpdate().then((function(e){return Object.assign(e,l)}));return r.catch((function(){})),r}),[]),u]},exports.useMutation=function(t,n){var i=Qr(null==n?void 0:n.client);jr(t,exports.DocumentType.Mutation);var o=c.useState({called:!1,loading:!1,client:i}),a=o[0],s=o[1],u=c.useRef({result:a,mutationId:0,isMounted:!0,client:i,mutation:t,options:n});Object.assign(u.current,{client:i,options:n,mutation:t});var l=c.useCallback((function(t){void 0===t&&(t={});var n=u.current,i=n.client,o=n.options,a=n.mutation,c=e.__assign(e.__assign({},o),{mutation:a});u.current.result.loading||c.ignoreResults||!u.current.isMounted||s(u.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:i});var l=++u.current.mutationId,f=Se(c,t);return i.mutate(f).then((function(e){var n,o,a,c=e.data,h=e.errors,p=h&&h.length>0?new pr({graphQLErrors:h}):void 0;if(l===u.current.mutationId&&!f.ignoreResults){var d={called:!0,loading:!1,data:c,error:p,client:i};u.current.isMounted&&!r.equal(u.current.result,d)&&s(u.current.result=d)}return null===(o=null===(n=u.current.options)||void 0===n?void 0:n.onCompleted)||void 0===o||o.call(n,e.data,f),null===(a=t.onCompleted)||void 0===a||a.call(t,e.data,f),e})).catch((function(e){var n,o,a,c;if(l===u.current.mutationId&&u.current.isMounted){var h={loading:!1,error:e,data:void 0,called:!0,client:i};r.equal(u.current.result,h)||s(u.current.result=h)}if((null===(n=u.current.options)||void 0===n?void 0:n.onError)||f.onError)return null===(a=null===(o=u.current.options)||void 0===o?void 0:o.onError)||void 0===a||a.call(o,e,f),null===(c=t.onError)||void 0===c||c.call(t,e,f),{data:void 0,errors:e};throw e}))}),[]),f=c.useCallback((function(){u.current.isMounted&&s({called:!1,loading:!1,client:i})}),[]);return c.useEffect((function(){return u.current.isMounted=!0,function(){u.current.isMounted=!1}}),[]),[l,e.__assign({reset:f},a)]},exports.useQuery=function(e,t){return void 0===t&&(t=Object.create(null)),Ar(Qr(t.client),e).useQuery(t)},exports.useReactiveVar=function(e){var t=e(),r=c.useState(t)[1];return c.useEffect((function(){var n=e();if(t===n)return e.onNextChange(r);r(n)}),[t]),t},exports.useSubscription=function(e,t){var n=c.useRef(!1),i=Qr(null==t?void 0:t.client);jr(e,exports.DocumentType.Subscription);var o=c.useState({loading:!(null==t?void 0:t.skip),error:void 0,data:void 0,variables:null==t?void 0:t.variables}),a=o[0],s=o[1];n.current||(n.current=!0,null==t||t.onSubscriptionData,null==t||t.onSubscriptionComplete);var u=c.useState((function(){return(null==t?void 0:t.skip)?null:i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})})),l=u[0],f=u[1],h=c.useRef(!1);c.useEffect((function(){return function(){h.current=!0}}),[]);var p=c.useRef({client:i,subscription:e,options:t});return c.useEffect((function(){var n,o,a,u,c=null==t?void 0:t.shouldResubscribe;"function"==typeof c&&(c=!!c(t)),(null==t?void 0:t.skip)?(!(null==t?void 0:t.skip)!=!(null===(n=p.current.options)||void 0===n?void 0:n.skip)||h.current)&&(s({loading:!1,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),f(null),h.current=!1):(!1===c||i===p.current.client&&e===p.current.subscription&&(null==t?void 0:t.fetchPolicy)===(null===(o=p.current.options)||void 0===o?void 0:o.fetchPolicy)&&!(null==t?void 0:t.skip)==!(null===(a=p.current.options)||void 0===a?void 0:a.skip)&&r.equal(null==t?void 0:t.variables,null===(u=p.current.options)||void 0===u?void 0:u.variables))&&!h.current||(s({loading:!0,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),f(i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})),h.current=!1),Object.assign(p.current,{client:i,subscription:e,options:t})}),[i,e,t,h.current]),c.useEffect((function(){if(l){var e=l.subscribe({next:function(e){var r,n,o={loading:!1,data:e.data,error:void 0,variables:null==t?void 0:t.variables};s(o),(null===(r=p.current.options)||void 0===r?void 0:r.onData)?p.current.options.onData({client:i,data:o}):(null===(n=p.current.options)||void 0===n?void 0:n.onSubscriptionData)&&p.current.options.onSubscriptionData({client:i,subscriptionData:o})},error:function(e){var r,n;s({loading:!1,data:void 0,error:e,variables:null==t?void 0:t.variables}),null===(n=null===(r=p.current.options)||void 0===r?void 0:r.onError)||void 0===n||n.call(r,e)},complete:function(){var e,t;(null===(e=p.current.options)||void 0===e?void 0:e.onComplete)?p.current.options.onComplete():(null===(t=p.current.options)||void 0===t?void 0:t.onSubscriptionComplete)&&p.current.options.onSubscriptionComplete()}});return function(){e.unsubscribe()}}}),[l]),a};