(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[22],{

/***/ 29:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ssoLogout", function() { return ssoLogout; });
const ssoLogout = async config => {
  const keyPrefix = "".concat(window.location.pathname, "-sso-logout-client");
  let responses = [];

  if (!config.logoutUrls) {
    // response from rp
    responses = JSON.parse(sessionStorage.getItem("".concat(keyPrefix, "-responses"))) || [];
    responses.push(config);
    config = JSON.parse(sessionStorage.getItem("".concat(keyPrefix, "-config")));
  }

  if (config.logoutUrls.length) {
    const logoutUrl = config.logoutUrls.pop();
    sessionStorage.setItem("".concat(keyPrefix, "-config"), JSON.stringify(config));
    sessionStorage.setItem("".concat(keyPrefix, "-responses"), JSON.stringify(responses));
    window.location = logoutUrl;
    return;
  }

  const failures = responses.reduce((failures, response, idx) => {
    var _response$logoutStatu, _response$logoutStatu2;

    if (!String((_response$logoutStatu = response.logoutStatus) === null || _response$logoutStatu === void 0 ? void 0 : (_response$logoutStatu2 = _response$logoutStatu.value) === null || _response$logoutStatu2 === void 0 ? void 0 : _response$logoutStatu2.Code).match(/Success/)) {
      failures.push(response.relyingParty.label);
    }

    return failures;
  }, []);

  if (errors.length) {
    alert('Failed to logout from ' + failures.join(' and ') + '');
  }

  sessionStorage.removeItem("".concat(keyPrefix, "-config"));
  sessionStorage.removeItem("".concat(keyPrefix, "-responses"));
  window.location = config.finalLocation;
};



/***/ })

}]);