text: ["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/labs/net/xhr.js"],"~:js","goog.provide(\"goog.labs.net.xhr\");\ngoog.provide(\"goog.labs.net.xhr.Error\");\ngoog.provide(\"goog.labs.net.xhr.HttpError\");\ngoog.provide(\"goog.labs.net.xhr.Options\");\ngoog.provide(\"goog.labs.net.xhr.PostData\");\ngoog.provide(\"goog.labs.net.xhr.ResponseType\");\ngoog.provide(\"goog.labs.net.xhr.TimeoutError\");\ngoog.require(\"goog.Promise\");\ngoog.require(\"goog.asserts\");\ngoog.require(\"goog.debug.Error\");\ngoog.require(\"goog.net.HttpStatus\");\ngoog.require(\"goog.net.XmlHttp\");\ngoog.require(\"goog.object\");\ngoog.require(\"goog.string\");\ngoog.require(\"goog.uri.utils\");\ngoog.require(\"goog.userAgent\");\ngoog.scope(function() {\n  var userAgent = goog.userAgent;\n  var xhr = goog.labs.net.xhr;\n  var HttpStatus = goog.net.HttpStatus;\n  xhr.Options;\n  xhr.PostData;\n  xhr.CONTENT_TYPE_HEADER = \"Content-Type\";\n  xhr.FORM_CONTENT_TYPE = \"application/x-www-form-urlencoded;charset\\x3dutf-8\";\n  xhr.ResponseType = {ARRAYBUFFER:\"arraybuffer\", BLOB:\"blob\", DOCUMENT:\"document\", JSON:\"json\", TEXT:\"text\"};\n  xhr.get = function(url, opt_options) {\n    return xhr.send(\"GET\", url, null, opt_options).then(function(request) {\n      return request.responseText;\n    });\n  };\n  xhr.post = function(url, data, opt_options) {\n    return xhr.send(\"POST\", url, data, opt_options).then(function(request) {\n      return request.responseText;\n    });\n  };\n  xhr.getJson = function(url, opt_options) {\n    return xhr.send(\"GET\", url, null, opt_options).then(function(request) {\n      return xhr.parseJson_(request.responseText, opt_options);\n    });\n  };\n  xhr.getBlob = function(url, opt_options) {\n    goog.asserts.assert(\"Blob\" in goog.global, \"getBlob is not supported in this browser.\");\n    var options = opt_options ? goog.object.clone(opt_options) : {};\n    options.responseType = xhr.ResponseType.BLOB;\n    return xhr.send(\"GET\", url, null, options).then(function(request) {\n      return request.response;\n    });\n  };\n  xhr.getBytes = function(url, opt_options) {\n    goog.asserts.assert(!userAgent.IE || userAgent.isDocumentModeOrHigher(9), \"getBytes is not supported in this browser.\");\n    var options = opt_options ? goog.object.clone(opt_options) : {};\n    options.responseType = xhr.ResponseType.ARRAYBUFFER;\n    return xhr.send(\"GET\", url, null, options).then(function(request) {\n      if (request.response) {\n        return new Uint8Array(request.response);\n      }\n      if (goog.global[\"VBArray\"]) {\n        return (new goog.global[\"VBArray\"](request[\"responseBody\"])).toArray();\n      }\n      throw new xhr.Error(\"getBytes is not supported in this browser.\", url, request);\n    });\n  };\n  xhr.postJson = function(url, data, opt_options) {\n    return xhr.send(\"POST\", url, data, opt_options).then(function(request) {\n      return xhr.parseJson_(request.responseText, opt_options);\n    });\n  };\n  xhr.send = function(method, url, data, opt_options) {\n    var options = opt_options || {};\n    var request = options.xmlHttpFactory ? options.xmlHttpFactory.createInstance() : goog.net.XmlHttp();\n    var result = new goog.Promise(function(resolve, reject) {\n      var timer;\n      try {\n        request.open(method, url, true);\n      } catch (e) {\n        reject(new xhr.Error(\"Error opening XHR: \" + e.message, url, request));\n      }\n      request.onreadystatechange = function() {\n        if (request.readyState == goog.net.XmlHttp.ReadyState.COMPLETE) {\n          goog.global.clearTimeout(timer);\n          if (HttpStatus.isSuccess(request.status) || request.status === 0 && !xhr.isEffectiveSchemeHttp_(url)) {\n            resolve(request);\n          } else {\n            reject(new xhr.HttpError(request.status, url, request));\n          }\n        }\n      };\n      request.onerror = function() {\n        reject(new xhr.Error(\"Network error\", url, request));\n      };\n      var contentType;\n      if (options.headers) {\n        for (var key in options.headers) {\n          var value = options.headers[key];\n          if (value != null) {\n            request.setRequestHeader(key, value);\n          }\n        }\n        contentType = options.headers[xhr.CONTENT_TYPE_HEADER];\n      }\n      var dataIsFormData = goog.global[\"FormData\"] && data instanceof goog.global[\"FormData\"];\n      if (method == \"POST\" && contentType === undefined && !dataIsFormData) {\n        request.setRequestHeader(xhr.CONTENT_TYPE_HEADER, xhr.FORM_CONTENT_TYPE);\n      }\n      if (options.withCredentials) {\n        request.withCredentials = options.withCredentials;\n      }\n      if (options.responseType) {\n        request.responseType = options.responseType;\n      }\n      if (options.mimeType) {\n        request.overrideMimeType(options.mimeType);\n      }\n      if (options.timeoutMs > 0) {\n        timer = goog.global.setTimeout(function() {\n          request.onreadystatechange = goog.nullFunction;\n          request.abort();\n          reject(new xhr.TimeoutError(url, request));\n        }, options.timeoutMs);\n      }\n      try {\n        request.send(data);\n      } catch (e$3) {\n        request.onreadystatechange = goog.nullFunction;\n        goog.global.clearTimeout(timer);\n        reject(new xhr.Error(\"Error sending XHR: \" + e$3.message, url, request));\n      }\n    });\n    return result.thenCatch(function(error) {\n      if (error instanceof goog.Promise.CancellationError) {\n        request.abort();\n      }\n      throw error;\n    });\n  };\n  xhr.isEffectiveSchemeHttp_ = function(url) {\n    var scheme = goog.uri.utils.getEffectiveScheme(url);\n    return scheme == \"http\" || scheme == \"https\" || scheme == \"\";\n  };\n  xhr.parseJson = function(responseText, opt_xssiPrefix) {\n    return xhr.parseJson_(responseText, {xssiPrefix:opt_xssiPrefix});\n  };\n  xhr.parseJson_ = function(responseText, options) {\n    var prefixStrippedResult = responseText;\n    if (options && options.xssiPrefix) {\n      prefixStrippedResult = xhr.stripXssiPrefix_(options.xssiPrefix, prefixStrippedResult);\n    }\n    return JSON.parse(prefixStrippedResult);\n  };\n  xhr.stripXssiPrefix_ = function(prefix, string) {\n    if (goog.string.startsWith(string, prefix)) {\n      string = string.substring(prefix.length);\n    }\n    return string;\n  };\n  xhr.Error = function(message, url, request) {\n    xhr.Error.base(this, \"constructor\", message + \", url\\x3d\" + url);\n    this.url = url;\n    this.xhr = request;\n  };\n  goog.inherits(xhr.Error, goog.debug.Error);\n  xhr.Error.prototype.name = \"XhrError\";\n  xhr.HttpError = function(status, url, request) {\n    xhr.HttpError.base(this, \"constructor\", \"Request Failed, status\\x3d\" + status, url, request);\n    this.status = status;\n  };\n  goog.inherits(xhr.HttpError, xhr.Error);\n  xhr.HttpError.prototype.name = \"XhrHttpError\";\n  xhr.TimeoutError = function(url, request) {\n    xhr.TimeoutError.base(this, \"constructor\", \"Request timed out\", url, request);\n  };\n  goog.inherits(xhr.TimeoutError, xhr.Error);\n  xhr.TimeoutError.prototype.name = \"XhrTimeoutError\";\n});\n","~:source","// Copyright 2011 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/**\n * @fileoverview Offered as an alternative to XhrIo as a way for making requests\n * via XMLHttpRequest.  Instead of mirroring the XHR interface and exposing\n * events, results are used as a way to pass a \"promise\" of the response to\n * interested parties.\n *\n */\n\ngoog.provide('goog.labs.net.xhr');\ngoog.provide('goog.labs.net.xhr.Error');\ngoog.provide('goog.labs.net.xhr.HttpError');\ngoog.provide('goog.labs.net.xhr.Options');\ngoog.provide('goog.labs.net.xhr.PostData');\ngoog.provide('goog.labs.net.xhr.ResponseType');\ngoog.provide('goog.labs.net.xhr.TimeoutError');\n\ngoog.require('goog.Promise');\ngoog.require('goog.asserts');\ngoog.require('goog.debug.Error');\ngoog.require('goog.net.HttpStatus');\ngoog.require('goog.net.XmlHttp');\ngoog.require('goog.object');\ngoog.require('goog.string');\ngoog.require('goog.uri.utils');\ngoog.require('goog.userAgent');\n\n\n\ngoog.scope(function() {\nvar userAgent = goog.userAgent;\nvar xhr = goog.labs.net.xhr;\nvar HttpStatus = goog.net.HttpStatus;\n\n\n/**\n * Configuration options for an XMLHttpRequest.\n * - headers: map of header key/value pairs.\n * - timeoutMs: number of milliseconds after which the request will be timed\n *      out by the client. Default is to allow the browser to handle timeouts.\n * - withCredentials: whether user credentials are to be included in a\n *      cross-origin request. See:\n *      http://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute\n * - mimeType: allows the caller to override the content-type and charset for\n *      the request. See:\n *      http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-overridemimetype\n * - responseType: may be set to change the response type to an arraybuffer or\n *      blob for downloading binary data. See:\n *      http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-responsetype]\n * - xmlHttpFactory: allows the caller to override the factory used to create\n *      XMLHttpRequest objects.\n * - xssiPrefix: Prefix used for protecting against XSSI attacks, which should\n *      be removed before parsing the response as JSON.\n *\n * @typedef {{\n *   headers: (Object<string>|undefined),\n *   mimeType: (string|undefined),\n *   responseType: (xhr.ResponseType|undefined),\n *   timeoutMs: (number|undefined),\n *   withCredentials: (boolean|undefined),\n *   xmlHttpFactory: (goog.net.XmlHttpFactory|undefined),\n *   xssiPrefix: (string|undefined)\n * }}\n */\nxhr.Options;\n\n\n/**\n * Defines the types that are allowed as post data.\n * @typedef {(ArrayBuffer|ArrayBufferView|Blob|Document|FormData|null|string|undefined)}\n */\nxhr.PostData;\n\n\n/**\n * The Content-Type HTTP header name.\n * @type {string}\n */\nxhr.CONTENT_TYPE_HEADER = 'Content-Type';\n\n\n/**\n * The Content-Type HTTP header value for a url-encoded form.\n * @type {string}\n */\nxhr.FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded;charset=utf-8';\n\n\n/**\n * Supported data types for the responseType field.\n * See: http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-response\n * @enum {string}\n */\nxhr.ResponseType = {\n  ARRAYBUFFER: 'arraybuffer',\n  BLOB: 'blob',\n  DOCUMENT: 'document',\n  JSON: 'json',\n  TEXT: 'text'\n};\n\n\n/**\n * Sends a get request, returning a promise that will be resolved\n * with the response text once the request completes.\n *\n * @param {string} url The URL to request.\n * @param {xhr.Options=} opt_options Configuration options for the request.\n * @return {!goog.Promise<string>} A promise that will be resolved with the\n *     response text once the request completes.\n */\nxhr.get = function(url, opt_options) {\n  return xhr.send('GET', url, null, opt_options).then(function(request) {\n    return request.responseText;\n  });\n};\n\n\n/**\n * Sends a post request, returning a promise that will be resolved\n * with the response text once the request completes.\n *\n * @param {string} url The URL to request.\n * @param {xhr.PostData} data The body of the post request.\n * @param {xhr.Options=} opt_options Configuration options for the request.\n * @return {!goog.Promise<string>} A promise that will be resolved with the\n *     response text once the request completes.\n */\nxhr.post = function(url, data, opt_options) {\n  return xhr.send('POST', url, data, opt_options).then(function(request) {\n    return request.responseText;\n  });\n};\n\n\n/**\n * Sends a get request, returning a promise that will be resolved with\n * the parsed response text once the request completes.\n *\n * @param {string} url The URL to request.\n * @param {xhr.Options=} opt_options Configuration options for the request.\n * @return {!goog.Promise<Object>} A promise that will be resolved with the\n *     response JSON once the request completes.\n */\nxhr.getJson = function(url, opt_options) {\n  return xhr.send('GET', url, null, opt_options).then(function(request) {\n    return xhr.parseJson_(request.responseText, opt_options);\n  });\n};\n\n\n/**\n * Sends a get request, returning a promise that will be resolved with the\n * response as a Blob.\n *\n * @param {string} url The URL to request.\n * @param {xhr.Options=} opt_options Configuration options for the request. If\n *     responseType is set, it will be ignored for this request.\n * @return {!goog.Promise<!Blob>} A promise that will be resolved with an\n *     immutable Blob representing the file once the request completes.\n */\nxhr.getBlob = function(url, opt_options) {\n  goog.asserts.assert(\n      'Blob' in goog.global, 'getBlob is not supported in this browser.');\n\n  var options = opt_options ? goog.object.clone(opt_options) : {};\n  options.responseType = xhr.ResponseType.BLOB;\n\n  return xhr.send('GET', url, null, options).then(function(request) {\n    return /** @type {!Blob} */ (request.response);\n  });\n};\n\n\n/**\n * Sends a get request, returning a promise that will be resolved with the\n * response as an array of bytes.\n *\n * Supported in all XMLHttpRequest level 2 browsers, as well as IE9. IE8 and\n * earlier are not supported.\n *\n * @param {string} url The URL to request.\n * @param {xhr.Options=} opt_options Configuration options for the request. If\n *     responseType is set, it will be ignored for this request.\n * @return {!goog.Promise<!Uint8Array|!Array<number>>} A promise that will be\n *     resolved with an array of bytes once the request completes.\n */\nxhr.getBytes = function(url, opt_options) {\n  goog.asserts.assert(\n      !userAgent.IE || userAgent.isDocumentModeOrHigher(9),\n      'getBytes is not supported in this browser.');\n\n  var options = opt_options ? goog.object.clone(opt_options) : {};\n  options.responseType = xhr.ResponseType.ARRAYBUFFER;\n\n  return xhr.send('GET', url, null, options).then(function(request) {\n    // Use the ArrayBuffer response in browsers that support XMLHttpRequest2.\n    // This covers nearly all modern browsers: http://caniuse.com/xhr2\n    if (request.response) {\n      return new Uint8Array(/** @type {!ArrayBuffer} */ (request.response));\n    }\n\n    // Fallback for IE9: the response may be accessed as an array of bytes with\n    // the non-standard responseBody property, which can only be accessed as a\n    // VBArray. IE7 and IE8 require significant amounts of VBScript to extract\n    // the bytes.\n    // See: http://stackoverflow.com/questions/1919972/\n    if (goog.global['VBArray']) {\n      return new goog.global['VBArray'](request['responseBody']).toArray();\n    }\n\n    // Nearly all common browsers are covered by the cases above. If downloading\n    // binary files in older browsers is necessary, the MDN article \"Sending and\n    // Receiving Binary Data\" provides techniques that may work with\n    // XMLHttpRequest level 1 browsers: http://goo.gl/7lEuGN\n    throw new xhr.Error(\n        'getBytes is not supported in this browser.', url, request);\n  });\n};\n\n\n/**\n * Sends a post request, returning a promise that will be resolved with\n * the parsed response text once the request completes.\n *\n * @param {string} url The URL to request.\n * @param {xhr.PostData} data The body of the post request.\n * @param {xhr.Options=} opt_options Configuration options for the request.\n * @return {!goog.Promise<Object>} A promise that will be resolved with the\n *     response JSON once the request completes.\n */\nxhr.postJson = function(url, data, opt_options) {\n  return xhr.send('POST', url, data, opt_options).then(function(request) {\n    return xhr.parseJson_(request.responseText, opt_options);\n  });\n};\n\n\n/**\n * Sends a request, returning a promise that will be resolved\n * with the XHR object once the request completes.\n *\n * If content type hasn't been set in opt_options headers, and hasn't been\n * explicitly set to null, default to form-urlencoded/UTF8 for POSTs.\n *\n * @param {string} method The HTTP method for the request.\n * @param {string} url The URL to request.\n * @param {xhr.PostData} data The body of the post request.\n * @param {xhr.Options=} opt_options Configuration options for the request.\n * @return {!goog.Promise<!goog.net.XhrLike.OrNative>} A promise that will be\n *     resolved with the XHR object once the request completes.\n */\nxhr.send = function(method, url, data, opt_options) {\n  var options = opt_options || {};\n  var request = options.xmlHttpFactory ?\n      options.xmlHttpFactory.createInstance() :\n      goog.net.XmlHttp();\n\n  var result = new goog.Promise(/** @suppress {strictPrimitiveOperators} Part of the go/strict_warnings_migration */\n                                function(resolve, reject) {\n    var timer;\n\n    try {\n      request.open(method, url, true);\n    } catch (e) {\n      // XMLHttpRequest.open may throw when 'open' is called, for example, IE7\n      // throws \"Access Denied\" for cross-origin requests.\n      reject(new xhr.Error('Error opening XHR: ' + e.message, url, request));\n    }\n\n    // So sad that IE doesn't support onload and onerror.\n    request.onreadystatechange = function() {\n      if (request.readyState == goog.net.XmlHttp.ReadyState.COMPLETE) {\n        goog.global.clearTimeout(timer);\n        // Note: When developing locally, XHRs to file:// schemes return\n        // a status code of 0. We mark that case as a success too.\n        if (HttpStatus.isSuccess(request.status) ||\n            request.status === 0 && !xhr.isEffectiveSchemeHttp_(url)) {\n          resolve(request);\n        } else {\n          reject(new xhr.HttpError(request.status, url, request));\n        }\n      }\n    };\n    request.onerror = function() {\n      reject(new xhr.Error('Network error', url, request));\n    };\n\n    // Set the headers.\n    var contentType;\n    if (options.headers) {\n      for (var key in options.headers) {\n        var value = options.headers[key];\n        if (value != null) {\n          request.setRequestHeader(key, value);\n        }\n      }\n      contentType = options.headers[xhr.CONTENT_TYPE_HEADER];\n    }\n\n    // Browsers will automatically set the content type to multipart/form-data\n    // when passed a FormData object.\n    var dataIsFormData =\n        (goog.global['FormData'] && (data instanceof goog.global['FormData']));\n    // If a content type hasn't been set, it hasn't been explicitly set to null,\n    // and the data isn't a FormData, default to form-urlencoded/UTF8 for POSTs.\n    // This is because some proxies have been known to reject posts without a\n    // content-type.\n    if (method == 'POST' && contentType === undefined && !dataIsFormData) {\n      request.setRequestHeader(xhr.CONTENT_TYPE_HEADER, xhr.FORM_CONTENT_TYPE);\n    }\n\n    // Set whether to include cookies with cross-domain requests. See:\n    // http://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute\n    if (options.withCredentials) {\n      request.withCredentials = options.withCredentials;\n    }\n\n    // Allows setting an alternative response type, such as an ArrayBuffer. See:\n    // http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-responsetype\n    if (options.responseType) {\n      request.responseType = options.responseType;\n    }\n\n    // Allow the request to override the MIME type of the response. See:\n    // http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-overridemimetype\n    if (options.mimeType) {\n      request.overrideMimeType(options.mimeType);\n    }\n\n    // Handle timeouts, if requested.\n    if (options.timeoutMs > 0) {\n      timer = goog.global.setTimeout(function() {\n        // Clear event listener before aborting so the errback will not be\n        // called twice.\n        request.onreadystatechange = goog.nullFunction;\n        request.abort();\n        reject(new xhr.TimeoutError(url, request));\n      }, options.timeoutMs);\n    }\n\n    // Trigger the send.\n    try {\n      request.send(data);\n    } catch (e) {\n      // XMLHttpRequest.send is known to throw on some versions of FF,\n      // for example if a cross-origin request is disallowed.\n      request.onreadystatechange = goog.nullFunction;\n      goog.global.clearTimeout(timer);\n      reject(new xhr.Error('Error sending XHR: ' + e.message, url, request));\n    }\n  });\n  return result.thenCatch(function(error) {\n    if (error instanceof goog.Promise.CancellationError) {\n      request.abort();\n    }\n    throw error;\n  });\n};\n\n\n/**\n * @param {string} url The URL to test.\n * @return {boolean} Whether the effective scheme is HTTP or HTTPS.\n * @private\n */\nxhr.isEffectiveSchemeHttp_ = function(url) {\n  var scheme = goog.uri.utils.getEffectiveScheme(url);\n  // NOTE(user): Empty-string is for the case under FF3.5 when the location\n  // is not defined inside a web worker.\n  return scheme == 'http' || scheme == 'https' || scheme == '';\n};\n\n/**\n * @param {string} responseText\n * @param {string=} opt_xssiPrefix Prefix used for protecting against XSSI\n *     attacks, which should be removed before parsing the response as JSON.\n * @return {!Object} JSON-parsed value of the original responseText.\n */\nxhr.parseJson = function(responseText, opt_xssiPrefix) {\n  return xhr.parseJson_(responseText, {xssiPrefix: opt_xssiPrefix});\n};\n\n\n/**\n * JSON-parses the given response text, returning an Object.\n *\n * @param {string} responseText Response text.\n * @param {xhr.Options|undefined} options The options object.\n * @return {!Object} The JSON-parsed value of the original responseText.\n * @private\n */\nxhr.parseJson_ = function(responseText, options) {\n  var prefixStrippedResult = responseText;\n  if (options && options.xssiPrefix) {\n    prefixStrippedResult =\n        xhr.stripXssiPrefix_(options.xssiPrefix, prefixStrippedResult);\n  }\n  return /** @type {!Object} */ (JSON.parse(prefixStrippedResult));\n};\n\n\n/**\n * Strips the XSSI prefix from the input string.\n *\n * @param {string} prefix The XSSI prefix.\n * @param {string} string The string to strip the prefix from.\n * @return {string} The input string without the prefix.\n * @private\n */\nxhr.stripXssiPrefix_ = function(prefix, string) {\n  if (goog.string.startsWith(string, prefix)) {\n    string = string.substring(prefix.length);\n  }\n  return string;\n};\n\n\n\n/**\n * Generic error that may occur during a request.\n *\n * @param {string} message The error message.\n * @param {string} url The URL that was being requested.\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\n * @extends {goog.debug.Error}\n * @constructor\n */\nxhr.Error = function(message, url, request) {\n  xhr.Error.base(this, 'constructor', message + ', url=' + url);\n\n  /**\n   * The URL that was requested.\n   * @type {string}\n   */\n  this.url = url;\n\n  /**\n   * The XMLHttpRequest corresponding with the failed request.\n   * @type {!goog.net.XhrLike.OrNative}\n   */\n  this.xhr = request;\n};\ngoog.inherits(xhr.Error, goog.debug.Error);\n\n\n/** @override */\nxhr.Error.prototype.name = 'XhrError';\n\n\n\n/**\n * Class for HTTP errors.\n *\n * @param {number} status The HTTP status code of the response.\n * @param {string} url The URL that was being requested.\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\n * @extends {xhr.Error}\n * @constructor\n * @final\n */\nxhr.HttpError = function(status, url, request) {\n  xhr.HttpError.base(\n      this, 'constructor', 'Request Failed, status=' + status, url, request);\n\n  /**\n   * The HTTP status code for the error.\n   * @type {number}\n   */\n  this.status = status;\n};\ngoog.inherits(xhr.HttpError, xhr.Error);\n\n\n/** @override */\nxhr.HttpError.prototype.name = 'XhrHttpError';\n\n\n\n/**\n * Class for Timeout errors.\n *\n * @param {string} url The URL that timed out.\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\n * @extends {xhr.Error}\n * @constructor\n * @final\n */\nxhr.TimeoutError = function(url, request) {\n  xhr.TimeoutError.base(this, 'constructor', 'Request timed out', url, request);\n};\ngoog.inherits(xhr.TimeoutError, xhr.Error);\n\n\n/** @override */\nxhr.TimeoutError.prototype.name = 'XhrTimeoutError';\n\n});  // goog.scope\n","~:compiled-at",1611607730720,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.labs.net.xhr.js\",\n\"lineCount\":175,\n\"mappings\":\"AAuBAA,IAAA,CAAKC,OAAL,CAAa,mBAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,yBAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,6BAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,2BAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,4BAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,gCAAb,CAAA;AACAD,IAAA,CAAKC,OAAL,CAAa,gCAAb,CAAA;AAEAD,IAAA,CAAKE,OAAL,CAAa,cAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,cAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,kBAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,qBAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,kBAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,aAAb,CAAA;AACAF,IAAA,CAAKE,OAAL,CAAa,aAAb,CAAA;AACAF,IAAA,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AcyC,IAAd,CACI,IADJ,EACU,aADV,EACyB,4BADzB,GACqD3C,MADrD,EAC6DnD,GAD7D,EACkEI,OADlE,CAAA;AAOA,QAAA,CAAK+C,MAAL,GAAcA,MAAd;AAR6C,GAA/C;AAUAxE,MAAA,CAAKoH,QAAL,CAAc/G,GAAd,CAAkBqE,SAAlB,EAA6BrE,GAA7B,CAAiC4C,KAAjC,CAAA;AAIA5C,KAAA,CAAIqE,SAAJ,CAAc4C,SAAd,CAAwBC,IAAxB,GAA+B,cAA/B;AAaAlH,KAAA,CAAIsF,YAAJ,GAAmB8B,QAAQ,CAACpG,GAAD,EAAMI,OAAN,CAAe;AACxCpB,OAAA,CAAIsF,YAAJ,CAAiBwB,IAAjB,CAAsB,IAAtB,EAA4B,aAA5B,EAA2C,mBAA3C,EAAgE9F,GAAhE,EAAqEI,OAArE,CAAA;AADwC,GAA1C;AAGAzB,MAAA,CAAKoH,QAAL,CAAc/G,GAAd,CAAkBsF,YAAlB,EAAgCtF,GAAhC,CAAoC4C,KAApC,CAAA;AAIA5C,KAAA,CAAIsF,YAAJ,CAAiB2B,SAAjB,CAA2BC,IAA3B,GAAkC,iBAAlC;AAldsB,CAAtB,CAAA;;\",\n\"sources\":[\"goog/labs/net/xhr.js\"],\n\"sourcesContent\":[\"// Copyright 2011 The Closure Library Authors. All Rights Reserved.\\n//\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n// you may not use this file except in compliance with the License.\\n// You may obtain a copy of the License at\\n//\\n//      http://www.apache.org/licenses/LICENSE-2.0\\n//\\n// Unless required by applicable law or agreed to in writing, software\\n// distributed under the License is distributed on an \\\"AS-IS\\\" BASIS,\\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n// See the License for the specific language governing permissions and\\n// limitations under the License.\\n\\n\\n/**\\n * @fileoverview Offered as an alternative to XhrIo as a way for making requests\\n * via XMLHttpRequest.  Instead of mirroring the XHR interface and exposing\\n * events, results are used as a way to pass a \\\"promise\\\" of the response to\\n * interested parties.\\n *\\n */\\n\\ngoog.provide('goog.labs.net.xhr');\\ngoog.provide('goog.labs.net.xhr.Error');\\ngoog.provide('goog.labs.net.xhr.HttpError');\\ngoog.provide('goog.labs.net.xhr.Options');\\ngoog.provide('goog.labs.net.xhr.PostData');\\ngoog.provide('goog.labs.net.xhr.ResponseType');\\ngoog.provide('goog.labs.net.xhr.TimeoutError');\\n\\ngoog.require('goog.Promise');\\ngoog.require('goog.asserts');\\ngoog.require('goog.debug.Error');\\ngoog.require('goog.net.HttpStatus');\\ngoog.require('goog.net.XmlHttp');\\ngoog.require('goog.object');\\ngoog.require('goog.string');\\ngoog.require('goog.uri.utils');\\ngoog.require('goog.userAgent');\\n\\n\\n\\ngoog.scope(function() {\\nvar userAgent = goog.userAgent;\\nvar xhr = goog.labs.net.xhr;\\nvar HttpStatus = goog.net.HttpStatus;\\n\\n\\n/**\\n * Configuration options for an XMLHttpRequest.\\n * - headers: map of header key/value pairs.\\n * - timeoutMs: number of milliseconds after which the request will be timed\\n *      out by the client. Default is to allow the browser to handle timeouts.\\n * - withCredentials: whether user credentials are to be included in a\\n *      cross-origin request. See:\\n *      http://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute\\n * - mimeType: allows the caller to override the content-type and charset for\\n *      the request. See:\\n *      http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-overridemimetype\\n * - responseType: may be set to change the response type to an arraybuffer or\\n *      blob for downloading binary data. See:\\n *      http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-responsetype]\\n * - xmlHttpFactory: allows the caller to override the factory used to create\\n *      XMLHttpRequest objects.\\n * - xssiPrefix: Prefix used for protecting against XSSI attacks, which should\\n *      be removed before parsing the response as JSON.\\n *\\n * @typedef {{\\n *   headers: (Object<string>|undefined),\\n *   mimeType: (string|undefined),\\n *   responseType: (xhr.ResponseType|undefined),\\n *   timeoutMs: (number|undefined),\\n *   withCredentials: (boolean|undefined),\\n *   xmlHttpFactory: (goog.net.XmlHttpFactory|undefined),\\n *   xssiPrefix: (string|undefined)\\n * }}\\n */\\nxhr.Options;\\n\\n\\n/**\\n * Defines the types that are allowed as post data.\\n * @typedef {(ArrayBuffer|ArrayBufferView|Blob|Document|FormData|null|string|undefined)}\\n */\\nxhr.PostData;\\n\\n\\n/**\\n * The Content-Type HTTP header name.\\n * @type {string}\\n */\\nxhr.CONTENT_TYPE_HEADER = 'Content-Type';\\n\\n\\n/**\\n * The Content-Type HTTP header value for a url-encoded form.\\n * @type {string}\\n */\\nxhr.FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded;charset=utf-8';\\n\\n\\n/**\\n * Supported data types for the responseType field.\\n * See: http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-response\\n * @enum {string}\\n */\\nxhr.ResponseType = {\\n  ARRAYBUFFER: 'arraybuffer',\\n  BLOB: 'blob',\\n  DOCUMENT: 'document',\\n  JSON: 'json',\\n  TEXT: 'text'\\n};\\n\\n\\n/**\\n * Sends a get request, returning a promise that will be resolved\\n * with the response text once the request completes.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.Options=} opt_options Configuration options for the request.\\n * @return {!goog.Promise<string>} A promise that will be resolved with the\\n *     response text once the request completes.\\n */\\nxhr.get = function(url, opt_options) {\\n  return xhr.send('GET', url, null, opt_options).then(function(request) {\\n    return request.responseText;\\n  });\\n};\\n\\n\\n/**\\n * Sends a post request, returning a promise that will be resolved\\n * with the response text once the request completes.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.PostData} data The body of the post request.\\n * @param {xhr.Options=} opt_options Configuration options for the request.\\n * @return {!goog.Promise<string>} A promise that will be resolved with the\\n *     response text once the request completes.\\n */\\nxhr.post = function(url, data, opt_options) {\\n  return xhr.send('POST', url, data, opt_options).then(function(request) {\\n    return request.responseText;\\n  });\\n};\\n\\n\\n/**\\n * Sends a get request, returning a promise that will be resolved with\\n * the parsed response text once the request completes.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.Options=} opt_options Configuration options for the request.\\n * @return {!goog.Promise<Object>} A promise that will be resolved with the\\n *     response JSON once the request completes.\\n */\\nxhr.getJson = function(url, opt_options) {\\n  return xhr.send('GET', url, null, opt_options).then(function(request) {\\n    return xhr.parseJson_(request.responseText, opt_options);\\n  });\\n};\\n\\n\\n/**\\n * Sends a get request, returning a promise that will be resolved with the\\n * response as a Blob.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.Options=} opt_options Configuration options for the request. If\\n *     responseType is set, it will be ignored for this request.\\n * @return {!goog.Promise<!Blob>} A promise that will be resolved with an\\n *     immutable Blob representing the file once the request completes.\\n */\\nxhr.getBlob = function(url, opt_options) {\\n  goog.asserts.assert(\\n      'Blob' in goog.global, 'getBlob is not supported in this browser.');\\n\\n  var options = opt_options ? goog.object.clone(opt_options) : {};\\n  options.responseType = xhr.ResponseType.BLOB;\\n\\n  return xhr.send('GET', url, null, options).then(function(request) {\\n    return /** @type {!Blob} */ (request.response);\\n  });\\n};\\n\\n\\n/**\\n * Sends a get request, returning a promise that will be resolved with the\\n * response as an array of bytes.\\n *\\n * Supported in all XMLHttpRequest level 2 browsers, as well as IE9. IE8 and\\n * earlier are not supported.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.Options=} opt_options Configuration options for the request. If\\n *     responseType is set, it will be ignored for this request.\\n * @return {!goog.Promise<!Uint8Array|!Array<number>>} A promise that will be\\n *     resolved with an array of bytes once the request completes.\\n */\\nxhr.getBytes = function(url, opt_options) {\\n  goog.asserts.assert(\\n      !userAgent.IE || userAgent.isDocumentModeOrHigher(9),\\n      'getBytes is not supported in this browser.');\\n\\n  var options = opt_options ? goog.object.clone(opt_options) : {};\\n  options.responseType = xhr.ResponseType.ARRAYBUFFER;\\n\\n  return xhr.send('GET', url, null, options).then(function(request) {\\n    // Use the ArrayBuffer response in browsers that support XMLHttpRequest2.\\n    // This covers nearly all modern browsers: http://caniuse.com/xhr2\\n    if (request.response) {\\n      return new Uint8Array(/** @type {!ArrayBuffer} */ (request.response));\\n    }\\n\\n    // Fallback for IE9: the response may be accessed as an array of bytes with\\n    // the non-standard responseBody property, which can only be accessed as a\\n    // VBArray. IE7 and IE8 require significant amounts of VBScript to extract\\n    // the bytes.\\n    // See: http://stackoverflow.com/questions/1919972/\\n    if (goog.global['VBArray']) {\\n      return new goog.global['VBArray'](request['responseBody']).toArray();\\n    }\\n\\n    // Nearly all common browsers are covered by the cases above. If downloading\\n    // binary files in older browsers is necessary, the MDN article \\\"Sending and\\n    // Receiving Binary Data\\\" provides techniques that may work with\\n    // XMLHttpRequest level 1 browsers: http://goo.gl/7lEuGN\\n    throw new xhr.Error(\\n        'getBytes is not supported in this browser.', url, request);\\n  });\\n};\\n\\n\\n/**\\n * Sends a post request, returning a promise that will be resolved with\\n * the parsed response text once the request completes.\\n *\\n * @param {string} url The URL to request.\\n * @param {xhr.PostData} data The body of the post request.\\n * @param {xhr.Options=} opt_options Configuration options for the request.\\n * @return {!goog.Promise<Object>} A promise that will be resolved with the\\n *     response JSON once the request completes.\\n */\\nxhr.postJson = function(url, data, opt_options) {\\n  return xhr.send('POST', url, data, opt_options).then(function(request) {\\n    return xhr.parseJson_(request.responseText, opt_options);\\n  });\\n};\\n\\n\\n/**\\n * Sends a request, returning a promise that will be resolved\\n * with the XHR object once the request completes.\\n *\\n * If content type hasn't been set in opt_options headers, and hasn't been\\n * explicitly set to null, default to form-urlencoded/UTF8 for POSTs.\\n *\\n * @param {string} method The HTTP method for the request.\\n * @param {string} url The URL to request.\\n * @param {xhr.PostData} data The body of the post request.\\n * @param {xhr.Options=} opt_options Configuration options for the request.\\n * @return {!goog.Promise<!goog.net.XhrLike.OrNative>} A promise that will be\\n *     resolved with the XHR object once the request completes.\\n */\\nxhr.send = function(method, url, data, opt_options) {\\n  var options = opt_options || {};\\n  var request = options.xmlHttpFactory ?\\n      options.xmlHttpFactory.createInstance() :\\n      goog.net.XmlHttp();\\n\\n  var result = new goog.Promise(/** @suppress {strictPrimitiveOperators} Part of the go/strict_warnings_migration */\\n                                function(resolve, reject) {\\n    var timer;\\n\\n    try {\\n      request.open(method, url, true);\\n    } catch (e) {\\n      // XMLHttpRequest.open may throw when 'open' is called, for example, IE7\\n      // throws \\\"Access Denied\\\" for cross-origin requests.\\n      reject(new xhr.Error('Error opening XHR: ' + e.message, url, request));\\n    }\\n\\n    // So sad that IE doesn't support onload and onerror.\\n    request.onreadystatechange = function() {\\n      if (request.readyState == goog.net.XmlHttp.ReadyState.COMPLETE) {\\n        goog.global.clearTimeout(timer);\\n        // Note: When developing locally, XHRs to file:// schemes return\\n        // a status code of 0. We mark that case as a success too.\\n        if (HttpStatus.isSuccess(request.status) ||\\n            request.status === 0 && !xhr.isEffectiveSchemeHttp_(url)) {\\n          resolve(request);\\n        } else {\\n          reject(new xhr.HttpError(request.status, url, request));\\n        }\\n      }\\n    };\\n    request.onerror = function() {\\n      reject(new xhr.Error('Network error', url, request));\\n    };\\n\\n    // Set the headers.\\n    var contentType;\\n    if (options.headers) {\\n      for (var key in options.headers) {\\n        var value = options.headers[key];\\n        if (value != null) {\\n          request.setRequestHeader(key, value);\\n        }\\n      }\\n      contentType = options.headers[xhr.CONTENT_TYPE_HEADER];\\n    }\\n\\n    // Browsers will automatically set the content type to multipart/form-data\\n    // when passed a FormData object.\\n    var dataIsFormData =\\n        (goog.global['FormData'] && (data instanceof goog.global['FormData']));\\n    // If a content type hasn't been set, it hasn't been explicitly set to null,\\n    // and the data isn't a FormData, default to form-urlencoded/UTF8 for POSTs.\\n    // This is because some proxies have been known to reject posts without a\\n    // content-type.\\n    if (method == 'POST' && contentType === undefined && !dataIsFormData) {\\n      request.setRequestHeader(xhr.CONTENT_TYPE_HEADER, xhr.FORM_CONTENT_TYPE);\\n    }\\n\\n    // Set whether to include cookies with cross-domain requests. See:\\n    // http://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute\\n    if (options.withCredentials) {\\n      request.withCredentials = options.withCredentials;\\n    }\\n\\n    // Allows setting an alternative response type, such as an ArrayBuffer. See:\\n    // http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-responsetype\\n    if (options.responseType) {\\n      request.responseType = options.responseType;\\n    }\\n\\n    // Allow the request to override the MIME type of the response. See:\\n    // http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-overridemimetype\\n    if (options.mimeType) {\\n      request.overrideMimeType(options.mimeType);\\n    }\\n\\n    // Handle timeouts, if requested.\\n    if (options.timeoutMs > 0) {\\n      timer = goog.global.setTimeout(function() {\\n        // Clear event listener before aborting so the errback will not be\\n        // called twice.\\n        request.onreadystatechange = goog.nullFunction;\\n        request.abort();\\n        reject(new xhr.TimeoutError(url, request));\\n      }, options.timeoutMs);\\n    }\\n\\n    // Trigger the send.\\n    try {\\n      request.send(data);\\n    } catch (e) {\\n      // XMLHttpRequest.send is known to throw on some versions of FF,\\n      // for example if a cross-origin request is disallowed.\\n      request.onreadystatechange = goog.nullFunction;\\n      goog.global.clearTimeout(timer);\\n      reject(new xhr.Error('Error sending XHR: ' + e.message, url, request));\\n    }\\n  });\\n  return result.thenCatch(function(error) {\\n    if (error instanceof goog.Promise.CancellationError) {\\n      request.abort();\\n    }\\n    throw error;\\n  });\\n};\\n\\n\\n/**\\n * @param {string} url The URL to test.\\n * @return {boolean} Whether the effective scheme is HTTP or HTTPS.\\n * @private\\n */\\nxhr.isEffectiveSchemeHttp_ = function(url) {\\n  var scheme = goog.uri.utils.getEffectiveScheme(url);\\n  // NOTE(user): Empty-string is for the case under FF3.5 when the location\\n  // is not defined inside a web worker.\\n  return scheme == 'http' || scheme == 'https' || scheme == '';\\n};\\n\\n/**\\n * @param {string} responseText\\n * @param {string=} opt_xssiPrefix Prefix used for protecting against XSSI\\n *     attacks, which should be removed before parsing the response as JSON.\\n * @return {!Object} JSON-parsed value of the original responseText.\\n */\\nxhr.parseJson = function(responseText, opt_xssiPrefix) {\\n  return xhr.parseJson_(responseText, {xssiPrefix: opt_xssiPrefix});\\n};\\n\\n\\n/**\\n * JSON-parses the given response text, returning an Object.\\n *\\n * @param {string} responseText Response text.\\n * @param {xhr.Options|undefined} options The options object.\\n * @return {!Object} The JSON-parsed value of the original responseText.\\n * @private\\n */\\nxhr.parseJson_ = function(responseText, options) {\\n  var prefixStrippedResult = responseText;\\n  if (options && options.xssiPrefix) {\\n    prefixStrippedResult =\\n        xhr.stripXssiPrefix_(options.xssiPrefix, prefixStrippedResult);\\n  }\\n  return /** @type {!Object} */ (JSON.parse(prefixStrippedResult));\\n};\\n\\n\\n/**\\n * Strips the XSSI prefix from the input string.\\n *\\n * @param {string} prefix The XSSI prefix.\\n * @param {string} string The string to strip the prefix from.\\n * @return {string} The input string without the prefix.\\n * @private\\n */\\nxhr.stripXssiPrefix_ = function(prefix, string) {\\n  if (goog.string.startsWith(string, prefix)) {\\n    string = string.substring(prefix.length);\\n  }\\n  return string;\\n};\\n\\n\\n\\n/**\\n * Generic error that may occur during a request.\\n *\\n * @param {string} message The error message.\\n * @param {string} url The URL that was being requested.\\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\\n * @extends {goog.debug.Error}\\n * @constructor\\n */\\nxhr.Error = function(message, url, request) {\\n  xhr.Error.base(this, 'constructor', message + ', url=' + url);\\n\\n  /**\\n   * The URL that was requested.\\n   * @type {string}\\n   */\\n  this.url = url;\\n\\n  /**\\n   * The XMLHttpRequest corresponding with the failed request.\\n   * @type {!goog.net.XhrLike.OrNative}\\n   */\\n  this.xhr = request;\\n};\\ngoog.inherits(xhr.Error, goog.debug.Error);\\n\\n\\n/** @override */\\nxhr.Error.prototype.name = 'XhrError';\\n\\n\\n\\n/**\\n * Class for HTTP errors.\\n *\\n * @param {number} status The HTTP status code of the response.\\n * @param {string} url The URL that was being requested.\\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\\n * @extends {xhr.Error}\\n * @constructor\\n * @final\\n */\\nxhr.HttpError = function(status, url, request) {\\n  xhr.HttpError.base(\\n      this, 'constructor', 'Request Failed, status=' + status, url, request);\\n\\n  /**\\n   * The HTTP status code for the error.\\n   * @type {number}\\n   */\\n  this.status = status;\\n};\\ngoog.inherits(xhr.HttpError, xhr.Error);\\n\\n\\n/** @override */\\nxhr.HttpError.prototype.name = 'XhrHttpError';\\n\\n\\n\\n/**\\n * Class for Timeout errors.\\n *\\n * @param {string} url The URL that timed out.\\n * @param {!goog.net.XhrLike.OrNative} request The XHR that failed.\\n * @extends {xhr.Error}\\n * @constructor\\n * @final\\n */\\nxhr.TimeoutError = function(url, request) {\\n  xhr.TimeoutError.base(this, 'constructor', 'Request timed out', url, request);\\n};\\ngoog.inherits(xhr.TimeoutError, xhr.Error);\\n\\n\\n/** @override */\\nxhr.TimeoutError.prototype.name = 'XhrTimeoutError';\\n\\n});  // goog.scope\\n\"],\n\"names\":[\"goog\",\"provide\",\"require\",\"scope\",\"userAgent\",\"xhr\",\"labs\",\"net\",\"HttpStatus\",\"Options\",\"PostData\",\"CONTENT_TYPE_HEADER\",\"FORM_CONTENT_TYPE\",\"ResponseType\",\"ARRAYBUFFER\",\"BLOB\",\"DOCUMENT\",\"JSON\",\"TEXT\",\"get\",\"xhr.get\",\"url\",\"opt_options\",\"send\",\"then\",\"request\",\"responseText\",\"post\",\"xhr.post\",\"data\",\"getJson\",\"xhr.getJson\",\"parseJson_\",\"getBlob\",\"xhr.getBlob\",\"asserts\",\"assert\",\"global\",\"options\",\"object\",\"clone\",\"responseType\",\"response\",\"getBytes\",\"xhr.getBytes\",\"IE\",\"isDocumentModeOrHigher\",\"Uint8Array\",\"toArray\",\"Error\",\"postJson\",\"xhr.postJson\",\"xhr.send\",\"method\",\"xmlHttpFactory\",\"createInstance\",\"XmlHttp\",\"result\",\"Promise\",\"resolve\",\"reject\",\"timer\",\"open\",\"e\",\"message\",\"onreadystatechange\",\"request.onreadystatechange\",\"readyState\",\"ReadyState\",\"COMPLETE\",\"clearTimeout\",\"isSuccess\",\"status\",\"isEffectiveSchemeHttp_\",\"HttpError\",\"onerror\",\"request.onerror\",\"contentType\",\"headers\",\"key\",\"value\",\"setRequestHeader\",\"dataIsFormData\",\"undefined\",\"withCredentials\",\"mimeType\",\"overrideMimeType\",\"timeoutMs\",\"setTimeout\",\"nullFunction\",\"abort\",\"TimeoutError\",\"thenCatch\",\"error\",\"CancellationError\",\"xhr.isEffectiveSchemeHttp_\",\"scheme\",\"uri\",\"utils\",\"getEffectiveScheme\",\"parseJson\",\"xhr.parseJson\",\"opt_xssiPrefix\",\"xssiPrefix\",\"xhr.parseJson_\",\"prefixStrippedResult\",\"stripXssiPrefix_\",\"parse\",\"xhr.stripXssiPrefix_\",\"prefix\",\"string\",\"startsWith\",\"substring\",\"length\",\"xhr.Error\",\"base\",\"inherits\",\"debug\",\"prototype\",\"name\",\"xhr.HttpError\",\"xhr.TimeoutError\"]\n}\n"]