"use strict";function a(b){"@babel/helpers - typeof";return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.TestToolRedirectUri=void 0;var b=h(require("react")),c=require("react-i18next"),d=require("carbon-components-react"),e=f(require("lodash/isEqual"));function f(a){return a&&a.__esModule?a:{default:a}}function g(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(g=function(a){return a?c:b})(a)}function h(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!==a(b)&&"function"!=typeof b)return{default:b};var d=g(c);if(d&&d.has(b))return d.get(b);var e={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in b)if("default"!=h&&Object.prototype.hasOwnProperty.call(b,h)){var i=f?Object.getOwnPropertyDescriptor(b,h):null;i&&(i.get||i.set)?Object.defineProperty(e,h,i):e[h]=b[h]}return e["default"]=b,d&&d.set(b,e),e}function i(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function j(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function k(a,b,c){return b&&j(a.prototype,b),c&&j(a,c),a}function l(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&m(a,b)}function m(a,b){return m=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},m(a,b)}function n(a){var b=q();return function(){var c,d=r(a);if(b){var e=r(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return o(this,c)}}function o(b,c){if(c&&("object"===a(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return p(b)}function p(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function r(a){return r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},r(a)}var s=function(a){function c(a){var b;return i(this,c),b=f.call(this,a),b.handleChange=b.handleChange.bind(p(b)),b.state={redirectUri:""},b}l(c,a);var f=n(c);return k(c,[{key:"componentDidMount",value:function componentDidMount(){this.configure(this.props)}},{key:"componentDidUpdate",value:function componentDidUpdate(a){(0,e["default"])(a,this.props)||this.configure(this.props)}},{key:"configure",value:function configure(a){this.setState({redirectUri:a.value.redirectUri})}},{key:"handleChange",value:function handleChange(a){this.setState({redirectUri:a.target.value}),this.props.onChange&&"function"==typeof this.props.onChange&&this.props.onChange({redirectUri:a.target.value})}},{key:"render",value:function render(){var a,c,e=this.props,f=e.t,g=e.value,h=this.state.redirectUri,i=g.redirectUris;return 0<i.length&&""!==i[0]&&(a=b["default"].createElement(d.Select,{onChange:this.handleChange,id:"redirectUri-select",defaultValue:i[0],hideLabel:!0},i.map(function(a){return b["default"].createElement(d.SelectItem,{key:a,value:a,text:a})}),b["default"].createElement(d.SelectItem,{key:"",value:"",text:f("other")}))),(""===i[0]||-1===i.indexOf(h))&&(c=b["default"].createElement(d.TextInput,{className:"redirectUriField",type:"input",hideLabel:!0,labelText:f("explorer_redirect_uri"),id:"redirectUriField",value:h,onChange:this.handleChange})),b["default"].createElement("div",{className:"redirectUri"},b["default"].createElement("div",{className:"labelText"},f("explorer_redirect_uri")),a,c)}}]),c}(b.Component);exports.TestToolRedirectUri=s;var t=(0,c.withTranslation)()(s);exports["default"]=t;