"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var a=g(require("react")),b=g(require("prop-types")),c=require("../utils/translate"),d=g(require("./ExtensionsDisplay")),e=require("react-i18next"),f=require("./../contexts/ApiHandler/index.js");function g(a){return a&&a.__esModule?a:{default:a}}var h=function(b){var g=b.flowType,h=b.flow,i=b.securityValue,j=(0,e.useTranslation)(),k=j.t,l=(0,f.useApi)(),m=l.apiHandler,n=m.getCustomExtensions(h);return a["default"].createElement("div",{"data-testid":"security-display-flow"},a["default"].createElement("div",{key:g+"-flow",className:"securityFlow keyValueDisplay"},a["default"].createElement("div",{className:"key"},k("explorer_security_flow")),a["default"].createElement("div",{className:"value"},g)),("implicit"===g||"authorizationCode"===g)&&a["default"].createElement("div",{key:g+"-authUrl",className:"securityAuthUrl keyValueDisplay","data-testid":"implicit-flow"},a["default"].createElement("div",{className:"key"},k("explorer_authorization_url")),a["default"].createElement("div",{className:"value"},Array.isArray(h.authorizationUrl)&&a["default"].createElement("div",{key:"authUrl","data-testid":"authUrls"},h.authorizationUrl.map(function(b){return a["default"].createElement("div",{className:"url"},b)})),!Array.isArray(h.authorizationUrl)&&a["default"].createElement("div",null,h.authorizationUrl))),"implicit"!==g&&a["default"].createElement("div",{key:g+"-tokenUrl",className:"securityTokenUrl keyValueDisplay","data-testid":"non-implicit-flow"},a["default"].createElement("div",{className:"key"},k("explorer_token_url")),a["default"].createElement("div",{className:"value"},Array.isArray(h.tokenUrl)&&a["default"].createElement("div",{"data-testid":"tokenUrls"},h.tokenUrl.map(function(b){return a["default"].createElement("div",{className:"url"},b)})),!Array.isArray(h.tokenUrl)&&a["default"].createElement("div",null,h.tokenUrl))),h.refreshUrl&&0<h.refreshUrl.length&&a["default"].createElement("div",{key:g+"-refreshUrl",className:"securityRefreshUrl keyValueDisplay"},a["default"].createElement("div",{className:"key"},k("explorer_refresh_url")),a["default"].createElement("div",{className:"value"},Array.isArray(h.refreshUrl)&&a["default"].createElement("div",{"data-testid":"refreshUrls"},h.refreshUrl.map(function(b){return a["default"].createElement("div",{className:"url"},b)})),!Array.isArray(h.refreshUrl)&&a["default"].createElement("div",null,h.refreshUrl))),h.scopes&&0<Object.keys(h.scopes).length&&i&&0<i.length&&a["default"].createElement("div",{className:"securityScopes keyValueDisplay"},a["default"].createElement("div",{className:"key"},k("explorer_scopes")),a["default"].createElement("div",{className:"value"},Object.keys(h.scopes).map(function(b){if(-1<b.indexOf("$$")||-1<b.indexOf("x-")||-1===i.indexOf(b))return null;var d=a["default"].createElement("div",{key:b,className:"scope"},b);return h.scopes[b]&&(d=a["default"].createElement("div",{key:b,className:"scope"},b," - ",(0,c.getTranslatedExtensions)(h.scopes,b))),d}))),n&&a["default"].createElement(d["default"],{label:"",className:"securityExtension",extensions:n}))};h.defaultProps={securityValue:[]},h.propTypes={flowType:b["default"].string.isRequired,flow:b["default"].object.isRequired,securityValue:b["default"].array};var i=h;exports["default"]=i;