📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

apollo-contentful-rest-link

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-contentful-rest-link - npm Package Compare versions

Comparing version

to
0.2.0

constants.js

232

es/index.js

@@ -9,139 +9,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

import { ApolloLink, Observable } from '@apollo/client';
import { graphqlParser, contentfulResolver } from 'contentful-parsers';
import omit from 'lomit';
import { graphql } from 'graphql-anywhere/lib/async';
import { contentfulResolver, graphqlParser } from 'contentful-parsers';
var contentful = require('contentful');
var VariableKind = {
Argument: 'Argument',
ObjectField: 'ObjectField'
};
var DefinitionKind = {
OperationDefinition: 'OperationDefinition',
FramentDefinition: 'FragmentDefinition'
};
var SelectionKind = {
Field: 'Field',
FragmentSpread: 'FragmentSpread'
};
/**
* Contentful API - Search Parameters
* @ref https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
*/
import { buildDefinitionMap, getRootKey, parseQueryVariables } from './utils';
var contentfulReservedParameters = ['access_token', 'include', 'locale', 'content_type', 'select', 'query', 'links_to_entry', 'links_to_asset', 'order', 'limit', 'skip', 'mimetype_group', 'preview'];
var getSearchKey = function getSearchKey(variableKey) {
if (variableKey.endsWith('_in')) {
return "fields." + variableKey.replace('_in', '') + "[in]";
}
if (variableKey.endsWith('_not')) {
return "fields." + variableKey.replace('_not', '') + "[ne]";
}
if (variableKey.endsWith('_exists')) {
return "fields." + variableKey.replace('_exists', '') + "[exists]";
}
if (variableKey.endsWith('_not_in')) {
return "fields." + variableKey.replace('_not_in', '') + "[nin]";
} // if (variableKey.endsWith('_contains')) {
// return `fields.${variableKey.replace('_contains', '')}[?]`
// }
// if (variableKey.endsWith('_not_contains')) {
// return `fields.${variableKey.replace('_not_contains', '')}[?]`
// }
// @todo Add support for `x[all]` - Ryan
// @todo Add support for `x[match]` - Ryan
// @todo Add support for `x[gt]` - Ryan
// @todo Add support for `x[gte]` - Ryan
// @todo Add support for `x[lt]` - Ryan
// @todo Add support for `x[lte]` - Ryan
// @todo Add support for `x[near]` - Ryan
// @todo Add support for `x[within]` - Ryan
return "fields." + variableKey;
};
var buildVariableMap = function buildVariableMap(operation) {
var query = operation.query,
operationName = operation.operationName;
var variableMap = {};
query[operationName].definitions.filter(function (definition) {
return definition.kind === DefinitionKind.OperationDefinition;
}).forEach(function (definition) {
definition.selectionSet.selections.forEach(function (selection) {
selection.arguments.forEach(function (argument) {
var _argument$value, _argument$value2, _argument$value2$name, _argument$name;
if (argument == null ? void 0 : (_argument$value = argument.value) == null ? void 0 : _argument$value.fields) {
argument.value.fields.forEach(function (field) {
var _field$value, _field$value$name, _field$name;
if ((field == null ? void 0 : (_field$value = field.value) == null ? void 0 : (_field$value$name = _field$value.name) == null ? void 0 : _field$value$name.value) && (field == null ? void 0 : field.kind) && (field == null ? void 0 : (_field$name = field.name) == null ? void 0 : _field$name.value)) {
variableMap[field.value.name.value] = {
kind: field.kind,
field: field.name.value
};
}
});
} else if ((argument == null ? void 0 : (_argument$value2 = argument.value) == null ? void 0 : (_argument$value2$name = _argument$value2.name) == null ? void 0 : _argument$value2$name.value) && (argument == null ? void 0 : argument.kind) && (argument == null ? void 0 : (_argument$name = argument.name) == null ? void 0 : _argument$name.value)) {
variableMap[argument.value.name.value] = {
kind: argument.kind,
field: argument.name.value
};
}
});
});
});
return variableMap;
};
var extractSelections = function extractSelections(selectionSet, definitions) {
if (!selectionSet || !selectionSet.selections || !selectionSet.selections.length) return null;
var selections = {};
selectionSet.selections.forEach(function (selection) {
if (selection.kind === SelectionKind.Field) {
var _selection$name;
if (selection == null ? void 0 : (_selection$name = selection.name) == null ? void 0 : _selection$name.value) {
selections[selection.name.value] = extractSelections(selection.selectionSet, definitions);
}
} else if (selection.kind === SelectionKind.FragmentSpread) {
var fragmentDefinition = definitions.find(function (definition) {
var _definition$name, _selection$name2;
return definition.kind === DefinitionKind.FramentDefinition && (definition == null ? void 0 : (_definition$name = definition.name) == null ? void 0 : _definition$name.value) && (selection == null ? void 0 : (_selection$name2 = selection.name) == null ? void 0 : _selection$name2.value) && definition.name.value === selection.name.value;
});
if (fragmentDefinition) {
selections["..." + selection.name.value] = extractSelections(fragmentDefinition.selectionSet, definitions);
}
}
});
return selections;
};
var buildDefinitionMap = function buildDefinitionMap(operation) {
var _operationDefinition$, _ref;
var query = operation.query;
var operationDefinition = query.definitions.find(function (definition) {
return definition.kind === DefinitionKind.OperationDefinition;
});
if (!operationDefinition) {
return {};
}
if (!(operationDefinition == null ? void 0 : (_operationDefinition$ = operationDefinition.name) == null ? void 0 : _operationDefinition$.value)) {
return {};
}
return _ref = {}, _ref[operationDefinition.name.value] = extractSelections(operationDefinition.selectionSet, query.definitions), _ref;
};
var ContentfulRestLink = /*#__PURE__*/function (_ApolloLink) {

@@ -159,7 +30,8 @@ _inheritsLoose(ContentfulRestLink, _ApolloLink);

_this.clientOptions = clientOptions;
_this.queryDefaults = queryDefaults;
_this.client = contentful.createClient(_objectSpread({}, clientOptions));
_this.queryDefaults = queryDefaults; // Create Delivery Client
if (clientOptions.hasOwnProperty('previewAccessToken')) {
_this.previewClient = contentful.createClient(_objectSpread(_objectSpread({}, clientOptions), {}, {
_this.client = contentful.createClient(_objectSpread({}, omit(clientOptions, ['previewAccessToken']))); // Create Preview Client, if required options are passed
if (clientOptions.hasOwnProperty('previewAccessToken') && clientOptions.previewAccessToken) {
_this.previewClient = contentful.createClient(_objectSpread(_objectSpread({}, omit(clientOptions, ['previewAccessToken'])), {}, {
accessToken: clientOptions.previewAccessToken,

@@ -172,85 +44,43 @@ host: 'preview.contentful.com'

}
/**
*
*
* @param {object} operation
* @param {function} forward
* @return {Observable}
*/
var _proto = ContentfulRestLink.prototype;
_proto.request = function request(operation, forward) {
var _query$operationName$,
_query$operationName$2,
_query$operationName$3,
_query$operationName$4,
_this2 = this;
var _this2 = this;
var query = operation.query,
variables = operation.variables,
operationName = operation.operationName;
var obs = forward ? forward(operation) : Observable.of({
data: {}
}); // Find name to apply as root field of the GraphQL data
});
return obs.flatMap(function (_ref) {
var data = _ref.data,
errors = _ref.errors;
return new Observable(function (observer) {
// Find name to apply as root field of the GraphQL data
var rootField = getRootKey(operation); // Set queryArgs based on variables/queryMethod
var rootField = (_query$operationName$ = query[operationName].definitions.find(function (definition) {
return definition.operation === 'query';
})) == null ? void 0 : (_query$operationName$2 = _query$operationName$.selectionSet) == null ? void 0 : (_query$operationName$3 = _query$operationName$2.selections.find(function (selection) {
return selection.name.kind === 'Name';
})) == null ? void 0 : (_query$operationName$4 = _query$operationName$3.name) == null ? void 0 : _query$operationName$4.value; // Convert the query variables to a format the Contentful API understands
var queryVariables = parseQueryVariables(operation); // Define the query method to use based on variables
var parseQueryVariables = function parseQueryVariables(query, variables, variableMap) {
var _query$operationName$5;
var queryMethod = queryVariables.hasOwnProperty('id') ? 'getEntry' : 'getEntries'; // Define query arguments based on the set method
var operationVariables = (_query$operationName$5 = query[operationName].definitions.find(function (definition) {
return definition.operation === 'query';
})) == null ? void 0 : _query$operationName$5.variableDefinitions.map(function (variableDefinition) {
return variableDefinition.variable.name.value;
});
var operationQueries = Object.keys(variableMap).filter(function (variableKey) {
return variables.hasOwnProperty(variableKey);
}).map(function (variableKey) {
var _ref3;
switch (variableMap[variableKey].kind) {
case VariableKind.Argument:
// If the variable key is known search parameter for the Contentful API,
// just pass it through un-parsed
if (contentfulReservedParameters.includes(variableKey)) {
var _ref2;
return _ref2 = {}, _ref2[variableMap[variableKey].field] = variables[variableKey], _ref2;
}
break;
case VariableKind.ObjectField:
// Convert variable into query format supported in Contentful API
var queryKey = getSearchKey(variableMap[variableKey].field);
return _ref3 = {}, _ref3[queryKey] = variables[variableKey], _ref3;
default:
return null;
}
return null;
}).filter(function (variable) {
return !!variable;
}).reduce(function (acc, cur) {
return _objectSpread(_objectSpread({}, acc), cur);
}, {});
return _objectSpread(_objectSpread({}, operationQueries), omit(variables, operationVariables));
};
var variableMap = buildVariableMap(operation);
var definitionMap = buildDefinitionMap(operation);
return obs.flatMap(function (_ref4) {
var data = _ref4.data,
errors = _ref4.errors;
return new Observable(function (observer) {
var queryMethod = variables.hasOwnProperty('id') ? 'getEntry' : 'getEntries';
var queryArgs = variables.hasOwnProperty('id') ? [variables.id, _objectSpread(_objectSpread({}, _this2.queryDefaults), parseQueryVariables(query, omit(variables, ['id']), variableMap))] : [_objectSpread(_objectSpread(_objectSpread({}, parseQueryVariables(query, variables, variableMap)), _this2.queryDefaults), {}, {
var queryArgs = queryMethod === 'getEntry' ? [queryVariables.id, _objectSpread(_objectSpread({}, _this2.queryDefaults), omit(queryVariables, ['id', 'preview']))] : [_objectSpread(_objectSpread(_objectSpread({}, _this2.queryDefaults), omit(queryVariables, ['preview'])), {}, {
content_type: rootField.replace('Collection', '')
})]; // Choose client based on `preview` variable or `isPreview` context
})]; // Choose client based on `preview` variable
var usePreview = _this2.previewClient && Object.keys(variableMap).find(function (variable) {
return variableMap[variable].field === 'preview';
});
var usePreview = _this2.previewClient && queryVariables.hasOwnProperty('preview') && queryVariables.preview;
var client = usePreview ? _this2.previewClient : _this2.client; // Contentful query
client[queryMethod].apply(client, queryArgs).then(function (contentfulData) {
// Build definitionMap to supply expected shape of GraphQL query response
var definitionMap = buildDefinitionMap(operation); // Parse Contentful data to expected GraphQL shape
var parsedData = graphqlParser(rootField, contentfulData, definitionMap[operationName]); // Query contentfulData via GraphQL query

@@ -257,0 +87,0 @@

@@ -14,4 +14,2 @@ "use strict";

var _contentfulParsers = require("contentful-parsers");
var _lomit = _interopRequireDefault(require("lomit"));

@@ -21,2 +19,6 @@

var _contentfulParsers = require("contentful-parsers");
var _utils = require("./utils");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

@@ -28,133 +30,2 @@

var VariableKind = {
Argument: 'Argument',
ObjectField: 'ObjectField'
};
var DefinitionKind = {
OperationDefinition: 'OperationDefinition',
FramentDefinition: 'FragmentDefinition'
};
var SelectionKind = {
Field: 'Field',
FragmentSpread: 'FragmentSpread'
};
/**
* Contentful API - Search Parameters
* @ref https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
*/
var contentfulReservedParameters = ['access_token', 'include', 'locale', 'content_type', 'select', 'query', 'links_to_entry', 'links_to_asset', 'order', 'limit', 'skip', 'mimetype_group', 'preview'];
var getSearchKey = function getSearchKey(variableKey) {
if (variableKey.endsWith('_in')) {
return "fields." + variableKey.replace('_in', '') + "[in]";
}
if (variableKey.endsWith('_not')) {
return "fields." + variableKey.replace('_not', '') + "[ne]";
}
if (variableKey.endsWith('_exists')) {
return "fields." + variableKey.replace('_exists', '') + "[exists]";
}
if (variableKey.endsWith('_not_in')) {
return "fields." + variableKey.replace('_not_in', '') + "[nin]";
} // if (variableKey.endsWith('_contains')) {
// return `fields.${variableKey.replace('_contains', '')}[?]`
// }
// if (variableKey.endsWith('_not_contains')) {
// return `fields.${variableKey.replace('_not_contains', '')}[?]`
// }
// @todo Add support for `x[all]` - Ryan
// @todo Add support for `x[match]` - Ryan
// @todo Add support for `x[gt]` - Ryan
// @todo Add support for `x[gte]` - Ryan
// @todo Add support for `x[lt]` - Ryan
// @todo Add support for `x[lte]` - Ryan
// @todo Add support for `x[near]` - Ryan
// @todo Add support for `x[within]` - Ryan
return "fields." + variableKey;
};
var buildVariableMap = function buildVariableMap(operation) {
var query = operation.query,
operationName = operation.operationName;
var variableMap = {};
query[operationName].definitions.filter(function (definition) {
return definition.kind === DefinitionKind.OperationDefinition;
}).forEach(function (definition) {
definition.selectionSet.selections.forEach(function (selection) {
selection.arguments.forEach(function (argument) {
var _argument$value, _argument$value2, _argument$value2$name, _argument$name;
if (argument == null ? void 0 : (_argument$value = argument.value) == null ? void 0 : _argument$value.fields) {
argument.value.fields.forEach(function (field) {
var _field$value, _field$value$name, _field$name;
if ((field == null ? void 0 : (_field$value = field.value) == null ? void 0 : (_field$value$name = _field$value.name) == null ? void 0 : _field$value$name.value) && (field == null ? void 0 : field.kind) && (field == null ? void 0 : (_field$name = field.name) == null ? void 0 : _field$name.value)) {
variableMap[field.value.name.value] = {
kind: field.kind,
field: field.name.value
};
}
});
} else if ((argument == null ? void 0 : (_argument$value2 = argument.value) == null ? void 0 : (_argument$value2$name = _argument$value2.name) == null ? void 0 : _argument$value2$name.value) && (argument == null ? void 0 : argument.kind) && (argument == null ? void 0 : (_argument$name = argument.name) == null ? void 0 : _argument$name.value)) {
variableMap[argument.value.name.value] = {
kind: argument.kind,
field: argument.name.value
};
}
});
});
});
return variableMap;
};
var extractSelections = function extractSelections(selectionSet, definitions) {
if (!selectionSet || !selectionSet.selections || !selectionSet.selections.length) return null;
var selections = {};
selectionSet.selections.forEach(function (selection) {
if (selection.kind === SelectionKind.Field) {
var _selection$name;
if (selection == null ? void 0 : (_selection$name = selection.name) == null ? void 0 : _selection$name.value) {
selections[selection.name.value] = extractSelections(selection.selectionSet, definitions);
}
} else if (selection.kind === SelectionKind.FragmentSpread) {
var fragmentDefinition = definitions.find(function (definition) {
var _definition$name, _selection$name2;
return definition.kind === DefinitionKind.FramentDefinition && (definition == null ? void 0 : (_definition$name = definition.name) == null ? void 0 : _definition$name.value) && (selection == null ? void 0 : (_selection$name2 = selection.name) == null ? void 0 : _selection$name2.value) && definition.name.value === selection.name.value;
});
if (fragmentDefinition) {
selections["..." + selection.name.value] = extractSelections(fragmentDefinition.selectionSet, definitions);
}
}
});
return selections;
};
var buildDefinitionMap = function buildDefinitionMap(operation) {
var _operationDefinition$, _ref;
var query = operation.query;
var operationDefinition = query.definitions.find(function (definition) {
return definition.kind === DefinitionKind.OperationDefinition;
});
if (!operationDefinition) {
return {};
}
if (!(operationDefinition == null ? void 0 : (_operationDefinition$ = operationDefinition.name) == null ? void 0 : _operationDefinition$.value)) {
return {};
}
return _ref = {}, _ref[operationDefinition.name.value] = extractSelections(operationDefinition.selectionSet, query.definitions), _ref;
};
var ContentfulRestLink = /*#__PURE__*/function (_ApolloLink) {

@@ -172,7 +43,8 @@ (0, _inheritsLoose2["default"])(ContentfulRestLink, _ApolloLink);

_this.clientOptions = clientOptions;
_this.queryDefaults = queryDefaults;
_this.client = contentful.createClient(_objectSpread({}, clientOptions));
_this.queryDefaults = queryDefaults; // Create Delivery Client
if (clientOptions.hasOwnProperty('previewAccessToken')) {
_this.previewClient = contentful.createClient(_objectSpread(_objectSpread({}, clientOptions), {}, {
_this.client = contentful.createClient(_objectSpread({}, (0, _lomit["default"])(clientOptions, ['previewAccessToken']))); // Create Preview Client, if required options are passed
if (clientOptions.hasOwnProperty('previewAccessToken') && clientOptions.previewAccessToken) {
_this.previewClient = contentful.createClient(_objectSpread(_objectSpread({}, (0, _lomit["default"])(clientOptions, ['previewAccessToken'])), {}, {
accessToken: clientOptions.previewAccessToken,

@@ -185,85 +57,43 @@ host: 'preview.contentful.com'

}
/**
*
*
* @param {object} operation
* @param {function} forward
* @return {Observable}
*/
var _proto = ContentfulRestLink.prototype;
_proto.request = function request(operation, forward) {
var _query$operationName$,
_query$operationName$2,
_query$operationName$3,
_query$operationName$4,
_this2 = this;
var _this2 = this;
var query = operation.query,
variables = operation.variables,
operationName = operation.operationName;
var obs = forward ? forward(operation) : _client.Observable.of({
data: {}
}); // Find name to apply as root field of the GraphQL data
});
return obs.flatMap(function (_ref) {
var data = _ref.data,
errors = _ref.errors;
return new _client.Observable(function (observer) {
// Find name to apply as root field of the GraphQL data
var rootField = (0, _utils.getRootKey)(operation); // Set queryArgs based on variables/queryMethod
var rootField = (_query$operationName$ = query[operationName].definitions.find(function (definition) {
return definition.operation === 'query';
})) == null ? void 0 : (_query$operationName$2 = _query$operationName$.selectionSet) == null ? void 0 : (_query$operationName$3 = _query$operationName$2.selections.find(function (selection) {
return selection.name.kind === 'Name';
})) == null ? void 0 : (_query$operationName$4 = _query$operationName$3.name) == null ? void 0 : _query$operationName$4.value; // Convert the query variables to a format the Contentful API understands
var queryVariables = (0, _utils.parseQueryVariables)(operation); // Define the query method to use based on variables
var parseQueryVariables = function parseQueryVariables(query, variables, variableMap) {
var _query$operationName$5;
var queryMethod = queryVariables.hasOwnProperty('id') ? 'getEntry' : 'getEntries'; // Define query arguments based on the set method
var operationVariables = (_query$operationName$5 = query[operationName].definitions.find(function (definition) {
return definition.operation === 'query';
})) == null ? void 0 : _query$operationName$5.variableDefinitions.map(function (variableDefinition) {
return variableDefinition.variable.name.value;
});
var operationQueries = Object.keys(variableMap).filter(function (variableKey) {
return variables.hasOwnProperty(variableKey);
}).map(function (variableKey) {
var _ref3;
switch (variableMap[variableKey].kind) {
case VariableKind.Argument:
// If the variable key is known search parameter for the Contentful API,
// just pass it through un-parsed
if (contentfulReservedParameters.includes(variableKey)) {
var _ref2;
return _ref2 = {}, _ref2[variableMap[variableKey].field] = variables[variableKey], _ref2;
}
break;
case VariableKind.ObjectField:
// Convert variable into query format supported in Contentful API
var queryKey = getSearchKey(variableMap[variableKey].field);
return _ref3 = {}, _ref3[queryKey] = variables[variableKey], _ref3;
default:
return null;
}
return null;
}).filter(function (variable) {
return !!variable;
}).reduce(function (acc, cur) {
return _objectSpread(_objectSpread({}, acc), cur);
}, {});
return _objectSpread(_objectSpread({}, operationQueries), (0, _lomit["default"])(variables, operationVariables));
};
var variableMap = buildVariableMap(operation);
var definitionMap = buildDefinitionMap(operation);
return obs.flatMap(function (_ref4) {
var data = _ref4.data,
errors = _ref4.errors;
return new _client.Observable(function (observer) {
var queryMethod = variables.hasOwnProperty('id') ? 'getEntry' : 'getEntries';
var queryArgs = variables.hasOwnProperty('id') ? [variables.id, _objectSpread(_objectSpread({}, _this2.queryDefaults), parseQueryVariables(query, (0, _lomit["default"])(variables, ['id']), variableMap))] : [_objectSpread(_objectSpread(_objectSpread({}, parseQueryVariables(query, variables, variableMap)), _this2.queryDefaults), {}, {
var queryArgs = queryMethod === 'getEntry' ? [queryVariables.id, _objectSpread(_objectSpread({}, _this2.queryDefaults), (0, _lomit["default"])(queryVariables, ['id', 'preview']))] : [_objectSpread(_objectSpread(_objectSpread({}, _this2.queryDefaults), (0, _lomit["default"])(queryVariables, ['preview'])), {}, {
content_type: rootField.replace('Collection', '')
})]; // Choose client based on `preview` variable or `isPreview` context
})]; // Choose client based on `preview` variable
var usePreview = _this2.previewClient && Object.keys(variableMap).find(function (variable) {
return variableMap[variable].field === 'preview';
});
var usePreview = _this2.previewClient && queryVariables.hasOwnProperty('preview') && queryVariables.preview;
var client = usePreview ? _this2.previewClient : _this2.client; // Contentful query
client[queryMethod].apply(client, queryArgs).then(function (contentfulData) {
// Build definitionMap to supply expected shape of GraphQL query response
var definitionMap = (0, _utils.buildDefinitionMap)(operation); // Parse Contentful data to expected GraphQL shape
var parsedData = (0, _contentfulParsers.graphqlParser)(rootField, contentfulData, definitionMap[operationName]); // Query contentfulData via GraphQL query

@@ -270,0 +100,0 @@

{
"name": "apollo-contentful-rest-link",
"version": "0.1.8",
"version": "0.2.0",
"description": "Perform GraphQL queries against Contentful’s Rest API. No more, query size limits! No more, query complexities!!",
"scripts": {
"clean": "rimraf index.js es umd",
"clean": "rimraf constants.js index.js utils.js es umd",
"prebuild": "npm run clean",

@@ -22,3 +22,7 @@ "build": "node ./tools/build.js",

"graphql-anywhere",
"contentful"
"contentful",
"contentful-api",
"contentful-graphql-api",
"contentful-rest-api",
"contentful-js"
],

@@ -51,3 +55,5 @@ "author": "Ryan Hefner <hi@ryanhefner.com> (https://www.ryanhefner.com)",

"umd",
"index.js"
"constants.js",
"index.js",
"utils.js"
],

@@ -62,16 +68,16 @@ "directories": {

"dependencies": {
"@apollo/client": "^3.1.3",
"@apollo/client": "^3.1.4",
"@babel/runtime": "^7.11.2",
"contentful": "^7.14.6",
"contentful-parsers": "^1.2.0",
"contentful-parsers": "^1.2.3",
"graphql-anywhere": "^4.2.7",
"lomit": "^0.2.0"
"lomit": "^0.3.1"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/plugin-transform-runtime": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@rollup/plugin-babel": "^5.2.0",

@@ -81,18 +87,19 @@ "@rollup/plugin-commonjs": "^15.0.0",

"@rollup/plugin-node-resolve": "^9.0.0",
"apollo-client": "^2.6.10",
"babel-plugin-dev-expression": "^0.2.2",
"coveralls": "^3.1.0",
"dtslint": "^3.6.14",
"dtslint": "^4.0.0",
"graphql": "^15.3.0",
"greenkeeper-lockfile": "^1.15.1",
"gzip-size": "^5.1.1",
"jest": "^26.4.0",
"pretty-bytes": "^5.3.0",
"jest": "^26.4.2",
"pretty-bytes": "^5.4.1",
"react": "^16.13.1",
"regenerator-runtime": "^0.13.7",
"rimraf": "^3.0.2",
"rollup": "^2.26.4",
"rollup-plugin-terser": "^7.0.0",
"rollup": "^2.26.11",
"rollup-plugin-terser": "^7.0.2",
"subscriptions-transport-ws": "^0.9.18",
"typescript": "^3.9.7"
"typescript": "^4.0.2"
}
}
import { ApolloLink, Observable } from '@apollo/client'
import { graphqlParser, contentfulResolver } from 'contentful-parsers'
import omit from 'lomit'
import { graphql } from 'graphql-anywhere/lib/async'
import { contentfulResolver, graphqlParser } from 'contentful-parsers'
const contentful = require('contentful')
import { buildDefinitionMap, getRootKey, parseQueryVariables } from './utils'
const VariableKind = {
Argument: 'Argument',
ObjectField: 'ObjectField',
};
const DefinitionKind = {
OperationDefinition: 'OperationDefinition',
FramentDefinition: 'FragmentDefinition',
}
const SelectionKind = {
Field: 'Field',
FragmentSpread: 'FragmentSpread',
}
/**
* Contentful API - Search Parameters
* @ref https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
*/
const contentfulReservedParameters = [
'access_token',
'include',
'locale',
'content_type',
'select',
'query',
'links_to_entry',
'links_to_asset',
'order',
'limit',
'skip',
'mimetype_group',
'preview',
]
const getSearchKey = (variableKey) => {
if (variableKey.endsWith('_in')) {
return `fields.${variableKey.replace('_in', '')}[in]`
}
if (variableKey.endsWith('_not')) {
return `fields.${variableKey.replace('_not', '')}[ne]`
}
if (variableKey.endsWith('_exists')) {
return `fields.${variableKey.replace('_exists', '')}[exists]`
}
if (variableKey.endsWith('_not_in')) {
return `fields.${variableKey.replace('_not_in', '')}[nin]`
}
// if (variableKey.endsWith('_contains')) {
// return `fields.${variableKey.replace('_contains', '')}[?]`
// }
// if (variableKey.endsWith('_not_contains')) {
// return `fields.${variableKey.replace('_not_contains', '')}[?]`
// }
// @todo Add support for `x[all]` - Ryan
// @todo Add support for `x[match]` - Ryan
// @todo Add support for `x[gt]` - Ryan
// @todo Add support for `x[gte]` - Ryan
// @todo Add support for `x[lt]` - Ryan
// @todo Add support for `x[lte]` - Ryan
// @todo Add support for `x[near]` - Ryan
// @todo Add support for `x[within]` - Ryan
return `fields.${variableKey}`
}
const buildVariableMap = (operation) => {
const { query, operationName } = operation
const variableMap = {}
query[operationName].definitions
.filter(definition => definition.kind === DefinitionKind.OperationDefinition)
.forEach(definition => {
definition.selectionSet.selections.forEach(selection => {
selection.arguments.forEach(argument => {
if (argument?.value?.fields) {
argument.value.fields.forEach(field => {
if (field?.value?.name?.value && field?.kind && field?.name?.value) {
variableMap[field.value.name.value] = {
kind: field.kind,
field: field.name.value,
}
}
})
} else if (argument?.value?.name?.value && argument?.kind && argument?.name?.value) {
variableMap[argument.value.name.value] = {
kind: argument.kind,
field: argument.name.value,
}
}
})
})
})
return variableMap
}
const extractSelections = (selectionSet, definitions) => {
if (!selectionSet || !selectionSet.selections || !selectionSet.selections.length) return null
const selections = {}
selectionSet.selections.forEach(selection => {
if (selection.kind === SelectionKind.Field) {
if (selection?.name?.value) {
selections[selection.name.value] = extractSelections(selection.selectionSet, definitions)
}
} else if (selection.kind === SelectionKind.FragmentSpread) {
const fragmentDefinition = definitions.find(
definition =>
definition.kind === DefinitionKind.FramentDefinition &&
definition?.name?.value && selection?.name?.value &&
definition.name.value === selection.name.value
)
if (fragmentDefinition) {
selections[`...${selection.name.value}`] = extractSelections(fragmentDefinition.selectionSet, definitions)
}
}
})
return selections
}
const buildDefinitionMap = (operation) => {
const { query } = operation
const operationDefinition = query.definitions.find(
definition => definition.kind === DefinitionKind.OperationDefinition
)
if (!operationDefinition) {
return {}
}
if (!operationDefinition?.name?.value) {
return {}
}
return {
[operationDefinition.name.value]: extractSelections(operationDefinition.selectionSet, query.definitions)
}
}
export default class ContentfulRestLink extends ApolloLink {

@@ -165,9 +15,11 @@ constructor(clientOptions, queryDefaults = {}) {

// Create Delivery Client
this.client = contentful.createClient({
...clientOptions,
...omit(clientOptions, ['previewAccessToken']),
})
if (clientOptions.hasOwnProperty('previewAccessToken')) {
// Create Preview Client, if required options are passed
if (clientOptions.hasOwnProperty('previewAccessToken') && clientOptions.previewAccessToken) {
this.previewClient = contentful.createClient({
...clientOptions,
...omit(clientOptions, ['previewAccessToken']),
accessToken: clientOptions.previewAccessToken,

@@ -179,4 +31,11 @@ host: 'preview.contentful.com',

/**
*
*
* @param {object} operation
* @param {function} forward
* @return {Observable}
*/
request(operation, forward) {
const { query, variables, operationName } = operation
const { query, operationName } = operation

@@ -187,66 +46,27 @@ const obs = forward

// Find name to apply as root field of the GraphQL data
const rootField = query[operationName].definitions
.find(definition => definition.operation === 'query')
?.selectionSet?.selections
.find(selection => selection.name.kind === 'Name')
?.name?.value;
return obs.flatMap(({ data, errors }) => new Observable(observer => {
// Find name to apply as root field of the GraphQL data
const rootField = getRootKey(operation)
// Convert the query variables to a format the Contentful API understands
const parseQueryVariables = (query, variables, variableMap) => {
const operationVariables = query[operationName].definitions
.find(definition => definition.operation === 'query')
?.variableDefinitions.map(variableDefinition => variableDefinition.variable.name.value)
// Set queryArgs based on variables/queryMethod
const queryVariables = parseQueryVariables(operation)
const operationQueries = Object.keys(variableMap)
.filter(variableKey => variables.hasOwnProperty(variableKey))
.map(variableKey => {
switch (variableMap[variableKey].kind) {
case VariableKind.Argument:
// If the variable key is known search parameter for the Contentful API,
// just pass it through un-parsed
if (contentfulReservedParameters.includes(variableKey)) {
return { [variableMap[variableKey].field]: variables[variableKey] }
}
break
case VariableKind.ObjectField:
// Convert variable into query format supported in Contentful API
const queryKey = getSearchKey(variableMap[variableKey].field)
return { [queryKey]: variables[variableKey] }
default:
return null
}
return null
})
.filter(variable => !!variable)
.reduce((acc, cur) => {
return {...acc, ...cur }
}, {});
return { ...operationQueries, ...omit(variables, operationVariables) }
}
const variableMap = buildVariableMap(operation)
const definitionMap = buildDefinitionMap(operation)
return obs.flatMap(({ data, errors }) => new Observable(observer => {
const queryMethod = variables.hasOwnProperty('id')
// Define the query method to use based on variables
const queryMethod = queryVariables.hasOwnProperty('id')
? 'getEntry'
: 'getEntries'
const queryArgs = variables.hasOwnProperty('id')
? [variables.id, { ...this.queryDefaults, ...parseQueryVariables(query, omit(variables, ['id']), variableMap) }]
// Define query arguments based on the set method
const queryArgs = queryMethod === 'getEntry'
? [queryVariables.id, { ...this.queryDefaults, ...omit(queryVariables, ['id', 'preview']) }]
: [{
...parseQueryVariables(query, variables, variableMap),
...this.queryDefaults,
...omit(queryVariables, ['preview']),
content_type: rootField.replace('Collection', '')
}]
// Choose client based on `preview` variable or `isPreview` context
// Choose client based on `preview` variable
const usePreview = this.previewClient
&& Object.keys(variableMap).find(
variable => variableMap[variable].field === 'preview'
)
&& queryVariables.hasOwnProperty('preview')
&& queryVariables.preview
const client = usePreview ? this.previewClient : this.client

@@ -257,2 +77,6 @@

.then(contentfulData => {
// Build definitionMap to supply expected shape of GraphQL query response
const definitionMap = buildDefinitionMap(operation)
// Parse Contentful data to expected GraphQL shape
const parsedData = graphqlParser(

@@ -259,0 +83,0 @@ rootField,

@@ -1,2 +0,2 @@

/*! apollo-contentful-rest-link v0.1.8 | (c) 2020 Ryan Hefner | MIT License | https://github.com/ryanhefner/apollo-contentful-rest-link !*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/inheritsLoose")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/inheritsLoose"],n):(e="undefined"!=typeof globalThis?globalThis:e||self)["apollo-contentful-rest-link"]=n(e._defineProperty$1,e._inheritsLoose)}(this,(function(e,n){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),i=t(n),o=function(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])})(e,n)};function u(e,n){function t(){this.constructor=e}o(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var a=function(){return(a=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function c(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,i,o=t.call(e),u=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(t=o.return)&&t.call(o)}finally{if(i)throw i.error}}return u}function s(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],u=0,a=o.length;u<a;u++,i++)r[i]=o[u];return r}function f(e){return this instanceof f?(this.v=e,this):new f(e)}var p=Object.freeze({__proto__:null,__extends:u,get __assign(){return a},__rest:function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t},__decorate:function(e,n,t,r){var i,o=arguments.length,u=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,n,t,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(u=(o<3?i(u):o>3?i(n,t,u):i(n,t))||u);return o>3&&u&&Object.defineProperty(n,t,u),u},__param:function(e,n){return function(t,r){n(t,r,e)}},__metadata:function(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)},__awaiter:function(e,n,t,r){return new(t||(t=Promise))((function(i,o){function u(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,a)}c((r=r.apply(e,n||[])).next())}))},__generator:function(e,n){var t,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=n.call(e,u)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},__createBinding:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]},__exportStar:function(e,n){for(var t in e)"default"===t||n.hasOwnProperty(t)||(n[t]=e[t])},__values:c,__read:l,__spread:function(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(l(arguments[n]));return e},__spreadArrays:s,__await:f,__asyncGenerator:function(e,n,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=t.apply(e,n||[]),o=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(e){i[e]&&(r[e]=function(n){return new Promise((function(t,r){o.push([e,n,t,r])>1||a(e,n)}))})}function a(e,n){try{(t=i[e](n)).value instanceof f?Promise.resolve(t.value.v).then(c,l):s(o[0][2],t)}catch(e){s(o[0][3],e)}var t}function c(e){a("next",e)}function l(e){a("throw",e)}function s(e,n){e(n),o.shift(),o.length&&a(o[0][0],o[0][1])}},__asyncDelegator:function(e){var n,t;return n={},r("next"),r("throw",(function(e){throw e})),r("return"),n[Symbol.iterator]=function(){return this},n;function r(r,i){n[r]=e[r]?function(n){return(t=!t)?{value:f(e[r](n)),done:"return"===r}:i?i(n):n}:i}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,t=e[Symbol.asyncIterator];return t?t.call(e):(e=c(e),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise((function(r,i){(function(e,n,t,r){Promise.resolve(r).then((function(n){e({value:n,done:t})}),n)})(r,i,(n=e[t](n)).done,n.value)}))}}},__makeTemplateObject:function(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e},__importStar:function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(e,n){if(!n.has(e))throw new TypeError("attempted to get private field on non-instance");return n.get(e)},__classPrivateFieldSet:function(e,n,t){if(!n.has(e))throw new TypeError("attempted to set private field on non-instance");return n.set(e,t),t}}),v=Object.setPrototypeOf,d=void 0===v?function(e,n){return e.__proto__=n,e}:v,y=function(e){function n(t){void 0===t&&(t="Invariant Violation");var r=e.call(this,"number"==typeof t?"Invariant Violation: "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return r.framesToPop=1,r.name="Invariant Violation",d(r,n.prototype),r}return u(n,e),n}(Error);function m(e,n){if(!e)throw new y(n)}function h(e){return function(){return console[e].apply(console,arguments)}}!function(e){e.warn=h("warn"),e.error=h("error")}(m||(m={}));var b={env:{}};if("object"==typeof process)b=process;else try{Function("stub","process = stub")(b)}catch(e){}var g="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e){return _(e,[])}function _(e,n){switch(O(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,n){if(-1!==n.indexOf(e))return"[Circular]";var t=[].concat(n,[e]),r=function(e){var n=e[String(g)];if("function"==typeof n)return n;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:_(i,t)}else if(Array.isArray(e))return function(e,n){if(0===e.length)return"[]";if(n.length>2)return"[Array]";for(var t=Math.min(10,e.length),r=e.length-t,i=[],o=0;o<t;++o)i.push(_(e[o],n));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,t);return function(e,n){var t=Object.keys(e);if(0===t.length)return"{}";if(n.length>2)return"["+function(e){var n=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===n&&"function"==typeof e.constructor){var t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return n}(e)+"]";return"{ "+t.map((function(t){return t+": "+_(e[t],n)})).join(", ")+" }"}(e,t)}(e,n);default:return String(e)}}function j(e){var n=e.prototype.toJSON;"function"==typeof n||function(e,n){if(!Boolean(e))throw new Error(null!=n?n:"Unexpected invariant triggered.")}(0),e.prototype.inspect=n,g&&(e.prototype[g]=n)}function E(e){return null!=e&&"string"==typeof e.kind}j(function(){function e(e,n,t){this.start=e.start,this.end=n.end,this.startToken=e,this.endToken=n,this.source=t}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}()),j(function(){function e(e,n,t,r,i,o,u){this.kind=e,this.start=n,this.end=t,this.line=r,this.column=i,this.value=u,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}());var k={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},D=Object.freeze({});function S(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k,r=void 0,i=Array.isArray(e),o=[e],u=-1,a=[],c=void 0,l=void 0,s=void 0,f=[],p=[],v=e;do{var d=++u===o.length,y=d&&0!==a.length;if(d){if(l=0===p.length?void 0:f[f.length-1],c=s,s=p.pop(),y){if(i)c=c.slice();else{for(var m={},h=0,b=Object.keys(c);h<b.length;h++){var g=b[h];m[g]=c[g]}c=m}for(var O=0,_=0;_<a.length;_++){var j=a[_][0],S=a[_][1];i&&(j-=O),i&&null===S?(c.splice(j,1),O++):c[j]=S}}u=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(l=s?i?u:o[u]:void 0,null==(c=s?s[l]:v))continue;s&&f.push(l)}var x,F=void 0;if(!Array.isArray(c)){if(!E(c))throw new Error("Invalid AST Node: ".concat(w(c),"."));var V=N(n,c.kind,d);if(V){if((F=V.call(n,c,l,s,f,p))===D)break;if(!1===F){if(!d){f.pop();continue}}else if(void 0!==F&&(a.push([l,F]),!d)){if(!E(F)){f.pop();continue}c=F}}}if(void 0===F&&y&&a.push([l,c]),d)f.pop();else r={inArray:i,index:u,keys:o,edits:a,prev:r},o=(i=Array.isArray(c))?c:null!==(x=t[c.kind])&&void 0!==x?x:[],u=-1,a=[],s&&p.push(s),s=c}while(void 0!==r);return 0!==a.length&&(v=a[a.length-1][1]),v}function N(e,n,t){var r=e[n];if(r){if(!t&&"function"==typeof r)return r;var i=t?r.leave:r.enter;if("function"==typeof i)return i}else{var o=t?e.leave:e.enter;if(o){if("function"==typeof o)return o;var u=o[n];if("function"==typeof u)return u}}}function x(e,n,t){return e(t={path:n,exports:{},require:function(e,n){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==n&&t.path)}},t.exports),t.exports}var F=x((function(e,n){function t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function r(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,n,t){return n&&r(e.prototype,n),t&&r(e,t),e}Object.defineProperty(n,"__esModule",{value:!0}),n.Observable=void 0;var o=function(){return"function"==typeof Symbol},u=function(e){return o()&&Boolean(Symbol[e])},a=function(e){return u(e)?Symbol[e]:"@@"+e};o()&&!u("observable")&&(Symbol.observable=Symbol("observable"));var c=a("iterator"),l=a("observable"),s=a("species");function f(e,n){var t=e[n];if(null!=t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}}function p(e){var n=e.constructor;return void 0!==n&&null===(n=n[s])&&(n=void 0),void 0!==n?n:_}function v(e){return e instanceof _}function d(e){d.log?d.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){d(e)}}))}function m(e){var n=e._cleanup;if(void 0!==n&&(e._cleanup=void 0,n))try{if("function"==typeof n)n();else{var t=f(n,"unsubscribe");t&&t.call(n)}}catch(e){d(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,n,t){e._state="running";var r=e._observer;try{var i=f(r,n);switch(n){case"next":i&&i.call(r,t);break;case"error":if(h(e),!i)throw t;i.call(r,t);break;case"complete":h(e),i&&i.call(r)}}catch(e){d(e)}"closed"===e._state?m(e):"running"===e._state&&(e._state="ready")}function g(e,n,t){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:n,value:t}],void y((function(){return function(e){var n=e._queue;if(n){e._queue=void 0,e._state="ready";for(var t=0;t<n.length&&(b(e,n[t].type,n[t].value),"closed"!==e._state);++t);}}(e)}))):void b(e,n,t);e._queue.push({type:n,value:t})}}var O=function(){function e(n,r){t(this,e),this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";var i=new w(this);try{this._cleanup=r.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return i(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(h(this),m(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),w=function(){function e(n){t(this,e),this._subscription=n}return i(e,[{key:"next",value:function(e){g(this._subscription,"next",e)}},{key:"error",value:function(e){g(this._subscription,"error",e)}},{key:"complete",value:function(){g(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),_=function(){function e(n){if(t(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof n)throw new TypeError("Observable initializer must be a function");this._subscriber=n}return i(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new O(e,this._subscriber)}},{key:"forEach",value:function(e){var n=this;return new Promise((function(t,r){if("function"==typeof e)var i=n.subscribe({next:function(n){try{e(n,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),t()}}))}},{key:"map",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(t){return n.subscribe({next:function(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error:function(e){t.error(e)},complete:function(){t.complete()}})}))}},{key:"filter",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(t){return n.subscribe({next:function(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error:function(e){t.error(e)},complete:function(){t.complete()}})}))}},{key:"reduce",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var t=p(this),r=arguments.length>1,i=!1,o=arguments[1],u=o;return new t((function(t){return n.subscribe({next:function(n){var o=!i;if(i=!0,!o||r)try{u=e(u,n)}catch(e){return t.error(e)}else u=n},error:function(e){t.error(e)},complete:function(){if(!i&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(u),t.complete()}})}))}},{key:"concat",value:function(){for(var e=this,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var i=p(this);return new i((function(n){var r,o=0;return function e(u){r=u.subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){o===t.length?(r=void 0,n.complete()):e(i.from(t[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var t=p(this);return new t((function(r){var i=[],o=n.subscribe({next:function(n){if(e)try{n=e(n)}catch(e){return r.error(e)}var o=t.from(n).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),u()}});i.push(o)},error:function(e){r.error(e)},complete:function(){u()}});function u(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(n){var t="function"==typeof this?this:e;if(null==n)throw new TypeError(n+" is not an object");var r=f(n,l);if(r){var i=r.call(n);if(Object(i)!==i)throw new TypeError(i+" is not an object");return v(i)&&i.constructor===t?i:new t((function(e){return i.subscribe(e)}))}if(u("iterator")&&(r=f(n,c)))return new t((function(e){y((function(){if(!e.closed){var t=!0,i=!1,o=void 0;try{for(var u,a=r.call(n)[Symbol.iterator]();!(t=(u=a.next()).done);t=!0){var c=u.value;if(e.next(c),e.closed)return}}catch(e){i=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(n))return new t((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}));throw new TypeError(n+" is not observable")}},{key:"of",value:function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}))}},{key:s,get:function(){return this}}]),e}();n.Observable=_,o()&&Object.defineProperty(_,Symbol("extensions"),{value:{symbol:l,hostReportError:d},configurable:!0})})).Observable;!function(e){var n,t=e.Symbol;"function"==typeof t?t.observable?n=t.observable:(n=t("observable"),t.observable=n):n="@@observable"}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")());function V(e,n,t){var r=[];e.forEach((function(e){return e[n]&&r.push(e)})),r.forEach((function(e){return e[n](t)}))}function P(e){return e&&"function"==typeof e.then}F.prototype["@@observable"]=function(){return this};var A=function(e){function n(n){var t=e.call(this,(function(e){return t.addObserver(e),function(){return t.removeObserver(e)}}))||this;return t.observers=new Set,t.promise=new Promise((function(e,n){t.resolve=e,t.reject=n})),t.handlers={next:function(e){null!==t.sub&&(t.latest=["next",e],V(t.observers,"next",e))},error:function(e){null!==t.sub&&(t.sub&&t.sub.unsubscribe(),t.sub=null,t.latest=["error",e],t.reject(e),V(t.observers,"error",e))},complete:function(){if(null!==t.sub){var e=t.sources.shift();e?P(e)?e.then((function(e){return t.sub=e.subscribe(t.handlers)})):t.sub=e.subscribe(t.handlers):(t.sub=null,t.latest&&"next"===t.latest[0]?t.resolve(t.latest[1]):t.resolve(),V(t.observers,"complete"))}}},t.cancel=function(e){t.reject(e),t.sources=[],t.handlers.complete()},t.promise.catch((function(e){})),P(n)?n.then((function(e){return t.start(e)}),t.handlers.error):t.start(n),t}return u(n,e),n.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},n.prototype.addObserver=function(e){if(!this.observers.has(e)){if(this.latest){var n=this.latest[0],t=e[n];t&&t.call(e,this.latest[1]),null===this.sub&&"next"===n&&e.complete&&e.complete()}this.observers.add(e)}},n.prototype.removeObserver=function(e,n){if(this.observers.delete(e)&&this.observers.size<1){if(n)return;this.sub&&(this.sub.unsubscribe(),this.reject(new Error("Observable cancelled prematurely"))),this.sub=null}},n.prototype.cleanup=function(e){var n=this,t=!1,r=function(){t||(t=!0,n.observers.delete(i),e())},i={next:r,error:r,complete:r};this.addObserver(i)},n}(F);function q(e,n){return n?n(e):F.of()}function T(e){return"function"==typeof e?new C(e):e}function I(e){return e.request.length<=1}"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(A,Symbol.species,{value:F});var M=function(e){function n(n,t){var r=e.call(this,n)||this;return r.link=t,r}return u(n,e),n}(Error),C=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return F.of()}))},e.from=function(n){return 0===n.length?e.empty():n.map(T).reduce((function(e,n){return e.concat(n)}))},e.split=function(n,t,r){var i=T(t),o=T(r||new e(q));return I(i)&&I(o)?new e((function(e){return n(e)?i.request(e)||F.of():o.request(e)||F.of()})):new e((function(e,t){return n(e)?i.request(e,t)||F.of():o.request(e,t)||F.of()}))},e.execute=function(e,n){return e.request(function(e,n){var t=a({},e);return Object.defineProperty(n,"setContext",{enumerable:!1,value:function(e){t=a(a({},t),"function"==typeof e?e(t):e)}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:function(){return a({},t)}}),n}(n.context,function(e){var n={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return n.operationName||(n.operationName="string"!=typeof n.query?n.query.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||void 0:""),n}(function(e){for(var n=["query","operationName","variables","extensions","context"],t=0,r=Object.keys(e);t<r.length;t++){var i=r[t];if(n.indexOf(i)<0)throw"production"===process.env.NODE_ENV?new y(25):new y("illegal argument: "+i)}return e}(n))))||F.of()},e.concat=function(n,t){var r=T(n);if(I(r))return"production"===process.env.NODE_ENV||m.warn(new M("You are calling concat on a terminating link, which will have no effect",r)),r;var i=T(t);return I(i)?new e((function(e){return r.request(e,(function(e){return i.request(e)||F.of()}))||F.of()})):new e((function(e,n){return r.request(e,(function(e){return i.request(e,n)||F.of()}))||F.of()}))},e.prototype.split=function(n,t,r){return this.concat(e.split(n,t,r||new e(q)))},e.prototype.concat=function(n){return e.concat(this,n)},e.prototype.request=function(e,n){throw"production"===process.env.NODE_ENV?new y(22):new y("request is not implemented")},e.prototype.onError=function(e){throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}();function J(e,n,t){function r(e){return!("object"!=typeof e||!e.hasOwnProperty("sys")||1!==Object.keys(e).length)}function i(e,o,u,a){if(void 0===u&&(u={}),void 0===a&&(a=0),!e||"object"!=typeof e)return u;if(a>=n.include)return u;var c=Object.assign({},u);return Object.keys(e).forEach((function(n){c[n]=e[n].fields&&t.parseRefs?i(e[n].fields,e[n].sys,c[n],a+1):function e(n,o){return void 0===o&&(o=0),r(n)?null:Array.isArray(n)&&t.parseArrays?n.filter((function(e){return!r(e)})).map((function(n){return n&&"object"==typeof n&&n.fields?i(n.fields,n.sys,{},o+1):e(n,o+1)})):n}(e[n],a+1)})),o&&o.contentType&&o.contentType.sys&&o.contentType.sys.id&&(c.id=o.id,c.__typename=o.contentType.sys.id),o&&o.updatedAt&&(c.updatedAt=o.updatedAt),o&&o.createdAt&&(c.createdAt=o.createdAt),c}void 0===n&&(n={include:10}),void 0===t&&(t={parseArrays:!0,parseRefs:!0});var o=Object.assign({},e);return i(o.fields,o.sys)}function L(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function R(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?L(Object(t),!0).forEach((function(n){r.default(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):L(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var z=function(e,n){return n.hasOwnProperty(e)?n[e]:null};function B(e,n,t,r){var i,o;function u(e,n){return e?(e.hasOwnProperty("__typename")&&e.__typename&&(e.__typename=e.__typename.substring(0,1).toUpperCase()+e.__typename.substring(1)),n&&n.sys?e.sys=R(R({},n.sys),{},{__typename:"Sys"}):n.id&&(e.sys={id:n.id,__typename:"Sys"}),e.id&&delete e.id,e.createdAt&&delete e.createdAt,e.updatedAt&&delete e.updatedAt,e):e}function a(e,n,t){if(void 0===t&&(t=0),t>=r.include)return e;var i=Object.assign({},e.hasOwnProperty("sys")&&e.hasOwnProperty("fields")?J(e,r,{parseArrays:!1,parseRefs:!1}):e);return Object.keys(i).forEach((function(r){var o=i[r];if(Array.isArray(o)){var l=!1;if(o.forEach((function(e){(e.hasOwnProperty("sys")&&e.hasOwnProperty("fields")||e.hasOwnProperty("__typename"))&&(l=!0)})),l){var s,f,p=r+"Collection";i[p]=c(o,n&&n[p],t+1),(null==(s=i[p])||null==(f=s.items)?void 0:f.length)||delete i[p],delete i[r]}else i[r]=o.map((function(n,t){return u(n,e[r][t])}))}else"object"==typeof o&&(o.hasOwnProperty("__typename")||o.hasOwnProperty("sys")&&o.hasOwnProperty("fields"))?i[r]=a(o,n&&n[r],t+1):i[r]=o})),function e(n,t){if(!n||!t)return n;var r=Object.assign({},n);return Object.keys(t).forEach((function(n){n.startsWith("...")?e(r,t[n]):r.hasOwnProperty(n)?"object"==typeof t[n]&&(r[n]=e(r[n],t[n])):n.endsWith("Collection")?r[n]=c([],t[n]):r[n]=null==t?void 0:t[n]})),r}(u(i,e),n)}function c(e,n,t){return void 0===e&&(e=[]),void 0===n&&(n=null),void 0===t&&(t=0),{__typename:"Array",items:e.map((function(e){return a(e,n&&n.items,t)})).filter((function(e){return!!e}))}}return void 0===r&&(r={include:10}),n.items?((o={})[e]=c(n.items,t&&t[e]),o):((i={})[e]=a(n,t&&t[e]),i)}function K(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Q(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function W(e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),e=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?K(Object(t),!0).forEach((function(n){Q(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):K(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},e),n.forEach((function(n){var t=n.indexOf(".");if(-1!==t){var r=n.slice(0,t),i=n.slice(t+1);r&&e[r]&&(e[r]=W(e[r],[i]))}else e.hasOwnProperty(n)&&delete e[n]})),e}var G=Object.prototype,U=G.toString,Y=G.hasOwnProperty,$=new Map;function H(e,n){var t=$.get(e);if(t){if(t.has(n))return!0}else $.set(e,t=new Set);return t.add(n),!1}function X(e,n,t,r){if(function(e){return"IntValue"===e.kind}(t)||function(e){return"FloatValue"===e.kind}(t))e[n.value]=Number(t.value);else if(function(e){return"BooleanValue"===e.kind}(t)||function(e){return"StringValue"===e.kind}(t))e[n.value]=t.value;else if(function(e){return"ObjectValue"===e.kind}(t)){var i={};t.fields.map((function(e){return X(i,e.name,e.value,r)})),e[n.value]=i}else if(function(e){return"Variable"===e.kind}(t)){var o=(r||{})[t.name.value];e[n.value]=o}else if(function(e){return"ListValue"===e.kind}(t))e[n.value]=t.values.map((function(e){var t={};return X(t,n,e,r),t[n.value]}));else if(function(e){return"EnumValue"===e.kind}(t))e[n.value]=t.value;else{if(!function(e){return"NullValue"===e.kind}(t))throw"production"===process.env.NODE_ENV?new y(17):new y('The inline argument "'+n.value+'" of kind "'+t.kind+'"is not supported. Use variables instead of inline arguments to overcome this limitation.');e[n.value]=null}}var Z=["connection","include","skip","client","rest","export"];function ee(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var r=t.connection.filter?t.connection.filter:[];r.sort();var i=n,o={};return r.forEach((function(e){o[e]=i[e]})),t.connection.key+"("+JSON.stringify(o)+")"}return t.connection.key}var u=e;if(n){var a=function(e,n){n||(n={}),"function"==typeof n&&(n={cmp:n});var t,r="boolean"==typeof n.cycles&&n.cycles,i=n.cmp&&(t=n.cmp,function(e){return function(n,r){var i={key:n,value:e[n]},o={key:r,value:e[r]};return t(i,o)}}),o=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0!==n){if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);var t,u;if(Array.isArray(n)){for(u="[",t=0;t<n.length;t++)t&&(u+=","),u+=e(n[t])||"null";return u+"]"}if(null===n)return"null";if(-1!==o.indexOf(n)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=o.push(n)-1,c=Object.keys(n).sort(i&&i(n));for(u="",t=0;t<c.length;t++){var l=c[t],s=e(n[l]);s&&(u&&(u+=","),u+=JSON.stringify(l)+":"+s)}return o.splice(a,1),"{"+u+"}"}}(e)}(n);u+="("+a+")"}return t&&Object.keys(t).forEach((function(e){-1===Z.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?u+="@"+e+"("+JSON.stringify(t[e])+")":u+="@"+e)})),u}function ne(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach((function(e){var r=e.name,i=e.value;return X(t,r,i,n)})),t}return null}function te(e){return"Field"===e.kind}function re(e){return"InlineFragment"===e.kind}function ie(e){throw"production"===process.env.NODE_ENV?new y(18):new y("Variable nodes are not supported by valueFromNode")}function oe(e){var n=[];return S(e,{Directive:function(e){n.push(e.name.value)}}),n}function ue(e,n){return oe(n).some((function(n){return e.indexOf(n)>-1}))}function ae(e){var n=e.name.value;return"skip"===n||"include"===n}function ce(e){return e?e.filter(ae).map((function(e){var n=e.arguments,t=e.name.value;"production"===process.env.NODE_ENV?m(n&&1===n.length,14):m(n&&1===n.length,"Incorrect number of arguments for the @"+t+" directive.");var r=n[0];"production"===process.env.NODE_ENV?m(r.name&&"if"===r.name.value,15):m(r.name&&"if"===r.name.value,"Invalid argument for the @"+t+" directive.");var i=r.value;return"production"===process.env.NODE_ENV?m(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16):m(i&&("Variable"===i.kind||"BooleanValue"===i.kind),"Argument for the @"+t+" directive must be a variable or a boolean value."),{directive:e,ifArgument:r}})):[]}function le(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach((function(n){null!=n&&Object.keys(n).forEach((function(t){e[t]=n[t]}))})),e}function se(e){"production"===process.env.NODE_ENV?m(e&&"Document"===e.kind,2):m(e&&"Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql');var n=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw"production"===process.env.NODE_ENV?new y(3):new y('Schema type definitions not allowed in queries. Found: "'+e.kind+'"');return e}));return"production"===process.env.NODE_ENV?m(n.length<=1,4):m(n.length<=1,"Ambiguous GraphQL document: contains "+n.length+" operations"),e}function fe(e){return se(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function pe(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function ve(e){"production"===process.env.NODE_ENV?m("Document"===e.kind,7):m("Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'),"production"===process.env.NODE_ENV?m(e.definitions.length<=1,8):m(e.definitions.length<=1,"Fragment must have exactly one definition.");var n=e.definitions[0];return"production"===process.env.NODE_ENV?m("FragmentDefinition"===n.kind,9):m("FragmentDefinition"===n.kind,"Must be a fragment definition."),n}function de(e){var n;se(e);for(var t=0,r=e.definitions;t<r.length;t++){var i=r[t];if("OperationDefinition"===i.kind){var o=i.operation;if("query"===o||"mutation"===o||"subscription"===o)return i}"FragmentDefinition"!==i.kind||n||(n=i)}if(n)return n;throw"production"===process.env.NODE_ENV?new y(10):new y("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.")}function ye(e){void 0===e&&(e=[]);var n={};return e.forEach((function(e){n[e.name.value]=e})),n}function me(e,n,t){var r=0;return e.forEach((function(t,i){n.call(this,t,i,e)&&(e[r++]=t)}),t),e.length=r,e}var he={kind:"Field",name:{kind:"Name",value:"__typename"}};function be(e){return function e(n,t){return n.selectionSet.selections.every((function(n){return"FragmentSpread"===n.kind&&e(t[n.name.value],t)}))}(fe(e)||ve(e),ye(pe(e)))?null:e}function ge(e){return function(n){return e.some((function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)}))}}function Oe(e,n){var t=Object.create(null),r=[],i=Object.create(null),o=[],u=be(S(n,{Variable:{enter:function(e,n,r){"VariableDefinition"!==r.kind&&(t[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some((function(e){return e.remove}))&&n.directives&&n.directives.some(ge(e))))return n.arguments&&n.arguments.forEach((function(e){"Variable"===e.value.kind&&r.push({name:e.value.name.value})})),n.selectionSet&&function e(n){var t=[];return n.selections.forEach((function(n){(te(n)||re(n))&&n.selectionSet?e(n.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===n.kind&&t.push(n)})),t}(n.selectionSet).forEach((function(e){o.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){i[e.name.value]=!0}},Directive:{enter:function(n){if(ge(e)(n))return null}}}));return u&&me(r,(function(e){return!t[e.name]})).length&&(u=Ee(r,u)),u&&me(o,(function(e){return!i[e.name]})).length&&(u=ke(o,u)),u}var we={test:function(e){var n="connection"===e.name.value;return n&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||"production"===process.env.NODE_ENV||m.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),n}};function _e(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some((function(n){return je(e,n,t)}))}function je(e,n,t){return void 0===t&&(t=!0),!te(n)||!!n.directives&&(n.directives.some(ge(e))||t&&_e(e,n.selectionSet,t))}function Ee(e,n){var t=function(e){return function(n){return e.some((function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))}))}}(e);return be(S(n,{OperationDefinition:{enter:function(n){return a(a({},n),{variableDefinitions:n.variableDefinitions.filter((function(n){return!e.some((function(e){return e.name===n.variable.name.value}))}))})}},Field:{enter:function(n){if(e.some((function(e){return e.remove}))){var r=0;if(n.arguments.forEach((function(e){t(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(t(e))return null}}}))}function ke(e,n){function t(n){if(e.some((function(e){return e.name===n.name.value})))return null}return be(S(n,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}var De="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),Se=Object.prototype.toString;function Ne(){return"undefined"!=typeof process&&process.env.NODE_ENV?process.env.NODE_ENV:"development"}function xe(e){return Ne()===e}function Fe(){return!0===xe("production")}function Ve(){return!0===xe("development")}function Pe(){return!0===xe("test")}var Ae=Object.prototype.hasOwnProperty;function qe(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=Me(n,r);for(var i=1;i<t;++i)n=Ie(n,e[i],r)}return n}function Te(e){return null!==e&&"object"==typeof e}function Ie(e,n,t){return Te(n)&&Te(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=Me(e,t)),Object.keys(n).forEach((function(r){var i=n[r];if(Ae.call(e,r)){var o=e[r];i!==o&&(e[r]=Ie(Me(o,t),i,t))}else e[r]=i})),e):n}function Me(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):a({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var Ce=Object.create({});var Je=Object.freeze({__proto__:null,addTypenameToDocument:function(e){return S(se(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var r=e.selections;if(r)if(!r.some((function(e){return te(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=t;if(!(te(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return a(a({},e),{selections:s(r,[he])})}}}}})},argumentsObjectFromField:ne,assign:le,buildQueryFromSelectionSet:function(e){return"query"===de(e).operation?e:S(e,{OperationDefinition:{enter:function(e){return a(a({},e),{operation:"query"})}}})},canUseWeakMap:De,checkDocument:se,cloneDeep:function(e){return function e(n,t){switch(Se.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach((function(n,i){r[i]=e(n,t)})),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach((function(r){i[r]=e(n[r],t)})),i;default:return n}}(e,new Map)},createFragmentMap:ye,getDefaultValues:function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter((function(e){return e.defaultValue})).map((function(e){var n=e.variable,t=e.defaultValue,r={};return X(r,n.name,t),r}));return le.apply(void 0,s([{}],n))}return{}},getDirectiveInfoFromField:function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach((function(e){t[e.name.value]=ne(e,n)})),t}return null},getDirectiveNames:oe,getDirectivesFromDocument:function(e,n){var t;return se(n),be(S(n,{SelectionSet:{enter:function(n,r,i,o){var u=o.join("-");if(!t||u===t||!u.startsWith(t)){if(n.selections){var c=n.selections.filter((function(n){return je(e,n)}));return _e(e,n,!1)&&(t=u),a(a({},n),{selections:c})}return null}}}}))},getEnv:Ne,getFragmentDefinition:ve,getFragmentDefinitions:pe,getFragmentQueryDocument:function(e,n){var t=n,r=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw"production"===process.env.NODE_ENV?new y(11):new y("Found a "+e.operation+" operation"+(e.name?" named '"+e.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===e.kind&&r.push(e)})),void 0===t&&("production"===process.env.NODE_ENV?m(1===r.length,12):m(1===r.length,"Found "+r.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),t=r[0].name.value),a(a({},e),{definitions:s([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],e.definitions)})},getInclusionDirectives:ce,getMainDefinition:de,getMutationDefinition:function(e){se(e);var n=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))[0];return"production"===process.env.NODE_ENV?m(n,1):m(n,"Must contain a mutation definition."),n},getOperationDefinition:fe,getOperationDefinitionOrDie:function(e){var n=fe(e);return"production"===process.env.NODE_ENV?m(n,5):m(n,"GraphQL document is missing an operation"),n},getOperationName:function(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null},getQueryDefinition:function(e){var n=fe(e);return"production"===process.env.NODE_ENV?m(n&&"query"===n.operation,6):m(n&&"query"===n.operation,"Must contain a query definition."),n},getStoreKeyName:ee,graphQLResultHasError:function(e){return e.errors&&e.errors.length},hasClientExports:function(e){return e&&ue(["client"],e)&&ue(["export"],e)},hasDirectives:ue,isDevelopment:Ve,isEnv:xe,isField:te,isIdValue:function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},isInlineFragment:re,isJsonValue:function(e){return null!=e&&"object"==typeof e&&"json"===e.type},isNumberValue:function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},isProduction:Fe,isScalarValue:function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},isTest:Pe,maybeDeepFreeze:function(e){return!Ve()&&!Pe()||"function"==typeof Symbol&&"string"==typeof Symbol("")?e:function e(n){return Object.freeze(n),Object.getOwnPropertyNames(n).forEach((function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])})),n}(e)},mergeDeep:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return qe(e)},mergeDeepArray:qe,removeArgumentsFromDocument:Ee,removeClientSetsFromDocument:function(e){se(e);var n=Oe([{test:function(e){return"client"===e.name.value},remove:!0}],e);return n&&(n=S(n,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return te(e)&&"__typename"===e.name.value})))return null}}})),n},removeConnectionDirectiveFromDocument:function(e){return Oe([we],se(e))},removeDirectivesFromDocument:Oe,removeFragmentSpreadFromDocument:ke,resultKeyNameFromField:function(e){return e.alias?e.alias.value:e.name.value},shouldInclude:function(e,n){return void 0===n&&(n={}),ce(e.directives).every((function(e){var t=e.directive,r=e.ifArgument,i=!1;return"Variable"===r.value.kind?(i=n[r.value.name.value],"production"===process.env.NODE_ENV?m(void 0!==i,13):m(void 0!==i,"Invalid variable referenced in @"+t.name.value+" directive.")):i=r.value.value,"skip"===t.name.value?!i:i}))},storeKeyNameFromField:function(e,n){var t=null;e.directives&&(t={},e.directives.forEach((function(e){t[e.name.value]={},e.arguments&&e.arguments.forEach((function(r){var i=r.name,o=r.value;return X(t[e.name.value],i,o,n)}))})));var r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach((function(e){var t=e.name,i=e.value;return X(r,t,i,n)}))),ee(e.name.value,r,t)},stripSymbols:function(e){return JSON.parse(JSON.stringify(e))},toIdValue:function(e,n){return void 0===n&&(n=!1),a({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)},tryFunctionOrLogError:function(e){try{return e()}catch(e){console.error&&console.error(e)}},valueFromNode:function e(n,t){switch(void 0===t&&(t=ie),n.kind){case"Variable":return t(n);case"NullValue":return null;case"IntValue":return parseInt(n.value,10);case"FloatValue":return parseFloat(n.value);case"ListValue":return n.values.map((function(n){return e(n,t)}));case"ObjectValue":for(var r={},i=0,o=n.fields;i<o.length;i++){var u=o[i];r[u.name.value]=e(u.value,t)}return r;default:return n.value}},valueToObjectRepresentation:X,variablesInOperation:function(e){var n=new Set;if(e.variableDefinitions)for(var t=0,r=e.variableDefinitions;t<r.length;t++){var i=r[t];n.add(i.variable.name.value)}return n},warnOnceInDevelopment:function(e,n){void 0===n&&(n="warn"),Fe()||Ce[e]||(Pe()||(Ce[e]=!0),"error"===n?console.error(e):console.warn(e))},isEqual:function(e,n){try{return function e(n,t){if(n===t)return!0;var r=U.call(n),i=U.call(t);if(r!==i)return!1;switch(r){case"[object Array]":if(n.length!==t.length)return!1;case"[object Object]":if(H(n,t))return!0;var o=Object.keys(n),u=Object.keys(t),a=o.length;if(a!==u.length)return!1;for(var c=0;c<a;++c)if(!Y.call(t,o[c]))return!1;for(c=0;c<a;++c){var l=o[c];if(!e(n[l],t[l]))return!1}return!0;case"[object Error]":return n.name===t.name&&n.message===t.message;case"[object Number]":if(n!=n)return t!=t;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object RegExp]":case"[object String]":return n==""+t;case"[object Map]":case"[object Set]":if(n.size!==t.size)return!1;if(H(n,t))return!0;for(var s=n.entries(),f="[object Map]"===r;;){var p=s.next();if(p.done)break;var v=p.value,d=v[0],y=v[1];if(!t.has(d))return!1;if(f&&!e(y,t.get(d)))return!1}return!0}return!1}(e,n)}finally{$.clear()}}}),Le=x((function(e,n){function t(e,n,r){var o=r.fragmentMap,u=r.contextValue,a=r.variableValues,c={};return e.selections.forEach((function(e){if(!a||Je.shouldInclude(e,a))if(Je.isField(e)){var l=function(e,n,r){var i=r.variableValues,o=r.contextValue,u=r.resolver,a=e.name.value,c=Je.argumentsObjectFromField(e,i),l={isLeaf:!e.selectionSet,resultKey:Je.resultKeyNameFromField(e),directives:Je.getDirectiveInfoFromField(e,i),field:e},s=u(a,n,c,o,l);if(!e.selectionSet)return s;if(null==s)return s;if(Array.isArray(s))return function e(n,r,i){return r.map((function(r){return null===r?null:Array.isArray(r)?e(n,r,i):t(n.selectionSet,r,i)}))}(e,s,r);return t(e.selectionSet,s,r)}(e,n,r),s=Je.resultKeyNameFromField(e);void 0!==l&&(void 0===c[s]?c[s]=l:i(c[s],l))}else{var f=void 0;if(Je.isInlineFragment(e))f=e;else if(!(f=o[e.name.value]))throw new Error("No fragment named "+e.name.value);var p=f.typeCondition.name.value;if(r.fragmentMatcher(n,p,u)){var v=t(f.selectionSet,n,r);i(c,v)}}})),r.resultMapper?r.resultMapper(c,n):c}Object.defineProperty(n,"__esModule",{value:!0}),n.graphql=function(e,n,r,i,o,u){void 0===o&&(o={}),void 0===u&&(u={});var a=Je.getMainDefinition(n),c=Je.getFragmentDefinitions(n),l={fragmentMap:Je.createFragmentMap(c),contextValue:i,variableValues:o,resultMapper:u.resultMapper,resolver:e,fragmentMatcher:u.fragmentMatcher||function(){return!0}};return t(a.selectionSet,r,l)};var r=Object.prototype.hasOwnProperty;function i(e,n){null!==n&&"object"==typeof n&&Object.keys(n).forEach((function(t){var o=n[t];r.call(e,t)?i(e[t],o):e[t]=o}))}n.merge=i})),Re=x((function(e,n){function t(e,n,i){return p.__awaiter(this,void 0,void 0,(function(){var o,u,a,c,l,s=this;return p.__generator(this,(function(f){switch(f.label){case 0:return o=i.fragmentMap,u=i.contextValue,a=i.variableValues,c={},l=function(e){return p.__awaiter(s,void 0,void 0,(function(){var l,s,f,v,d;return p.__generator(this,(function(p){switch(p.label){case 0:return Je.shouldInclude(e,a)?Je.isField(e)?[4,r(e,n,i)]:[3,2]:[2];case 1:return l=p.sent(),s=Je.resultKeyNameFromField(e),void 0!==l&&(void 0===c[s]?c[s]=l:Le.merge(c[s],l)),[2];case 2:if(Je.isInlineFragment(e))f=e;else if(!(f=o[e.name.value]))throw new Error("No fragment named "+e.name.value);return v=f.typeCondition.name.value,i.fragmentMatcher(n,v,u)?[4,t(f.selectionSet,n,i)]:[3,4];case 3:d=p.sent(),Le.merge(c,d),p.label=4;case 4:return[2]}}))}))},[4,Promise.all(e.selections.map(l))];case 1:return f.sent(),i.resultMapper?[2,i.resultMapper(c,n)]:[2,c]}}))}))}function r(e,n,r){return p.__awaiter(this,void 0,void 0,(function(){var o,u,a,c,l,s,f;return p.__generator(this,(function(p){switch(p.label){case 0:return o=r.variableValues,u=r.contextValue,a=r.resolver,c=e.name.value,l=Je.argumentsObjectFromField(e,o),s={isLeaf:!e.selectionSet,resultKey:Je.resultKeyNameFromField(e),directives:Je.getDirectiveInfoFromField(e,o),field:e},[4,a(c,n,l,u,s)];case 1:return f=p.sent(),e.selectionSet?null==f?[2,f]:Array.isArray(f)?[2,i(e,f,r)]:[2,t(e.selectionSet,f,r)]:[2,f]}}))}))}function i(e,n,r){return Promise.all(n.map((function(n){return null===n?null:Array.isArray(n)?i(e,n,r):t(e.selectionSet,n,r)})))}Object.defineProperty(n,"__esModule",{value:!0}),n.graphql=function(e,n,r,i,o,u){void 0===u&&(u={});var a=Je.getMainDefinition(n),c=Je.getFragmentDefinitions(n),l={fragmentMap:Je.createFragmentMap(c),contextValue:i,variableValues:o,resultMapper:u.resultMapper,resolver:e,fragmentMatcher:u.fragmentMatcher||function(){return!0}};return t(a.selectionSet,r,l)}}));function ze(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Be(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ze(Object(t),!0).forEach((function(n){r.default(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ze(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ke=require("contentful"),Qe="Argument",We="ObjectField",Ge="OperationDefinition",Ue="FragmentDefinition",Ye="Field",$e="FragmentSpread",He=["access_token","include","locale","content_type","select","query","links_to_entry","links_to_asset","order","limit","skip","mimetype_group","preview"],Xe=function(e){var n,t,r=e.query,i=r.definitions.find((function(e){return e.kind===Ge}));return i&&(null==i||null==(n=i.name)?void 0:n.value)?((t={})[i.name.value]=function e(n,t){if(!n||!n.selections||!n.selections.length)return null;var r={};return n.selections.forEach((function(n){var i;if(n.kind===Ye)(null==n||null==(i=n.name)?void 0:i.value)&&(r[n.name.value]=e(n.selectionSet,t));else if(n.kind===$e){var o=t.find((function(e){var t,r;return e.kind===Ue&&(null==e||null==(t=e.name)?void 0:t.value)&&(null==n||null==(r=n.name)?void 0:r.value)&&e.name.value===n.name.value}));o&&(r["..."+n.name.value]=e(o.selectionSet,t))}})),r}(i.selectionSet,r.definitions),t):{}};return function(e){function n(n,t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).clientOptions=n,r.queryDefaults=t,r.client=Ke.createClient(Be({},n)),n.hasOwnProperty("previewAccessToken")&&(r.previewClient=Ke.createClient(Be(Be({},n),{},{accessToken:n.previewAccessToken,host:"preview.contentful.com"}))),r}return i.default(n,e),n.prototype.request=function(e,n){var t,r,i,o,u=this,a=e.query,c=e.variables,l=e.operationName,s=n?n(e):F.of({data:{}}),f=null==(t=a[l].definitions.find((function(e){return"query"===e.operation})))||null==(r=t.selectionSet)||null==(i=r.selections.find((function(e){return"Name"===e.name.kind})))||null==(o=i.name)?void 0:o.value,p=function(e,n,t){var r,i=null==(r=e[l].definitions.find((function(e){return"query"===e.operation})))?void 0:r.variableDefinitions.map((function(e){return e.variable.name.value})),o=Object.keys(t).filter((function(e){return n.hasOwnProperty(e)})).map((function(e){var r;switch(t[e].kind){case Qe:var i;if(He.includes(e))return(i={})[t[e].field]=n[e],i;break;case We:return(r={})[function(e){return e.endsWith("_in")?"fields."+e.replace("_in","")+"[in]":e.endsWith("_not")?"fields."+e.replace("_not","")+"[ne]":e.endsWith("_exists")?"fields."+e.replace("_exists","")+"[exists]":e.endsWith("_not_in")?"fields."+e.replace("_not_in","")+"[nin]":"fields."+e}(t[e].field)]=n[e],r;default:return null}return null})).filter((function(e){return!!e})).reduce((function(e,n){return Be(Be({},e),n)}),{});return Be(Be({},o),W(n,i))},v=function(e){var n=e.query,t=e.operationName,r={};return n[t].definitions.filter((function(e){return e.kind===Ge})).forEach((function(e){e.selectionSet.selections.forEach((function(e){e.arguments.forEach((function(e){var n,t,i,o;(null==e||null==(n=e.value)?void 0:n.fields)?e.value.fields.forEach((function(e){var n,t,i;(null==e||null==(n=e.value)||null==(t=n.name)?void 0:t.value)&&(null==e?void 0:e.kind)&&(null==e||null==(i=e.name)?void 0:i.value)&&(r[e.value.name.value]={kind:e.kind,field:e.name.value})})):(null==e||null==(t=e.value)||null==(i=t.name)?void 0:i.value)&&(null==e?void 0:e.kind)&&(null==e||null==(o=e.name)?void 0:o.value)&&(r[e.value.name.value]={kind:e.kind,field:e.name.value})}))}))})),r}(e),d=Xe(e);return s.flatMap((function(e){e.data;var n=e.errors;return new F((function(e){var t=c.hasOwnProperty("id")?"getEntry":"getEntries",r=c.hasOwnProperty("id")?[c.id,Be(Be({},u.queryDefaults),p(a,W(c,["id"]),v))]:[Be(Be(Be({},p(a,c,v)),u.queryDefaults),{},{content_type:f.replace("Collection","")})],i=u.previewClient&&Object.keys(v).find((function(e){return"preview"===v[e].field}))?u.previewClient:u.client;i[t].apply(i,r).then((function(t){var r=B(f,t,d[l]);Re.graphql(z,a,r).then((function(t){e.next({data:t,errors:n}),e.complete()})).catch((function(e){return console.error(e)}))})).catch((function(n){e.error(n)}))}))}))},n}(C)}));
/*! apollo-contentful-rest-link v0.2.0 | (c) 2020 Ryan Hefner | MIT License | https://github.com/ryanhefner/apollo-contentful-rest-link !*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/inheritsLoose")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/inheritsLoose"],n):(e="undefined"!=typeof globalThis?globalThis:e||self)["apollo-contentful-rest-link"]=n(e._defineProperty$1,e._inheritsLoose)}(this,(function(e,n){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),i=t(n),o=function(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])})(e,n)};function u(e,n){function t(){this.constructor=e}o(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var a=function(){return(a=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function c(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,i,o=t.call(e),u=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(t=o.return)&&t.call(o)}finally{if(i)throw i.error}}return u}function s(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],u=0,a=o.length;u<a;u++,i++)r[i]=o[u];return r}function f(e){return this instanceof f?(this.v=e,this):new f(e)}var p=Object.freeze({__proto__:null,__extends:u,get __assign(){return a},__rest:function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t},__decorate:function(e,n,t,r){var i,o=arguments.length,u=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,n,t,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(u=(o<3?i(u):o>3?i(n,t,u):i(n,t))||u);return o>3&&u&&Object.defineProperty(n,t,u),u},__param:function(e,n){return function(t,r){n(t,r,e)}},__metadata:function(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)},__awaiter:function(e,n,t,r){return new(t||(t=Promise))((function(i,o){function u(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,a)}c((r=r.apply(e,n||[])).next())}))},__generator:function(e,n){var t,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=n.call(e,u)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},__createBinding:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]},__exportStar:function(e,n){for(var t in e)"default"===t||n.hasOwnProperty(t)||(n[t]=e[t])},__values:c,__read:l,__spread:function(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(l(arguments[n]));return e},__spreadArrays:s,__await:f,__asyncGenerator:function(e,n,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=t.apply(e,n||[]),o=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(e){i[e]&&(r[e]=function(n){return new Promise((function(t,r){o.push([e,n,t,r])>1||a(e,n)}))})}function a(e,n){try{(t=i[e](n)).value instanceof f?Promise.resolve(t.value.v).then(c,l):s(o[0][2],t)}catch(e){s(o[0][3],e)}var t}function c(e){a("next",e)}function l(e){a("throw",e)}function s(e,n){e(n),o.shift(),o.length&&a(o[0][0],o[0][1])}},__asyncDelegator:function(e){var n,t;return n={},r("next"),r("throw",(function(e){throw e})),r("return"),n[Symbol.iterator]=function(){return this},n;function r(r,i){n[r]=e[r]?function(n){return(t=!t)?{value:f(e[r](n)),done:"return"===r}:i?i(n):n}:i}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,t=e[Symbol.asyncIterator];return t?t.call(e):(e=c(e),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise((function(r,i){(function(e,n,t,r){Promise.resolve(r).then((function(n){e({value:n,done:t})}),n)})(r,i,(n=e[t](n)).done,n.value)}))}}},__makeTemplateObject:function(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e},__importStar:function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(e,n){if(!n.has(e))throw new TypeError("attempted to get private field on non-instance");return n.get(e)},__classPrivateFieldSet:function(e,n,t){if(!n.has(e))throw new TypeError("attempted to set private field on non-instance");return n.set(e,t),t}}),v="Invariant Violation",d=Object.setPrototypeOf,y=void 0===d?function(e,n){return e.__proto__=n,e}:d,m=function(e){function n(t){void 0===t&&(t=v);var r=e.call(this,"number"==typeof t?v+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return r.framesToPop=1,r.name=v,y(r,n.prototype),r}return u(n,e),n}(Error);function h(e,n){if(!e)throw new m(n)}function b(e){return function(){return console[e].apply(console,arguments)}}!function(e){e.warn=b("warn"),e.error=b("error")}(h||(h={}));var g={env:{}};if("object"==typeof process)g=process;else try{Function("stub","process = stub")(g)}catch(e){}var O="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e){return j(e,[])}function j(e,n){switch(w(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,n){if(-1!==n.indexOf(e))return"[Circular]";var t=[].concat(n,[e]),r=function(e){var n=e[String(O)];if("function"==typeof n)return n;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:j(i,t)}else if(Array.isArray(e))return function(e,n){if(0===e.length)return"[]";if(n.length>2)return"[Array]";for(var t=Math.min(10,e.length),r=e.length-t,i=[],o=0;o<t;++o)i.push(j(e[o],n));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,t);return function(e,n){var t=Object.keys(e);if(0===t.length)return"{}";if(n.length>2)return"["+function(e){var n=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===n&&"function"==typeof e.constructor){var t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return n}(e)+"]";return"{ "+t.map((function(t){return t+": "+j(e[t],n)})).join(", ")+" }"}(e,t)}(e,n);default:return String(e)}}function k(e){var n=e.prototype.toJSON;"function"==typeof n||function(e,n){if(!Boolean(e))throw new Error(null!=n?n:"Unexpected invariant triggered.")}(0),e.prototype.inspect=n,O&&(e.prototype[O]=n)}function E(e){return null!=e&&"string"==typeof e.kind}k(function(){function e(e,n,t){this.start=e.start,this.end=n.end,this.startToken=e,this.endToken=n,this.source=t}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}()),k(function(){function e(e,n,t,r,i,o,u){this.kind=e,this.start=n,this.end=t,this.line=r,this.column=i,this.value=u,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}());var D={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},S=Object.freeze({});function N(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D,r=void 0,i=Array.isArray(e),o=[e],u=-1,a=[],c=void 0,l=void 0,s=void 0,f=[],p=[],v=e;do{var d=++u===o.length,y=d&&0!==a.length;if(d){if(l=0===p.length?void 0:f[f.length-1],c=s,s=p.pop(),y){if(i)c=c.slice();else{for(var m={},h=0,b=Object.keys(c);h<b.length;h++){var g=b[h];m[g]=c[g]}c=m}for(var O=0,w=0;w<a.length;w++){var j=a[w][0],k=a[w][1];i&&(j-=O),i&&null===k?(c.splice(j,1),O++):c[j]=k}}u=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(l=s?i?u:o[u]:void 0,null==(c=s?s[l]:v))continue;s&&f.push(l)}var N,P=void 0;if(!Array.isArray(c)){if(!E(c))throw new Error("Invalid AST Node: ".concat(_(c),"."));var F=x(n,c.kind,d);if(F){if((P=F.call(n,c,l,s,f,p))===S)break;if(!1===P){if(!d){f.pop();continue}}else if(void 0!==P&&(a.push([l,P]),!d)){if(!E(P)){f.pop();continue}c=P}}}if(void 0===P&&y&&a.push([l,c]),d)f.pop();else r={inArray:i,index:u,keys:o,edits:a,prev:r},o=(i=Array.isArray(c))?c:null!==(N=t[c.kind])&&void 0!==N?N:[],u=-1,a=[],s&&p.push(s),s=c}while(void 0!==r);return 0!==a.length&&(v=a[a.length-1][1]),v}function x(e,n,t){var r=e[n];if(r){if(!t&&"function"==typeof r)return r;var i=t?r.leave:r.enter;if("function"==typeof i)return i}else{var o=t?e.leave:e.enter;if(o){if("function"==typeof o)return o;var u=o[n];if("function"==typeof u)return u}}}function P(e,n,t){return e(t={path:n,exports:{},require:function(e,n){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==n&&t.path)}},t.exports),t.exports}var F=P((function(e,n){function t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function r(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,n,t){return n&&r(e.prototype,n),t&&r(e,t),e}Object.defineProperty(n,"__esModule",{value:!0}),n.Observable=void 0;var o=function(){return"function"==typeof Symbol},u=function(e){return o()&&Boolean(Symbol[e])},a=function(e){return u(e)?Symbol[e]:"@@"+e};o()&&!u("observable")&&(Symbol.observable=Symbol("observable"));var c=a("iterator"),l=a("observable"),s=a("species");function f(e,n){var t=e[n];if(null!=t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}}function p(e){var n=e.constructor;return void 0!==n&&null===(n=n[s])&&(n=void 0),void 0!==n?n:_}function v(e){return e instanceof _}function d(e){d.log?d.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){d(e)}}))}function m(e){var n=e._cleanup;if(void 0!==n&&(e._cleanup=void 0,n))try{if("function"==typeof n)n();else{var t=f(n,"unsubscribe");t&&t.call(n)}}catch(e){d(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,n,t){e._state="running";var r=e._observer;try{var i=f(r,n);switch(n){case"next":i&&i.call(r,t);break;case"error":if(h(e),!i)throw t;i.call(r,t);break;case"complete":h(e),i&&i.call(r)}}catch(e){d(e)}"closed"===e._state?m(e):"running"===e._state&&(e._state="ready")}function g(e,n,t){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:n,value:t}],void y((function(){return function(e){var n=e._queue;if(n){e._queue=void 0,e._state="ready";for(var t=0;t<n.length&&(b(e,n[t].type,n[t].value),"closed"!==e._state);++t);}}(e)}))):void b(e,n,t);e._queue.push({type:n,value:t})}}var O=function(){function e(n,r){t(this,e),this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";var i=new w(this);try{this._cleanup=r.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return i(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(h(this),m(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),w=function(){function e(n){t(this,e),this._subscription=n}return i(e,[{key:"next",value:function(e){g(this._subscription,"next",e)}},{key:"error",value:function(e){g(this._subscription,"error",e)}},{key:"complete",value:function(){g(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),_=function(){function e(n){if(t(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof n)throw new TypeError("Observable initializer must be a function");this._subscriber=n}return i(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new O(e,this._subscriber)}},{key:"forEach",value:function(e){var n=this;return new Promise((function(t,r){if("function"==typeof e)var i=n.subscribe({next:function(n){try{e(n,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),t()}}))}},{key:"map",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(t){return n.subscribe({next:function(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error:function(e){t.error(e)},complete:function(){t.complete()}})}))}},{key:"filter",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(p(this))((function(t){return n.subscribe({next:function(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error:function(e){t.error(e)},complete:function(){t.complete()}})}))}},{key:"reduce",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var t=p(this),r=arguments.length>1,i=!1,o=arguments[1],u=o;return new t((function(t){return n.subscribe({next:function(n){var o=!i;if(i=!0,!o||r)try{u=e(u,n)}catch(e){return t.error(e)}else u=n},error:function(e){t.error(e)},complete:function(){if(!i&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(u),t.complete()}})}))}},{key:"concat",value:function(){for(var e=this,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var i=p(this);return new i((function(n){var r,o=0;return function e(u){r=u.subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){o===t.length?(r=void 0,n.complete()):e(i.from(t[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var n=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var t=p(this);return new t((function(r){var i=[],o=n.subscribe({next:function(n){if(e)try{n=e(n)}catch(e){return r.error(e)}var o=t.from(n).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),u()}});i.push(o)},error:function(e){r.error(e)},complete:function(){u()}});function u(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(n){var t="function"==typeof this?this:e;if(null==n)throw new TypeError(n+" is not an object");var r=f(n,l);if(r){var i=r.call(n);if(Object(i)!==i)throw new TypeError(i+" is not an object");return v(i)&&i.constructor===t?i:new t((function(e){return i.subscribe(e)}))}if(u("iterator")&&(r=f(n,c)))return new t((function(e){y((function(){if(!e.closed){var t=!0,i=!1,o=void 0;try{for(var u,a=r.call(n)[Symbol.iterator]();!(t=(u=a.next()).done);t=!0){var c=u.value;if(e.next(c),e.closed)return}}catch(e){i=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(n))return new t((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}));throw new TypeError(n+" is not observable")}},{key:"of",value:function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}))}},{key:s,get:function(){return this}}]),e}();n.Observable=_,o()&&Object.defineProperty(_,Symbol("extensions"),{value:{symbol:l,hostReportError:d},configurable:!0})})).Observable;!function(e){var n,t=e.Symbol;"function"==typeof t?t.observable?n=t.observable:(n=t("observable"),t.observable=n):n="@@observable"}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")());function V(e,n,t){var r=[];e.forEach((function(e){return e[n]&&r.push(e)})),r.forEach((function(e){return e[n](t)}))}function A(e){return e&&"function"==typeof e.then}F.prototype["@@observable"]=function(){return this};var T=function(e){function n(n){var t=e.call(this,(function(e){return t.addObserver(e),function(){return t.removeObserver(e)}}))||this;return t.observers=new Set,t.promise=new Promise((function(e,n){t.resolve=e,t.reject=n})),t.handlers={next:function(e){null!==t.sub&&(t.latest=["next",e],V(t.observers,"next",e))},error:function(e){null!==t.sub&&(t.sub&&t.sub.unsubscribe(),t.sub=null,t.latest=["error",e],t.reject(e),V(t.observers,"error",e))},complete:function(){if(null!==t.sub){var e=t.sources.shift();e?A(e)?e.then((function(e){return t.sub=e.subscribe(t.handlers)})):t.sub=e.subscribe(t.handlers):(t.sub=null,t.latest&&"next"===t.latest[0]?t.resolve(t.latest[1]):t.resolve(),V(t.observers,"complete"))}}},t.cancel=function(e){t.reject(e),t.sources=[],t.handlers.complete()},t.promise.catch((function(e){})),A(n)?n.then((function(e){return t.start(e)}),t.handlers.error):t.start(n),t}return u(n,e),n.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},n.prototype.addObserver=function(e){if(!this.observers.has(e)){if(this.latest){var n=this.latest[0],t=e[n];t&&t.call(e,this.latest[1]),null===this.sub&&"next"===n&&e.complete&&e.complete()}this.observers.add(e)}},n.prototype.removeObserver=function(e,n){if(this.observers.delete(e)&&this.observers.size<1){if(n)return;this.sub&&(this.sub.unsubscribe(),this.reject(new Error("Observable cancelled prematurely"))),this.sub=null}},n.prototype.cleanup=function(e){var n=this,t=!1,r=function(){t||(t=!0,n.observers.delete(i),e())},i={next:r,error:r,complete:r};this.addObserver(i)},n}(F);function q(e,n){return n?n(e):F.of()}function M(e){return"function"==typeof e?new J(e):e}function I(e){return e.request.length<=1}"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(T,Symbol.species,{value:F});var C=function(e){function n(n,t){var r=e.call(this,n)||this;return r.link=t,r}return u(n,e),n}(Error),J=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return F.of()}))},e.from=function(n){return 0===n.length?e.empty():n.map(M).reduce((function(e,n){return e.concat(n)}))},e.split=function(n,t,r){var i=M(t),o=M(r||new e(q));return I(i)&&I(o)?new e((function(e){return n(e)?i.request(e)||F.of():o.request(e)||F.of()})):new e((function(e,t){return n(e)?i.request(e,t)||F.of():o.request(e,t)||F.of()}))},e.execute=function(e,n){return e.request(function(e,n){var t=a({},e);return Object.defineProperty(n,"setContext",{enumerable:!1,value:function(e){t=a(a({},t),"function"==typeof e?e(t):e)}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:function(){return a({},t)}}),n}(n.context,function(e){var n={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return n.operationName||(n.operationName="string"!=typeof n.query?n.query.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||void 0:""),n}(function(e){for(var n=["query","operationName","variables","extensions","context"],t=0,r=Object.keys(e);t<r.length;t++){var i=r[t];if(n.indexOf(i)<0)throw"production"===process.env.NODE_ENV?new m(25):new m("illegal argument: "+i)}return e}(n))))||F.of()},e.concat=function(n,t){var r=M(n);if(I(r))return"production"===process.env.NODE_ENV||h.warn(new C("You are calling concat on a terminating link, which will have no effect",r)),r;var i=M(t);return I(i)?new e((function(e){return r.request(e,(function(e){return i.request(e)||F.of()}))||F.of()})):new e((function(e,n){return r.request(e,(function(e){return i.request(e,n)||F.of()}))||F.of()}))},e.prototype.split=function(n,t,r){return this.concat(e.split(n,t,r||new e(q)))},e.prototype.concat=function(n){return e.concat(this,n)},e.prototype.request=function(e,n){throw"production"===process.env.NODE_ENV?new m(22):new m("request is not implemented")},e.prototype.onError=function(e){throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}();function L(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function R(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function z(e,n){return void 0===e&&(e={}),void 0===n&&(n=[]),e=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?L(Object(t),!0).forEach((function(n){R(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):L(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},e),n.forEach((function(n){var t=n.indexOf(".");if(-1!==t){var r=n.slice(0,t),i=n.slice(t+1);r&&e[r]&&(e[r]=z(e[r],[i]))}else e.hasOwnProperty(n)&&delete e[n]})),e}var B=Object.prototype,K=B.toString,Q=B.hasOwnProperty,W=new Map;function G(e,n){var t=W.get(e);if(t){if(t.has(n))return!0}else W.set(e,t=new Set);return t.add(n),!1}function U(e,n,t,r){if(function(e){return"IntValue"===e.kind}(t)||function(e){return"FloatValue"===e.kind}(t))e[n.value]=Number(t.value);else if(function(e){return"BooleanValue"===e.kind}(t)||function(e){return"StringValue"===e.kind}(t))e[n.value]=t.value;else if(function(e){return"ObjectValue"===e.kind}(t)){var i={};t.fields.map((function(e){return U(i,e.name,e.value,r)})),e[n.value]=i}else if(function(e){return"Variable"===e.kind}(t)){var o=(r||{})[t.name.value];e[n.value]=o}else if(function(e){return"ListValue"===e.kind}(t))e[n.value]=t.values.map((function(e){var t={};return U(t,n,e,r),t[n.value]}));else if(function(e){return"EnumValue"===e.kind}(t))e[n.value]=t.value;else{if(!function(e){return"NullValue"===e.kind}(t))throw"production"===process.env.NODE_ENV?new m(17):new m('The inline argument "'+n.value+'" of kind "'+t.kind+'"is not supported. Use variables instead of inline arguments to overcome this limitation.');e[n.value]=null}}var Y=["connection","include","skip","client","rest","export"];function $(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var r=t.connection.filter?t.connection.filter:[];r.sort();var i=n,o={};return r.forEach((function(e){o[e]=i[e]})),t.connection.key+"("+JSON.stringify(o)+")"}return t.connection.key}var u=e;if(n){var a=function(e,n){n||(n={}),"function"==typeof n&&(n={cmp:n});var t,r="boolean"==typeof n.cycles&&n.cycles,i=n.cmp&&(t=n.cmp,function(e){return function(n,r){var i={key:n,value:e[n]},o={key:r,value:e[r]};return t(i,o)}}),o=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0!==n){if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);var t,u;if(Array.isArray(n)){for(u="[",t=0;t<n.length;t++)t&&(u+=","),u+=e(n[t])||"null";return u+"]"}if(null===n)return"null";if(-1!==o.indexOf(n)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=o.push(n)-1,c=Object.keys(n).sort(i&&i(n));for(u="",t=0;t<c.length;t++){var l=c[t],s=e(n[l]);s&&(u&&(u+=","),u+=JSON.stringify(l)+":"+s)}return o.splice(a,1),"{"+u+"}"}}(e)}(n);u+="("+a+")"}return t&&Object.keys(t).forEach((function(e){-1===Y.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?u+="@"+e+"("+JSON.stringify(t[e])+")":u+="@"+e)})),u}function H(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach((function(e){var r=e.name,i=e.value;return U(t,r,i,n)})),t}return null}function X(e){return"Field"===e.kind}function Z(e){return"InlineFragment"===e.kind}function ee(e){throw"production"===process.env.NODE_ENV?new m(18):new m("Variable nodes are not supported by valueFromNode")}function ne(e){var n=[];return N(e,{Directive:function(e){n.push(e.name.value)}}),n}function te(e,n){return ne(n).some((function(n){return e.indexOf(n)>-1}))}function re(e){var n=e.name.value;return"skip"===n||"include"===n}function ie(e){return e?e.filter(re).map((function(e){var n=e.arguments,t=e.name.value;"production"===process.env.NODE_ENV?h(n&&1===n.length,14):h(n&&1===n.length,"Incorrect number of arguments for the @"+t+" directive.");var r=n[0];"production"===process.env.NODE_ENV?h(r.name&&"if"===r.name.value,15):h(r.name&&"if"===r.name.value,"Invalid argument for the @"+t+" directive.");var i=r.value;return"production"===process.env.NODE_ENV?h(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16):h(i&&("Variable"===i.kind||"BooleanValue"===i.kind),"Argument for the @"+t+" directive must be a variable or a boolean value."),{directive:e,ifArgument:r}})):[]}function oe(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach((function(n){null!=n&&Object.keys(n).forEach((function(t){e[t]=n[t]}))})),e}function ue(e){"production"===process.env.NODE_ENV?h(e&&"Document"===e.kind,2):h(e&&"Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql');var n=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw"production"===process.env.NODE_ENV?new m(3):new m('Schema type definitions not allowed in queries. Found: "'+e.kind+'"');return e}));return"production"===process.env.NODE_ENV?h(n.length<=1,4):h(n.length<=1,"Ambiguous GraphQL document: contains "+n.length+" operations"),e}function ae(e){return ue(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function ce(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function le(e){"production"===process.env.NODE_ENV?h("Document"===e.kind,7):h("Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'),"production"===process.env.NODE_ENV?h(e.definitions.length<=1,8):h(e.definitions.length<=1,"Fragment must have exactly one definition.");var n=e.definitions[0];return"production"===process.env.NODE_ENV?h("FragmentDefinition"===n.kind,9):h("FragmentDefinition"===n.kind,"Must be a fragment definition."),n}function se(e){var n;ue(e);for(var t=0,r=e.definitions;t<r.length;t++){var i=r[t];if("OperationDefinition"===i.kind){var o=i.operation;if("query"===o||"mutation"===o||"subscription"===o)return i}"FragmentDefinition"!==i.kind||n||(n=i)}if(n)return n;throw"production"===process.env.NODE_ENV?new m(10):new m("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.")}function fe(e){void 0===e&&(e=[]);var n={};return e.forEach((function(e){n[e.name.value]=e})),n}function pe(e,n,t){var r=0;return e.forEach((function(t,i){n.call(this,t,i,e)&&(e[r++]=t)}),t),e.length=r,e}var ve={kind:"Field",name:{kind:"Name",value:"__typename"}};function de(e){return function e(n,t){return n.selectionSet.selections.every((function(n){return"FragmentSpread"===n.kind&&e(t[n.name.value],t)}))}(ae(e)||le(e),fe(ce(e)))?null:e}function ye(e){return function(n){return e.some((function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)}))}}function me(e,n){var t=Object.create(null),r=[],i=Object.create(null),o=[],u=de(N(n,{Variable:{enter:function(e,n,r){"VariableDefinition"!==r.kind&&(t[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some((function(e){return e.remove}))&&n.directives&&n.directives.some(ye(e))))return n.arguments&&n.arguments.forEach((function(e){"Variable"===e.value.kind&&r.push({name:e.value.name.value})})),n.selectionSet&&function e(n){var t=[];return n.selections.forEach((function(n){(X(n)||Z(n))&&n.selectionSet?e(n.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===n.kind&&t.push(n)})),t}(n.selectionSet).forEach((function(e){o.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){i[e.name.value]=!0}},Directive:{enter:function(n){if(ye(e)(n))return null}}}));return u&&pe(r,(function(e){return!t[e.name]})).length&&(u=Oe(r,u)),u&&pe(o,(function(e){return!i[e.name]})).length&&(u=we(o,u)),u}var he={test:function(e){var n="connection"===e.name.value;return n&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||"production"===process.env.NODE_ENV||h.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),n}};function be(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some((function(n){return ge(e,n,t)}))}function ge(e,n,t){return void 0===t&&(t=!0),!X(n)||!!n.directives&&(n.directives.some(ye(e))||t&&be(e,n.selectionSet,t))}function Oe(e,n){var t=function(e){return function(n){return e.some((function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))}))}}(e);return de(N(n,{OperationDefinition:{enter:function(n){return a(a({},n),{variableDefinitions:n.variableDefinitions.filter((function(n){return!e.some((function(e){return e.name===n.variable.name.value}))}))})}},Field:{enter:function(n){if(e.some((function(e){return e.remove}))){var r=0;if(n.arguments.forEach((function(e){t(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(t(e))return null}}}))}function we(e,n){function t(n){if(e.some((function(e){return e.name===n.name.value})))return null}return de(N(n,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}var _e="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),je=Object.prototype.toString;function ke(){return"undefined"!=typeof process&&process.env.NODE_ENV?process.env.NODE_ENV:"development"}function Ee(e){return ke()===e}function De(){return!0===Ee("production")}function Se(){return!0===Ee("development")}function Ne(){return!0===Ee("test")}var xe=Object.prototype.hasOwnProperty;function Pe(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=Ae(n,r);for(var i=1;i<t;++i)n=Ve(n,e[i],r)}return n}function Fe(e){return null!==e&&"object"==typeof e}function Ve(e,n,t){return Fe(n)&&Fe(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=Ae(e,t)),Object.keys(n).forEach((function(r){var i=n[r];if(xe.call(e,r)){var o=e[r];i!==o&&(e[r]=Ve(Ae(o,t),i,t))}else e[r]=i})),e):n}function Ae(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):a({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var Te=Object.create({});var qe=Object.freeze({__proto__:null,addTypenameToDocument:function(e){return N(ue(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var r=e.selections;if(r)if(!r.some((function(e){return X(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=t;if(!(X(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return a(a({},e),{selections:s(r,[ve])})}}}}})},argumentsObjectFromField:H,assign:oe,buildQueryFromSelectionSet:function(e){return"query"===se(e).operation?e:N(e,{OperationDefinition:{enter:function(e){return a(a({},e),{operation:"query"})}}})},canUseWeakMap:_e,checkDocument:ue,cloneDeep:function(e){return function e(n,t){switch(je.call(n)){case"[object Array]":if(t.has(n))return t.get(n);var r=n.slice(0);return t.set(n,r),r.forEach((function(n,i){r[i]=e(n,t)})),r;case"[object Object]":if(t.has(n))return t.get(n);var i=Object.create(Object.getPrototypeOf(n));return t.set(n,i),Object.keys(n).forEach((function(r){i[r]=e(n[r],t)})),i;default:return n}}(e,new Map)},createFragmentMap:fe,getDefaultValues:function(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter((function(e){return e.defaultValue})).map((function(e){var n=e.variable,t=e.defaultValue,r={};return U(r,n.name,t),r}));return oe.apply(void 0,s([{}],n))}return{}},getDirectiveInfoFromField:function(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach((function(e){t[e.name.value]=H(e,n)})),t}return null},getDirectiveNames:ne,getDirectivesFromDocument:function(e,n){var t;return ue(n),de(N(n,{SelectionSet:{enter:function(n,r,i,o){var u=o.join("-");if(!t||u===t||!u.startsWith(t)){if(n.selections){var c=n.selections.filter((function(n){return ge(e,n)}));return be(e,n,!1)&&(t=u),a(a({},n),{selections:c})}return null}}}}))},getEnv:ke,getFragmentDefinition:le,getFragmentDefinitions:ce,getFragmentQueryDocument:function(e,n){var t=n,r=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw"production"===process.env.NODE_ENV?new m(11):new m("Found a "+e.operation+" operation"+(e.name?" named '"+e.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===e.kind&&r.push(e)})),void 0===t&&("production"===process.env.NODE_ENV?h(1===r.length,12):h(1===r.length,"Found "+r.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),t=r[0].name.value),a(a({},e),{definitions:s([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],e.definitions)})},getInclusionDirectives:ie,getMainDefinition:se,getMutationDefinition:function(e){ue(e);var n=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))[0];return"production"===process.env.NODE_ENV?h(n,1):h(n,"Must contain a mutation definition."),n},getOperationDefinition:ae,getOperationDefinitionOrDie:function(e){var n=ae(e);return"production"===process.env.NODE_ENV?h(n,5):h(n,"GraphQL document is missing an operation"),n},getOperationName:function(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null},getQueryDefinition:function(e){var n=ae(e);return"production"===process.env.NODE_ENV?h(n&&"query"===n.operation,6):h(n&&"query"===n.operation,"Must contain a query definition."),n},getStoreKeyName:$,graphQLResultHasError:function(e){return e.errors&&e.errors.length},hasClientExports:function(e){return e&&te(["client"],e)&&te(["export"],e)},hasDirectives:te,isDevelopment:Se,isEnv:Ee,isField:X,isIdValue:function(e){return e&&"id"===e.type&&"boolean"==typeof e.generated},isInlineFragment:Z,isJsonValue:function(e){return null!=e&&"object"==typeof e&&"json"===e.type},isNumberValue:function(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1},isProduction:De,isScalarValue:function(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1},isTest:Ne,maybeDeepFreeze:function(e){return!Se()&&!Ne()||"function"==typeof Symbol&&"string"==typeof Symbol("")?e:function e(n){return Object.freeze(n),Object.getOwnPropertyNames(n).forEach((function(t){null===n[t]||"object"!=typeof n[t]&&"function"!=typeof n[t]||Object.isFrozen(n[t])||e(n[t])})),n}(e)},mergeDeep:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Pe(e)},mergeDeepArray:Pe,removeArgumentsFromDocument:Oe,removeClientSetsFromDocument:function(e){ue(e);var n=me([{test:function(e){return"client"===e.name.value},remove:!0}],e);return n&&(n=N(n,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return X(e)&&"__typename"===e.name.value})))return null}}})),n},removeConnectionDirectiveFromDocument:function(e){return me([he],ue(e))},removeDirectivesFromDocument:me,removeFragmentSpreadFromDocument:we,resultKeyNameFromField:function(e){return e.alias?e.alias.value:e.name.value},shouldInclude:function(e,n){return void 0===n&&(n={}),ie(e.directives).every((function(e){var t=e.directive,r=e.ifArgument,i=!1;return"Variable"===r.value.kind?(i=n[r.value.name.value],"production"===process.env.NODE_ENV?h(void 0!==i,13):h(void 0!==i,"Invalid variable referenced in @"+t.name.value+" directive.")):i=r.value.value,"skip"===t.name.value?!i:i}))},storeKeyNameFromField:function(e,n){var t=null;e.directives&&(t={},e.directives.forEach((function(e){t[e.name.value]={},e.arguments&&e.arguments.forEach((function(r){var i=r.name,o=r.value;return U(t[e.name.value],i,o,n)}))})));var r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach((function(e){var t=e.name,i=e.value;return U(r,t,i,n)}))),$(e.name.value,r,t)},stripSymbols:function(e){return JSON.parse(JSON.stringify(e))},toIdValue:function(e,n){return void 0===n&&(n=!1),a({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)},tryFunctionOrLogError:function(e){try{return e()}catch(e){console.error&&console.error(e)}},valueFromNode:function e(n,t){switch(void 0===t&&(t=ee),n.kind){case"Variable":return t(n);case"NullValue":return null;case"IntValue":return parseInt(n.value,10);case"FloatValue":return parseFloat(n.value);case"ListValue":return n.values.map((function(n){return e(n,t)}));case"ObjectValue":for(var r={},i=0,o=n.fields;i<o.length;i++){var u=o[i];r[u.name.value]=e(u.value,t)}return r;default:return n.value}},valueToObjectRepresentation:U,variablesInOperation:function(e){var n=new Set;if(e.variableDefinitions)for(var t=0,r=e.variableDefinitions;t<r.length;t++){var i=r[t];n.add(i.variable.name.value)}return n},warnOnceInDevelopment:function(e,n){void 0===n&&(n="warn"),De()||Te[e]||(Ne()||(Te[e]=!0),"error"===n?console.error(e):console.warn(e))},isEqual:function(e,n){try{return function e(n,t){if(n===t)return!0;var r=K.call(n),i=K.call(t);if(r!==i)return!1;switch(r){case"[object Array]":if(n.length!==t.length)return!1;case"[object Object]":if(G(n,t))return!0;var o=Object.keys(n),u=Object.keys(t),a=o.length;if(a!==u.length)return!1;for(var c=0;c<a;++c)if(!Q.call(t,o[c]))return!1;for(c=0;c<a;++c){var l=o[c];if(!e(n[l],t[l]))return!1}return!0;case"[object Error]":return n.name===t.name&&n.message===t.message;case"[object Number]":if(n!=n)return t!=t;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object RegExp]":case"[object String]":return n==""+t;case"[object Map]":case"[object Set]":if(n.size!==t.size)return!1;if(G(n,t))return!0;for(var s=n.entries(),f="[object Map]"===r;;){var p=s.next();if(p.done)break;var v=p.value,d=v[0],y=v[1];if(!t.has(d))return!1;if(f&&!e(y,t.get(d)))return!1}return!0}return!1}(e,n)}finally{W.clear()}}}),Me=P((function(e,n){function t(e,n,r){var o=r.fragmentMap,u=r.contextValue,a=r.variableValues,c={};return e.selections.forEach((function(e){if(!a||qe.shouldInclude(e,a))if(qe.isField(e)){var l=function(e,n,r){var i=r.variableValues,o=r.contextValue,u=r.resolver,a=e.name.value,c=qe.argumentsObjectFromField(e,i),l={isLeaf:!e.selectionSet,resultKey:qe.resultKeyNameFromField(e),directives:qe.getDirectiveInfoFromField(e,i),field:e},s=u(a,n,c,o,l);if(!e.selectionSet)return s;if(null==s)return s;if(Array.isArray(s))return function e(n,r,i){return r.map((function(r){return null===r?null:Array.isArray(r)?e(n,r,i):t(n.selectionSet,r,i)}))}(e,s,r);return t(e.selectionSet,s,r)}(e,n,r),s=qe.resultKeyNameFromField(e);void 0!==l&&(void 0===c[s]?c[s]=l:i(c[s],l))}else{var f=void 0;if(qe.isInlineFragment(e))f=e;else if(!(f=o[e.name.value]))throw new Error("No fragment named "+e.name.value);var p=f.typeCondition.name.value;if(r.fragmentMatcher(n,p,u)){var v=t(f.selectionSet,n,r);i(c,v)}}})),r.resultMapper?r.resultMapper(c,n):c}Object.defineProperty(n,"__esModule",{value:!0}),n.graphql=function(e,n,r,i,o,u){void 0===o&&(o={}),void 0===u&&(u={});var a=qe.getMainDefinition(n),c=qe.getFragmentDefinitions(n),l={fragmentMap:qe.createFragmentMap(c),contextValue:i,variableValues:o,resultMapper:u.resultMapper,resolver:e,fragmentMatcher:u.fragmentMatcher||function(){return!0}};return t(a.selectionSet,r,l)};var r=Object.prototype.hasOwnProperty;function i(e,n){null!==n&&"object"==typeof n&&Object.keys(n).forEach((function(t){var o=n[t];r.call(e,t)?i(e[t],o):e[t]=o}))}n.merge=i})),Ie=P((function(e,n){function t(e,n,i){return p.__awaiter(this,void 0,void 0,(function(){var o,u,a,c,l,s=this;return p.__generator(this,(function(f){switch(f.label){case 0:return o=i.fragmentMap,u=i.contextValue,a=i.variableValues,c={},l=function(e){return p.__awaiter(s,void 0,void 0,(function(){var l,s,f,v,d;return p.__generator(this,(function(p){switch(p.label){case 0:return qe.shouldInclude(e,a)?qe.isField(e)?[4,r(e,n,i)]:[3,2]:[2];case 1:return l=p.sent(),s=qe.resultKeyNameFromField(e),void 0!==l&&(void 0===c[s]?c[s]=l:Me.merge(c[s],l)),[2];case 2:if(qe.isInlineFragment(e))f=e;else if(!(f=o[e.name.value]))throw new Error("No fragment named "+e.name.value);return v=f.typeCondition.name.value,i.fragmentMatcher(n,v,u)?[4,t(f.selectionSet,n,i)]:[3,4];case 3:d=p.sent(),Me.merge(c,d),p.label=4;case 4:return[2]}}))}))},[4,Promise.all(e.selections.map(l))];case 1:return f.sent(),i.resultMapper?[2,i.resultMapper(c,n)]:[2,c]}}))}))}function r(e,n,r){return p.__awaiter(this,void 0,void 0,(function(){var o,u,a,c,l,s,f;return p.__generator(this,(function(p){switch(p.label){case 0:return o=r.variableValues,u=r.contextValue,a=r.resolver,c=e.name.value,l=qe.argumentsObjectFromField(e,o),s={isLeaf:!e.selectionSet,resultKey:qe.resultKeyNameFromField(e),directives:qe.getDirectiveInfoFromField(e,o),field:e},[4,a(c,n,l,u,s)];case 1:return f=p.sent(),e.selectionSet?null==f?[2,f]:Array.isArray(f)?[2,i(e,f,r)]:[2,t(e.selectionSet,f,r)]:[2,f]}}))}))}function i(e,n,r){return Promise.all(n.map((function(n){return null===n?null:Array.isArray(n)?i(e,n,r):t(e.selectionSet,n,r)})))}Object.defineProperty(n,"__esModule",{value:!0}),n.graphql=function(e,n,r,i,o,u){void 0===u&&(u={});var a=qe.getMainDefinition(n),c=qe.getFragmentDefinitions(n),l={fragmentMap:qe.createFragmentMap(c),contextValue:i,variableValues:o,resultMapper:u.resultMapper,resolver:e,fragmentMatcher:u.fragmentMatcher||function(){return!0}};return t(a.selectionSet,r,l)}}));function Ce(e,n,t){function r(e){return!("object"!=typeof e||!e.hasOwnProperty("sys")||1!==Object.keys(e).length)}function i(e,o,u,a){if(void 0===u&&(u={}),void 0===a&&(a=0),!e||"object"!=typeof e)return u;if(a>=n.include)return u;var c=Object.assign({},u);return Object.keys(e).forEach((function(n){c[n]=e[n].fields&&t.parseRefs?i(e[n].fields,e[n].sys,c[n],a+1):function e(n,o){return void 0===o&&(o=0),r(n)?null:Array.isArray(n)&&t.parseArrays?n.filter((function(e){return!r(e)})).map((function(n){return n&&"object"==typeof n&&n.fields?i(n.fields,n.sys,{},o+1):e(n,o+1)})):n}(e[n],a+1)})),o&&o.contentType&&o.contentType.sys&&o.contentType.sys.id&&(c.id=o.id,c.__typename=o.contentType.sys.id),o&&o.updatedAt&&(c.updatedAt=o.updatedAt),o&&o.createdAt&&(c.createdAt=o.createdAt),c}void 0===n&&(n={include:10}),void 0===t&&(t={parseArrays:!0,parseRefs:!0});var o=Object.assign({},e);return i(o.fields,o.sys)}function Je(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Le(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Je(Object(t),!0).forEach((function(n){r.default(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Re=function(e,n){return n.hasOwnProperty(e)?n[e]:null};function ze(e,n,t,r){var i,o;function u(e,n){return e?(e.hasOwnProperty("__typename")&&e.__typename&&(e.__typename=e.__typename.substring(0,1).toUpperCase()+e.__typename.substring(1)),n&&n.sys?e.sys=Le(Le({},n.sys),{},{__typename:"Sys"}):n.id&&(e.sys={id:n.id,__typename:"Sys"}),e.id&&delete e.id,e.createdAt&&delete e.createdAt,e.updatedAt&&delete e.updatedAt,e):e}function a(e,n,t){var i;if(void 0===t&&(t=0),!e)return null;if(t>=r.include)return e;var o=Object.assign({},e.hasOwnProperty("sys")&&e.hasOwnProperty("fields")?Ce(e,r,{parseArrays:!1,parseRefs:!1}):e);Object.keys(o).forEach((function(r){var i=o[r];if(Array.isArray(i)){var l=!1;if(i.forEach((function(e){(e.hasOwnProperty("sys")&&e.hasOwnProperty("fields")||e.hasOwnProperty("__typename"))&&(l=!0)})),l){var s=r+"Collection";o[s]=c(i,null==n?void 0:n[s],t+1),delete o[r]}else o[r]=i.map((function(n,t){return u(n,e.fields[r][t])}))}else"object"==typeof i&&(i.hasOwnProperty("__typename")||i.hasOwnProperty("sys")&&i.hasOwnProperty("fields"))?o[r]=a(i,null==n?void 0:n[r],t+1):o[r]=i}));var l=u(o,e);return function e(n,t){if(!n||!t)return n;var r=Object.assign({},n);return Object.keys(t).forEach((function(n){r.hasOwnProperty(n)||(n.endsWith("Collection")&&t[n].items?r[n]=c([],t[n]):n.startsWith("...")?r[n]=e({},t[n]):r[n]=t[n])})),r}("Asset"===(null==l||null==(i=l.sys)?void 0:i.type)?function(e){var n,t,r,i,o,u,a,c,l,s,f,p,v,d,y,m,h,b=Object.assign({},e);return b.__typename="Asset",b.url=null==b||null==(n=b.file)?void 0:n.url,b.contentType=null==b||null==(t=b.file)?void 0:t.contentType,b.size=null==b||null==(r=b.file)||null==(i=r.details)?void 0:i.size,b.width=(null==b||null==(o=b.file)||null==(u=o.details)||null==(a=u.image)?void 0:a.width)||(null==b||null==(c=b.file)||null==(l=c.details)||null==(s=l.video)?void 0:s.width),b.height=(null==b||null==(f=b.file)||null==(p=f.details)||null==(v=p.image)?void 0:v.height)||(null==b||null==(d=b.file)||null==(y=d.details)||null==(m=y.video)?void 0:m.height),b.fileName=null==b||null==(h=b.file)?void 0:h.fileName,delete b.file,b}(l):l,n)}function c(e,n,t){return void 0===e&&(e=[]),void 0===t&&(t=0),{__typename:"Array",total:(e||[]).length,items:(e||[]).map((function(e){return a(e,null==n?void 0:n.items,t)})).filter((function(e){return!!e}))}}return void 0===r&&(r={include:10}),(null==n?void 0:n.items)?((o={})[e]=c(n.items,null==t?void 0:t[e]),o):((i={})[e]=a(n,null==t?void 0:t[e]),i)}var Be="OperationDefinition",Ke="FragmentDefinition",Qe="Field",We="FragmentSpread",Ge="Name",Ue="Argument",Ye="ObjectField";function $e(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function He(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$e(Object(t),!0).forEach((function(n){r.default(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$e(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Xe=function(e){var n=e.query,t=e.operationName;return n.hasOwnProperty(t)?n[t]:n},Ze=["access_token","include","locale","content_type","select","query","links_to_entry","links_to_asset","order","limit","skip","mimetype_group","preview"],en=function(e){var n,t,r=e.query,i=r.definitions.find((function(e){return e.kind===Be}));return i&&(null==i||null==(n=i.name)?void 0:n.value)?((t={})[i.name.value]=function e(n,t){if(!n||!n.selections||!n.selections.length)return null;var r={};return n.selections.forEach((function(n){var i;if(n.kind===Qe)(null==n||null==(i=n.name)?void 0:i.value)&&(r[n.name.value]=e(n.selectionSet,t));else if(n.kind===We){var o=t.find((function(e){var t,r;return e.kind===Ke&&(null==e||null==(t=e.name)?void 0:t.value)&&(null==n||null==(r=n.name)?void 0:r.value)&&e.name.value===n.name.value}));o&&(r["..."+n.name.value]=e(o.selectionSet,t))}})),r}(i.selectionSet,r.definitions),t):{}},nn=function(e){var n,t=e.variables,r=function(e){var n={};return Xe(e).definitions.filter((function(e){return e.kind===Be})).forEach((function(e){e.selectionSet.selections.forEach((function(e){e.arguments.forEach((function(e){var t,r,i,o;(null==e||null==(t=e.value)?void 0:t.fields)?e.value.fields.forEach((function(e){var t,r,i;(null==e||null==(t=e.value)||null==(r=t.name)?void 0:r.value)&&(null==e?void 0:e.kind)&&(null==e||null==(i=e.name)?void 0:i.value)&&(n[e.value.name.value]={kind:e.kind,field:e.name.value})})):(null==e||null==(r=e.value)||null==(i=r.name)?void 0:i.value)&&(null==e?void 0:e.kind)&&(null==e||null==(o=e.name)?void 0:o.value)&&(n[e.value.name.value]={kind:e.kind,field:e.name.value})}))}))})),n}(e),i=null==(n=Xe(e).definitions.find((function(e){return e.kind===Be})))?void 0:n.variableDefinitions.map((function(e){return e.variable.name.value})),o=Object.keys(r).filter((function(e){return t.hasOwnProperty(e)&&r.hasOwnProperty(e)})).map((function(e){var n,i;try{switch(r[e].kind){case Ue:var o;if((null==r||null==(n=r[e])?void 0:n.field)&&Ze.includes(r[e].field))return"preview"!==r[e].field||t[e]?((o={})[r[e].field]=t[e],o):null;break;case Ye:var u=function(e){return e.endsWith("_in")?"fields."+e.replace("_in","")+"[in]":e.endsWith("_not")?"fields."+e.replace("_not","")+"[ne]":e.endsWith("_exists")?"fields."+e.replace("_exists","")+"[exists]":e.endsWith("_not_in")?"fields."+e.replace("_not_in","")+"[nin]":"fields."+e}(r[e].field);return(i={})[u]=t[e],i;default:return null}}catch(e){return console.error(e),null}})).filter((function(e){return!!e})).reduce((function(e,n){return He(He({},e),n)}),{});return He(He({},o),omit(t,i))};function tn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function rn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tn(Object(t),!0).forEach((function(n){r.default(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var on=require("contentful");return function(e){function n(n,t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).clientOptions=n,r.queryDefaults=t,r.client=on.createClient(rn({},z(n,["previewAccessToken"]))),n.hasOwnProperty("previewAccessToken")&&n.previewAccessToken&&(r.previewClient=on.createClient(rn(rn({},z(n,["previewAccessToken"])),{},{accessToken:n.previewAccessToken,host:"preview.contentful.com"}))),r}return i.default(n,e),n.prototype.request=function(e,n){var t=this,r=e.query,i=e.operationName;return(n?n(e):F.of({data:{}})).flatMap((function(n){n.data;var o=n.errors;return new F((function(n){var u=function(e){var n,t,r,i;return null==(n=Xe(e).definitions.find((function(e){return e.kind===Be})))||null==(t=n.selectionSet)||null==(r=t.selections.find((function(e){return e.name.kind===Ge})))||null==(i=r.name)?void 0:i.value}(e),a=nn(e),c=a.hasOwnProperty("id")?"getEntry":"getEntries",l="getEntry"===c?[a.id,rn(rn({},t.queryDefaults),z(a,["id","preview"]))]:[rn(rn(rn({},t.queryDefaults),z(a,["preview"])),{},{content_type:u.replace("Collection","")})],s=t.previewClient&&a.hasOwnProperty("preview")&&a.preview?t.previewClient:t.client;s[c].apply(s,l).then((function(t){var a=en(e),c=ze(u,t,a[i]);Ie.graphql(Re,r,c).then((function(e){n.next({data:e,errors:o}),n.complete()})).catch((function(e){return console.error(e)}))})).catch((function(e){n.error(e)}))}))}))},n}(J)}));

Sorry, the diff of this file is too big to display