text: (function (global, factory) {
      typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('apollo-link'), require('apollo-link-http-common')) :
      typeof define === 'function' && define.amd ? define(['exports', 'apollo-link', 'apollo-link-http-common'], factory) :
      (global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.http = {}), global.apolloLink.core, global.apolloLink.httpCommon));
  }(this, function (exports, apolloLink, apolloLinkHttpCommon) { 'use strict';
  
      /*! *****************************************************************************
      Copyright (c) Microsoft Corporation. All rights reserved.
      Licensed under the Apache License, Version 2.0 (the "License"); you may not use
      this file except in compliance with the License. You may obtain a copy of the
      License at http://www.apache.org/licenses/LICENSE-2.0
  
      THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
      WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
      MERCHANTABLITY OR NON-INFRINGEMENT.
  
      See the Apache Version 2.0 License for specific language governing permissions
      and limitations under the License.
      ***************************************************************************** */
      /* global Reflect, Promise */
  
      var extendStatics = function(d, b) {
          extendStatics = Object.setPrototypeOf ||
              ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
              function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
          return extendStatics(d, b);
      };
  
      function __extends(d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      }
  
      var __assign = function() {
          __assign = Object.assign || function __assign(t) {
              for (var s, i = 1, n = arguments.length; i < n; i++) {
                  s = arguments[i];
                  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
              }
              return t;
          };
          return __assign.apply(this, arguments);
      };
  
      function __rest(s, e) {
          var t = {};
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
              t[p] = s[p];
          if (s != null && typeof Object.getOwnPropertySymbols === "function")
              for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
                  t[p[i]] = s[p[i]];
          return t;
      }
  
      var createHttpLink = function (linkOptions) {
          if (linkOptions === void 0) { linkOptions = {}; }
          var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, fetcher = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, requestOptions = __rest(linkOptions, ["uri", "fetch", "includeExtensions", "useGETForQueries"]);
          apolloLinkHttpCommon.checkFetcher(fetcher);
          if (!fetcher) {
              fetcher = fetch;
          }
          var linkConfig = {
              http: { includeExtensions: includeExtensions },
              options: requestOptions.fetchOptions,
              credentials: requestOptions.credentials,
              headers: requestOptions.headers,
          };
          return new apolloLink.ApolloLink(function (operation) {
              var chosenURI = apolloLinkHttpCommon.selectURI(operation, uri);
              var context = operation.getContext();
              var clientAwarenessHeaders = {};
              if (context.clientAwareness) {
                  var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;
                  if (name_1) {
                      clientAwarenessHeaders['apollographql-client-name'] = name_1;
                  }
                  if (version) {
                      clientAwarenessHeaders['apollographql-client-version'] = version;
                  }
              }
              var contextHeaders = __assign({}, clientAwarenessHeaders, context.headers);
              var contextConfig = {
                  http: context.http,
                  options: context.fetchOptions,
                  credentials: context.credentials,
                  headers: contextHeaders,
              };
              var _b = apolloLinkHttpCommon.selectHttpOptionsAndBody(operation, apolloLinkHttpCommon.fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
              var controller;
              if (!options.signal) {
                  var _c = apolloLinkHttpCommon.createSignalIfSupported(), _controller = _c.controller, signal = _c.signal;
                  controller = _controller;
                  if (controller)
                      options.signal = signal;
              }
              var definitionIsMutation = function (d) {
                  return d.kind === 'OperationDefinition' && d.operation === 'mutation';
              };
              if (useGETForQueries &&
                  !operation.query.definitions.some(definitionIsMutation)) {
                  options.method = 'GET';
              }
              if (options.method === 'GET') {
                  var _d = rewriteURIForGET(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError;
                  if (parseError) {
                      return apolloLink.fromError(parseError);
                  }
                  chosenURI = newURI;
              }
              else {
                  try {
                      options.body = apolloLinkHttpCommon.serializeFetchParameter(body, 'Payload');
                  }
                  catch (parseError) {
                      return apolloLink.fromError(parseError);
                  }
              }
              return new apolloLink.Observable(function (observer) {
                  fetcher(chosenURI, options)
                      .then(function (response) {
                      operation.setContext({ response: response });
                      return response;
                  })
                      .then(apolloLinkHttpCommon.parseAndCheckHttpResponse(operation))
                      .then(function (result) {
                      observer.next(result);
                      observer.complete();
                      return result;
                  })
                      .catch(function (err) {
                      if (err.name === 'AbortError')
                          return;
                      if (err.result && err.result.errors && err.result.data) {
                          observer.next(err.result);
                      }
                      observer.error(err);
                  });
                  return function () {
                      if (controller)
                          controller.abort();
                  };
              });
          });
      };
      function rewriteURIForGET(chosenURI, body) {
          var queryParams = [];
          var addQueryParam = function (key, value) {
              queryParams.push(key + "=" + encodeURIComponent(value));
          };
          if ('query' in body) {
              addQueryParam('query', body.query);
          }
          if (body.operationName) {
              addQueryParam('operationName', body.operationName);
          }
          if (body.variables) {
              var serializedVariables = void 0;
              try {
                  serializedVariables = apolloLinkHttpCommon.serializeFetchParameter(body.variables, 'Variables map');
              }
              catch (parseError) {
                  return { parseError: parseError };
              }
              addQueryParam('variables', serializedVariables);
          }
          if (body.extensions) {
              var serializedExtensions = void 0;
              try {
                  serializedExtensions = apolloLinkHttpCommon.serializeFetchParameter(body.extensions, 'Extensions map');
              }
              catch (parseError) {
                  return { parseError: parseError };
              }
              addQueryParam('extensions', serializedExtensions);
          }
          var fragment = '', preFragment = chosenURI;
          var fragmentStart = chosenURI.indexOf('#');
          if (fragmentStart !== -1) {
              fragment = chosenURI.substr(fragmentStart);
              preFragment = chosenURI.substr(0, fragmentStart);
          }
          var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&';
          var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment;
          return { newURI: newURI };
      }
      var HttpLink = (function (_super) {
          __extends(HttpLink, _super);
          function HttpLink(opts) {
              return _super.call(this, createHttpLink(opts).request) || this;
          }
          return HttpLink;
      }(apolloLink.ApolloLink));
  
      exports.createHttpLink = createHttpLink;
      exports.HttpLink = HttpLink;
  
      Object.defineProperty(exports, '__esModule', { value: true });
  
  }));
  //# sourceMappingURL=bundle.umd.js.map
  