Skip to content
Snippets Groups Projects
onDeleteAccount.js 7.54 MiB
Newer Older
  • Learn to ignore specific revisions
  • Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    226001 226002 226003 226004 226005 226006 226007 226008 226009 226010 226011 226012 226013 226014 226015 226016 226017 226018 226019 226020 226021 226022 226023 226024 226025 226026 226027 226028 226029 226030 226031 226032 226033 226034 226035 226036 226037 226038 226039 226040 226041 226042 226043 226044 226045 226046 226047 226048 226049 226050 226051 226052 226053 226054 226055 226056 226057 226058 226059 226060 226061 226062 226063 226064 226065 226066 226067 226068 226069 226070 226071 226072 226073 226074 226075 226076 226077 226078 226079 226080 226081 226082 226083 226084 226085 226086 226087 226088 226089 226090 226091 226092 226093 226094 226095 226096 226097 226098 226099 226100 226101 226102 226103 226104 226105 226106 226107 226108 226109 226110 226111 226112 226113 226114 226115 226116 226117 226118 226119 226120 226121 226122 226123 226124 226125 226126 226127 226128 226129 226130 226131 226132 226133 226134 226135 226136 226137 226138 226139 226140 226141 226142 226143 226144 226145 226146 226147 226148 226149 226150 226151 226152 226153 226154 226155 226156 226157 226158 226159 226160 226161 226162 226163 226164 226165 226166 226167 226168 226169 226170 226171 226172 226173 226174 226175 226176 226177 226178 226179 226180 226181 226182 226183 226184 226185 226186 226187 226188 226189 226190 226191 226192 226193 226194 226195 226196 226197 226198 226199 226200 226201 226202 226203 226204 226205 226206 226207 226208 226209 226210 226211 226212 226213 226214 226215 226216 226217 226218 226219 226220 226221 226222 226223 226224 226225 226226 226227 226228 226229 226230 226231 226232 226233 226234 226235 226236 226237 226238 226239 226240 226241 226242 226243 226244 226245 226246 226247 226248 226249 226250 226251 226252 226253 226254 226255 226256 226257 226258 226259 226260 226261 226262 226263 226264 226265 226266 226267 226268 226269 226270 226271 226272 226273 226274 226275 226276 226277 226278 226279 226280 226281 226282 226283 226284 226285 226286 226287 226288 226289 226290 226291 226292 226293 226294 226295 226296 226297 226298 226299 226300 226301 226302 226303 226304 226305 226306 226307 226308 226309 226310 226311 226312 226313 226314 226315 226316 226317 226318 226319 226320 226321 226322 226323 226324 226325 226326 226327 226328 226329 226330 226331 226332 226333 226334 226335 226336 226337 226338 226339 226340 226341 226342 226343 226344 226345 226346 226347 226348 226349 226350 226351 226352 226353 226354 226355 226356 226357 226358 226359 226360 226361 226362 226363 226364 226365 226366 226367 226368 226369 226370 226371 226372 226373 226374 226375 226376 226377 226378 226379 226380 226381 226382 226383 226384 226385 226386 226387 226388 226389 226390 226391 226392 226393 226394 226395 226396 226397 226398 226399 226400 226401 226402 226403 226404 226405 226406 226407 226408 226409 226410 226411 226412 226413 226414 226415 226416 226417 226418 226419 226420 226421 226422 226423 226424 226425 226426 226427 226428 226429 226430 226431 226432 226433 226434 226435 226436 226437 226438 226439 226440 226441 226442 226443 226444 226445 226446 226447 226448 226449 226450 226451 226452 226453 226454 226455 226456 226457 226458 226459 226460 226461 226462 226463 226464 226465 226466 226467 226468 226469 226470 226471 226472 226473 226474 226475 226476 226477 226478 226479 226480 226481 226482 226483 226484 226485 226486 226487 226488 226489 226490 226491 226492 226493 226494 226495 226496 226497 226498 226499 226500 226501 226502 226503 226504 226505 226506 226507 226508 226509 226510 226511 226512 226513 226514 226515 226516 226517 226518 226519 226520 226521 226522 226523 226524 226525 226526 226527 226528 226529 226530 226531 226532 226533 226534 226535 226536 226537 226538 226539 226540 226541 226542 226543 226544 226545 226546 226547 226548 226549 226550 226551 226552 226553 226554 226555 226556 226557 226558 226559 226560 226561 226562 226563 226564 226565 226566 226567 226568 226569 226570 226571 226572 226573 226574 226575 226576 226577 226578 226579 226580 226581 226582 226583 226584 226585 226586 226587 226588 226589 226590 226591 226592 226593 226594 226595 226596 226597 226598 226599 226600 226601 226602 226603 226604 226605 226606 226607 226608 226609 226610 226611 226612 226613 226614 226615 226616 226617 226618 226619 226620 226621 226622 226623 226624 226625 226626 226627 226628 226629 226630 226631 226632 226633 226634 226635 226636 226637 226638 226639 226640 226641 226642 226643 226644 226645 226646 226647 226648 226649 226650 226651 226652 226653 226654 226655 226656 226657 226658 226659 226660 226661 226662 226663 226664 226665 226666 226667 226668 226669 226670 226671 226672 226673 226674 226675 226676 226677 226678 226679 226680 226681 226682 226683 226684 226685 226686 226687 226688 226689 226690 226691 226692 226693 226694 226695 226696 226697 226698 226699 226700 226701 226702 226703 226704 226705 226706 226707 226708 226709 226710 226711 226712 226713 226714 226715 226716 226717 226718 226719 226720 226721 226722 226723 226724 226725 226726 226727 226728 226729 226730 226731 226732 226733 226734 226735 226736 226737 226738 226739 226740 226741 226742 226743 226744 226745 226746 226747 226748 226749 226750 226751 226752 226753 226754 226755 226756 226757 226758 226759 226760 226761 226762 226763 226764 226765 226766 226767 226768 226769 226770 226771 226772 226773 226774 226775 226776 226777 226778 226779 226780 226781 226782 226783 226784 226785 226786 226787 226788 226789 226790 226791 226792 226793 226794 226795 226796 226797 226798 226799 226800 226801 226802 226803 226804 226805 226806 226807 226808 226809 226810 226811 226812 226813 226814 226815 226816 226817 226818 226819 226820 226821 226822 226823 226824 226825 226826 226827 226828 226829 226830 226831 226832 226833 226834 226835 226836 226837 226838 226839 226840 226841 226842 226843 226844 226845 226846 226847 226848 226849 226850 226851 226852 226853 226854 226855 226856 226857 226858 226859 226860 226861 226862 226863 226864 226865 226866 226867 226868 226869 226870 226871 226872 226873 226874 226875 226876 226877 226878 226879 226880 226881 226882 226883 226884 226885 226886 226887 226888 226889 226890 226891 226892 226893 226894 226895 226896 226897 226898 226899 226900 226901 226902 226903 226904 226905 226906 226907 226908 226909 226910 226911 226912 226913 226914 226915 226916 226917 226918 226919 226920 226921 226922 226923 226924 226925 226926 226927 226928 226929 226930 226931 226932 226933 226934 226935 226936 226937 226938 226939 226940 226941 226942 226943 226944 226945 226946 226947 226948 226949 226950 226951 226952 226953 226954 226955 226956 226957 226958 226959 226960 226961 226962 226963 226964 226965 226966 226967 226968 226969 226970 226971 226972 226973 226974 226975 226976 226977 226978 226979 226980 226981 226982 226983 226984 226985 226986 226987 226988 226989 226990 226991 226992 226993 226994 226995 226996 226997 226998 226999 227000
        options.headers = {};
      }
    
      // Since http.request treats host as an alias of hostname,
      // but the url module interprets host as hostname plus port,
      // eliminate the host property to avoid confusion.
      if (options.host) {
        // Use hostname if set, because it has precedence
        if (!options.hostname) {
          options.hostname = options.host;
        }
        delete options.host;
      }
    
      // Complete the URL object when necessary
      if (!options.pathname && options.path) {
        var searchPos = options.path.indexOf("?");
        if (searchPos < 0) {
          options.pathname = options.path;
        }
        else {
          options.pathname = options.path.substring(0, searchPos);
          options.search = options.path.substring(searchPos);
        }
      }
    };
    
    
    // Executes the next native request (initial or redirect)
    RedirectableRequest.prototype._performRequest = function () {
      // Load the native protocol
      var protocol = this._options.protocol;
      var nativeProtocol = this._options.nativeProtocols[protocol];
      if (!nativeProtocol) {
        this.emit("error", new TypeError("Unsupported protocol " + protocol));
        return;
      }
    
      // If specified, use the agent corresponding to the protocol
      // (HTTP and HTTPS use different types of agents)
      if (this._options.agents) {
        var scheme = protocol.slice(0, -1);
        this._options.agent = this._options.agents[scheme];
      }
    
      // Create the native request and set up its event handlers
      var request = this._currentRequest =
            nativeProtocol.request(this._options, this._onNativeResponse);
      request._redirectable = this;
      for (var event of events) {
        request.on(event, eventHandlers[event]);
      }
    
      // RFC7230§5.3.1: When making a request directly to an origin server, […]
      // a client MUST send only the absolute path […] as the request-target.
      this._currentUrl = /^\//.test(this._options.path) ?
        url.format(this._options) :
        // When making a request to a proxy, […]
        // a client MUST send the target URI in absolute-form […].
        this._currentUrl = this._options.path;
    
      // End a redirected request
      // (The first request must be ended explicitly with RedirectableRequest#end)
      if (this._isRedirect) {
        // Write the request entity and end
        var i = 0;
        var self = this;
        var buffers = this._requestBodyBuffers;
        (function writeNext(error) {
          // Only write if this request has not been redirected yet
          /* istanbul ignore else */
          if (request === self._currentRequest) {
            // Report any write errors
            /* istanbul ignore if */
            if (error) {
              self.emit("error", error);
            }
            // Write the next buffer if there are still left
            else if (i < buffers.length) {
              var buffer = buffers[i++];
              /* istanbul ignore else */
              if (!request.finished) {
                request.write(buffer.data, buffer.encoding, writeNext);
              }
            }
            // End the request if `end` has been called on us
            else if (self._ended) {
              request.end();
            }
          }
        }());
      }
    };
    
    // Processes a response from the current native request
    RedirectableRequest.prototype._processResponse = function (response) {
      // Store the redirected response
      var statusCode = response.statusCode;
      if (this._options.trackRedirects) {
        this._redirects.push({
          url: this._currentUrl,
          headers: response.headers,
          statusCode: statusCode,
        });
      }
    
      // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
      // that further action needs to be taken by the user agent in order to
      // fulfill the request. If a Location header field is provided,
      // the user agent MAY automatically redirect its request to the URI
      // referenced by the Location field value,
      // even if the specific status code is not understood.
    
      // If the response is not a redirect; return it as-is
      var location = response.headers.location;
      if (!location || this._options.followRedirects === false ||
          statusCode < 300 || statusCode >= 400) {
        response.responseUrl = this._currentUrl;
        response.redirects = this._redirects;
        this.emit("response", response);
    
        // Clean up
        this._requestBodyBuffers = [];
        return;
      }
    
      // The response is a redirect, so abort the current request
      abortRequest(this._currentRequest);
      // Discard the remainder of the response to avoid waiting for data
      response.destroy();
    
      // RFC7231§6.4: A client SHOULD detect and intervene
      // in cyclical redirections (i.e., "infinite" redirection loops).
      if (++this._redirectCount > this._options.maxRedirects) {
        this.emit("error", new TooManyRedirectsError());
        return;
      }
    
      // Store the request headers if applicable
      var requestHeaders;
      var beforeRedirect = this._options.beforeRedirect;
      if (beforeRedirect) {
        requestHeaders = Object.assign({
          // The Host header was set by nativeProtocol.request
          Host: response.req.getHeader("host"),
        }, this._options.headers);
      }
    
      // RFC7231§6.4: Automatic redirection needs to done with
      // care for methods not known to be safe, […]
      // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
      // the request method from POST to GET for the subsequent request.
      var method = this._options.method;
      if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
          // RFC7231§6.4.4: The 303 (See Other) status code indicates that
          // the server is redirecting the user agent to a different resource […]
          // A user agent can perform a retrieval request targeting that URI
          // (a GET or HEAD request if using HTTP) […]
          (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
        this._options.method = "GET";
        // Drop a possible entity and headers related to it
        this._requestBodyBuffers = [];
        removeMatchingHeaders(/^content-/i, this._options.headers);
      }
    
      // Drop the Host header, as the redirect might lead to a different host
      var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
    
      // If the redirect is relative, carry over the host of the last request
      var currentUrlParts = url.parse(this._currentUrl);
      var currentHost = currentHostHeader || currentUrlParts.host;
      var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
        url.format(Object.assign(currentUrlParts, { host: currentHost }));
    
      // Determine the URL of the redirection
      var redirectUrl;
      try {
        redirectUrl = url.resolve(currentUrl, location);
      }
      catch (cause) {
        this.emit("error", new RedirectionError(cause));
        return;
      }
    
      // Create the redirected request
      debug("redirecting to", redirectUrl);
      this._isRedirect = true;
      var redirectUrlParts = url.parse(redirectUrl);
      Object.assign(this._options, redirectUrlParts);
    
      // Drop confidential headers when redirecting to a less secure protocol
      // or to a different domain that is not a superdomain
      if (redirectUrlParts.protocol !== currentUrlParts.protocol &&
         redirectUrlParts.protocol !== "https:" ||
         redirectUrlParts.host !== currentHost &&
         !isSubdomain(redirectUrlParts.host, currentHost)) {
        removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
      }
    
      // Evaluate the beforeRedirect callback
      if (typeof beforeRedirect === "function") {
        var responseDetails = {
          headers: response.headers,
          statusCode: statusCode,
        };
        var requestDetails = {
          url: currentUrl,
          method: method,
          headers: requestHeaders,
        };
        try {
          beforeRedirect(this._options, responseDetails, requestDetails);
        }
        catch (err) {
          this.emit("error", err);
          return;
        }
        this._sanitizeOptions(this._options);
      }
    
      // Perform the redirected request
      try {
        this._performRequest();
      }
      catch (cause) {
        this.emit("error", new RedirectionError(cause));
      }
    };
    
    // Wraps the key/value object of protocols with redirect functionality
    function wrap(protocols) {
      // Default settings
      var exports = {
        maxRedirects: 21,
        maxBodyLength: 10 * 1024 * 1024,
      };
    
      // Wrap each protocol
      var nativeProtocols = {};
      Object.keys(protocols).forEach(function (scheme) {
        var protocol = scheme + ":";
        var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
        var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
    
        // Executes a request, following redirects
        function request(input, options, callback) {
          // Parse parameters
          if (typeof input === "string") {
            var urlStr = input;
            try {
              input = urlToOptions(new URL(urlStr));
            }
            catch (err) {
              /* istanbul ignore next */
              input = url.parse(urlStr);
            }
          }
          else if (URL && (input instanceof URL)) {
            input = urlToOptions(input);
          }
          else {
            callback = options;
            options = input;
            input = { protocol: protocol };
          }
          if (typeof options === "function") {
            callback = options;
            options = null;
          }
    
          // Set defaults
          options = Object.assign({
            maxRedirects: exports.maxRedirects,
            maxBodyLength: exports.maxBodyLength,
          }, input, options);
          options.nativeProtocols = nativeProtocols;
    
          assert.equal(options.protocol, protocol, "protocol mismatch");
          debug("options", options);
          return new RedirectableRequest(options, callback);
        }
    
        // Executes a GET request, following redirects
        function get(input, options, callback) {
          var wrappedRequest = wrappedProtocol.request(input, options, callback);
          wrappedRequest.end();
          return wrappedRequest;
        }
    
        // Expose the properties on the wrapped protocol
        Object.defineProperties(wrappedProtocol, {
          request: { value: request, configurable: true, enumerable: true, writable: true },
          get: { value: get, configurable: true, enumerable: true, writable: true },
        });
      });
      return exports;
    }
    
    /* istanbul ignore next */
    function noop() { /* empty */ }
    
    // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
    function urlToOptions(urlObject) {
      var options = {
        protocol: urlObject.protocol,
        hostname: urlObject.hostname.startsWith("[") ?
          /* istanbul ignore next */
          urlObject.hostname.slice(1, -1) :
          urlObject.hostname,
        hash: urlObject.hash,
        search: urlObject.search,
        pathname: urlObject.pathname,
        path: urlObject.pathname + urlObject.search,
        href: urlObject.href,
      };
      if (urlObject.port !== "") {
        options.port = Number(urlObject.port);
      }
      return options;
    }
    
    function removeMatchingHeaders(regex, headers) {
      var lastValue;
      for (var header in headers) {
        if (regex.test(header)) {
          lastValue = headers[header];
          delete headers[header];
        }
      }
      return (lastValue === null || typeof lastValue === "undefined") ?
        undefined : String(lastValue).trim();
    }
    
    function createErrorType(code, defaultMessage) {
      function CustomError(cause) {
        Error.captureStackTrace(this, this.constructor);
        if (!cause) {
          this.message = defaultMessage;
        }
        else {
          this.message = defaultMessage + ": " + cause.message;
          this.cause = cause;
        }
      }
      CustomError.prototype = new Error();
      CustomError.prototype.constructor = CustomError;
      CustomError.prototype.name = "Error [" + code + "]";
      CustomError.prototype.code = code;
      return CustomError;
    }
    
    function abortRequest(request) {
      for (var event of events) {
        request.removeListener(event, eventHandlers[event]);
      }
      request.on("error", noop);
      request.abort();
    }
    
    function isSubdomain(subdomain, domain) {
      const dot = subdomain.length - domain.length - 1;
      return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
    }
    
    // Exports
    module.exports = wrap({ http: http, https: https });
    module.exports.wrap = wrap;
    
    
    /***/ }),
    /* 1584 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    var debug;
    
    module.exports = function () {
      if (!debug) {
        try {
          /* eslint global-require: off */
          debug = __webpack_require__(1358)("follow-redirects");
        }
        catch (error) { /* */ }
        if (typeof debug !== "function") {
          debug = function () { /* */ };
        }
      }
      debug.apply(null, arguments);
    };
    
    
    /***/ }),
    /* 1585 */
    /***/ ((module) => {
    
    module.exports = {
      "version": "0.27.2"
    };
    
    /***/ }),
    /* 1586 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    // eslint-disable-next-line strict
    module.exports = __webpack_require__(1587);
    
    
    /***/ }),
    /* 1587 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    var CombinedStream = __webpack_require__(147);
    var util = __webpack_require__(64);
    var path = __webpack_require__(142);
    var http = __webpack_require__(80);
    var https = __webpack_require__(81);
    var parseUrl = (__webpack_require__(63).parse);
    var fs = __webpack_require__(149);
    var Stream = (__webpack_require__(82).Stream);
    var mime = __webpack_require__(139);
    var asynckit = __webpack_require__(150);
    var populate = __webpack_require__(1588);
    
    // Public API
    module.exports = FormData;
    
    // make it a Stream
    util.inherits(FormData, CombinedStream);
    
    /**
     * Create readable "multipart/form-data" streams.
     * Can be used to submit forms
     * and file uploads to other web applications.
     *
     * @constructor
     * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
     */
    function FormData(options) {
      if (!(this instanceof FormData)) {
        return new FormData(options);
      }
    
      this._overheadLength = 0;
      this._valueLength = 0;
      this._valuesToMeasure = [];
    
      CombinedStream.call(this);
    
      options = options || {};
      for (var option in options) {
        this[option] = options[option];
      }
    }
    
    FormData.LINE_BREAK = '\r\n';
    FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
    
    FormData.prototype.append = function(field, value, options) {
    
      options = options || {};
    
      // allow filename as single option
      if (typeof options == 'string') {
        options = {filename: options};
      }
    
      var append = CombinedStream.prototype.append.bind(this);
    
      // all that streamy business can't handle numbers
      if (typeof value == 'number') {
        value = '' + value;
      }
    
      // https://github.com/felixge/node-form-data/issues/38
      if (util.isArray(value)) {
        // Please convert your array into string
        // the way web server expects it
        this._error(new Error('Arrays are not supported.'));
        return;
      }
    
      var header = this._multiPartHeader(field, value, options);
      var footer = this._multiPartFooter();
    
      append(header);
      append(value);
      append(footer);
    
      // pass along options.knownLength
      this._trackLength(header, value, options);
    };
    
    FormData.prototype._trackLength = function(header, value, options) {
      var valueLength = 0;
    
      // used w/ getLengthSync(), when length is known.
      // e.g. for streaming directly from a remote server,
      // w/ a known file a size, and not wanting to wait for
      // incoming file to finish to get its size.
      if (options.knownLength != null) {
        valueLength += +options.knownLength;
      } else if (Buffer.isBuffer(value)) {
        valueLength = value.length;
      } else if (typeof value === 'string') {
        valueLength = Buffer.byteLength(value);
      }
    
      this._valueLength += valueLength;
    
      // @check why add CRLF? does this account for custom/multiple CRLFs?
      this._overheadLength +=
        Buffer.byteLength(header) +
        FormData.LINE_BREAK.length;
    
      // empty or either doesn't have path or not an http response or not a stream
      if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) {
        return;
      }
    
      // no need to bother with the length
      if (!options.knownLength) {
        this._valuesToMeasure.push(value);
      }
    };
    
    FormData.prototype._lengthRetriever = function(value, callback) {
    
      if (value.hasOwnProperty('fd')) {
    
        // take read range into a account
        // `end` = Infinity –> read file till the end
        //
        // TODO: Looks like there is bug in Node fs.createReadStream
        // it doesn't respect `end` options without `start` options
        // Fix it when node fixes it.
        // https://github.com/joyent/node/issues/7819
        if (value.end != undefined && value.end != Infinity && value.start != undefined) {
    
          // when end specified
          // no need to calculate range
          // inclusive, starts with 0
          callback(null, value.end + 1 - (value.start ? value.start : 0));
    
        // not that fast snoopy
        } else {
          // still need to fetch file size from fs
          fs.stat(value.path, function(err, stat) {
    
            var fileSize;
    
            if (err) {
              callback(err);
              return;
            }
    
            // update final size based on the range options
            fileSize = stat.size - (value.start ? value.start : 0);
            callback(null, fileSize);
          });
        }
    
      // or http response
      } else if (value.hasOwnProperty('httpVersion')) {
        callback(null, +value.headers['content-length']);
    
      // or request stream http://github.com/mikeal/request
      } else if (value.hasOwnProperty('httpModule')) {
        // wait till response come back
        value.on('response', function(response) {
          value.pause();
          callback(null, +response.headers['content-length']);
        });
        value.resume();
    
      // something else
      } else {
        callback('Unknown stream');
      }
    };
    
    FormData.prototype._multiPartHeader = function(field, value, options) {
      // custom header specified (as string)?
      // it becomes responsible for boundary
      // (e.g. to handle extra CRLFs on .NET servers)
      if (typeof options.header == 'string') {
        return options.header;
      }
    
      var contentDisposition = this._getContentDisposition(value, options);
      var contentType = this._getContentType(value, options);
    
      var contents = '';
      var headers  = {
        // add custom disposition as third element or keep it two elements if not
        'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
        // if no content type. allow it to be empty array
        'Content-Type': [].concat(contentType || [])
      };
    
      // allow custom headers.
      if (typeof options.header == 'object') {
        populate(headers, options.header);
      }
    
      var header;
      for (var prop in headers) {
        if (!headers.hasOwnProperty(prop)) continue;
        header = headers[prop];
    
        // skip nullish headers.
        if (header == null) {
          continue;
        }
    
        // convert all headers to arrays.
        if (!Array.isArray(header)) {
          header = [header];
        }
    
        // add non-empty headers.
        if (header.length) {
          contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
        }
      }
    
      return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
    };
    
    FormData.prototype._getContentDisposition = function(value, options) {
    
      var filename
        , contentDisposition
        ;
    
      if (typeof options.filepath === 'string') {
        // custom filepath for relative paths
        filename = path.normalize(options.filepath).replace(/\\/g, '/');
      } else if (options.filename || value.name || value.path) {
        // custom filename take precedence
        // formidable and the browser add a name property
        // fs- and request- streams have path property
        filename = path.basename(options.filename || value.name || value.path);
      } else if (value.readable && value.hasOwnProperty('httpVersion')) {
        // or try http response
        filename = path.basename(value.client._httpMessage.path || '');
      }
    
      if (filename) {
        contentDisposition = 'filename="' + filename + '"';
      }
    
      return contentDisposition;
    };
    
    FormData.prototype._getContentType = function(value, options) {
    
      // use custom content-type above all
      var contentType = options.contentType;
    
      // or try `name` from formidable, browser
      if (!contentType && value.name) {
        contentType = mime.lookup(value.name);
      }
    
      // or try `path` from fs-, request- streams
      if (!contentType && value.path) {
        contentType = mime.lookup(value.path);
      }
    
      // or if it's http-reponse
      if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
        contentType = value.headers['content-type'];
      }
    
      // or guess it from the filepath or filename
      if (!contentType && (options.filepath || options.filename)) {
        contentType = mime.lookup(options.filepath || options.filename);
      }
    
      // fallback to the default content type if `value` is not simple value
      if (!contentType && typeof value == 'object') {
        contentType = FormData.DEFAULT_CONTENT_TYPE;
      }
    
      return contentType;
    };
    
    FormData.prototype._multiPartFooter = function() {
      return function(next) {
        var footer = FormData.LINE_BREAK;
    
        var lastPart = (this._streams.length === 0);
        if (lastPart) {
          footer += this._lastBoundary();
        }
    
        next(footer);
      }.bind(this);
    };
    
    FormData.prototype._lastBoundary = function() {
      return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
    };
    
    FormData.prototype.getHeaders = function(userHeaders) {
      var header;
      var formHeaders = {
        'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
      };
    
      for (header in userHeaders) {
        if (userHeaders.hasOwnProperty(header)) {
          formHeaders[header.toLowerCase()] = userHeaders[header];
        }
      }
    
      return formHeaders;
    };
    
    FormData.prototype.setBoundary = function(boundary) {
      this._boundary = boundary;
    };
    
    FormData.prototype.getBoundary = function() {
      if (!this._boundary) {
        this._generateBoundary();
      }
    
      return this._boundary;
    };
    
    FormData.prototype.getBuffer = function() {
      var dataBuffer = new Buffer.alloc( 0 );
      var boundary = this.getBoundary();
    
      // Create the form content. Add Line breaks to the end of data.
      for (var i = 0, len = this._streams.length; i < len; i++) {
        if (typeof this._streams[i] !== 'function') {
    
          // Add content to the buffer.
          if(Buffer.isBuffer(this._streams[i])) {
            dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
          }else {
            dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
          }
    
          // Add break after content.
          if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
            dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
          }
        }
      }
    
      // Add the footer and return the Buffer object.
      return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
    };
    
    FormData.prototype._generateBoundary = function() {
      // This generates a 50 character boundary similar to those used by Firefox.
      // They are optimized for boyer-moore parsing.
      var boundary = '--------------------------';
      for (var i = 0; i < 24; i++) {
        boundary += Math.floor(Math.random() * 10).toString(16);
      }
    
      this._boundary = boundary;
    };
    
    // Note: getLengthSync DOESN'T calculate streams length
    // As workaround one can calculate file size manually
    // and add it as knownLength option
    FormData.prototype.getLengthSync = function() {
      var knownLength = this._overheadLength + this._valueLength;
    
      // Don't get confused, there are 3 "internal" streams for each keyval pair
      // so it basically checks if there is any value added to the form
      if (this._streams.length) {
        knownLength += this._lastBoundary().length;
      }
    
      // https://github.com/form-data/form-data/issues/40
      if (!this.hasKnownLength()) {
        // Some async length retrievers are present
        // therefore synchronous length calculation is false.
        // Please use getLength(callback) to get proper length
        this._error(new Error('Cannot calculate proper length in synchronous way.'));
      }
    
      return knownLength;
    };
    
    // Public API to check if length of added values is known
    // https://github.com/form-data/form-data/issues/196
    // https://github.com/form-data/form-data/issues/262
    FormData.prototype.hasKnownLength = function() {
      var hasKnownLength = true;
    
      if (this._valuesToMeasure.length) {
        hasKnownLength = false;
      }
    
      return hasKnownLength;
    };
    
    FormData.prototype.getLength = function(cb) {
      var knownLength = this._overheadLength + this._valueLength;
    
      if (this._streams.length) {
        knownLength += this._lastBoundary().length;
      }
    
      if (!this._valuesToMeasure.length) {
        process.nextTick(cb.bind(this, null, knownLength));
        return;
      }
    
      asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
        if (err) {
          cb(err);
          return;
        }
    
        values.forEach(function(length) {
          knownLength += length;
        });
    
        cb(null, knownLength);
      });
    };
    
    FormData.prototype.submit = function(params, cb) {
      var request
        , options
        , defaults = {method: 'post'}
        ;
    
      // parse provided url if it's string
      // or treat it as options object
      if (typeof params == 'string') {
    
        params = parseUrl(params);
        options = populate({
          port: params.port,
          path: params.pathname,
          host: params.hostname,
          protocol: params.protocol
        }, defaults);
    
      // use custom params
      } else {
    
        options = populate(params, defaults);
        // if no port provided use default one
        if (!options.port) {
          options.port = options.protocol == 'https:' ? 443 : 80;
        }
      }
    
      // put that good code in getHeaders to some use
      options.headers = this.getHeaders(params.headers);
    
      // https if specified, fallback to http in any other case
      if (options.protocol == 'https:') {
        request = https.request(options);
      } else {
        request = http.request(options);
      }
    
      // get content length and fire away
      this.getLength(function(err, length) {
        if (err && err !== 'Unknown stream') {
          this._error(err);
          return;
        }
    
        // add content length
        if (length) {
          request.setHeader('Content-Length', length);
        }
    
        this.pipe(request);
        if (cb) {
          var onResponse;
    
          var callback = function (error, responce) {
            request.removeListener('error', callback);
            request.removeListener('response', onResponse);
    
            return cb.call(this, error, responce);
          };
    
          onResponse = callback.bind(this, null);
    
          request.on('error', callback);
          request.on('response', onResponse);
        }
      }.bind(this));
    
      return request;
    };
    
    FormData.prototype._error = function(err) {
      if (!this.error) {
        this.error = err;
        this.pause();
        this.emit('error', err);
      }
    };
    
    FormData.prototype.toString = function () {
      return '[object FormData]';
    };
    
    
    /***/ }),
    /* 1588 */
    /***/ ((module) => {
    
    // populates missing values
    module.exports = function(dst, src) {
    
      Object.keys(src).forEach(function(prop)
      {
        dst[prop] = dst[prop] || src[prop];
      });
    
      return dst;
    };
    
    
    /***/ }),
    /* 1589 */
    /***/ ((module) => {
    
    "use strict";
    
    
    module.exports = function isCancel(value) {
      return !!(value && value.__CANCEL__);
    };
    
    
    /***/ }),
    /* 1590 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    "use strict";
    
    
    var utils = __webpack_require__(1560);
    
    /**
     * Config-specific merge-function which creates a new config-object
     * by merging two configuration objects together.
     *
     * @param {Object} config1
     * @param {Object} config2
     * @returns {Object} New object resulting from merging config2 to config1
     */
    module.exports = function mergeConfig(config1, config2) {
      // eslint-disable-next-line no-param-reassign
      config2 = config2 || {};
      var config = {};
    
      function getMergedValue(target, source) {
        if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
          return utils.merge(target, source);
        } else if (utils.isPlainObject(source)) {
          return utils.merge({}, source);
        } else if (utils.isArray(source)) {
          return source.slice();
        }
        return source;
      }
    
      // eslint-disable-next-line consistent-return
      function mergeDeepProperties(prop) {
        if (!utils.isUndefined(config2[prop])) {
          return getMergedValue(config1[prop], config2[prop]);
        } else if (!utils.isUndefined(config1[prop])) {
          return getMergedValue(undefined, config1[prop]);
        }
      }
    
      // eslint-disable-next-line consistent-return
      function valueFromConfig2(prop) {
        if (!utils.isUndefined(config2[prop])) {
          return getMergedValue(undefined, config2[prop]);
        }
      }
    
      // eslint-disable-next-line consistent-return
      function defaultToConfig2(prop) {
        if (!utils.isUndefined(config2[prop])) {
          return getMergedValue(undefined, config2[prop]);
        } else if (!utils.isUndefined(config1[prop])) {
          return getMergedValue(undefined, config1[prop]);
        }
      }
    
      // eslint-disable-next-line consistent-return