"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.TestToolVapidAuth=void 0;var b=f(require("react")),c=require("react-i18next"),d=require("carbon-components-react");function e(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(e=function(a){return a?c:b})(a)}function f(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!==a(b)&&"function"!=typeof b)return{default:b};var d=e(c);if(d&&d.has(b))return d.get(b);var f={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in b)if("default"!=h&&Object.prototype.hasOwnProperty.call(b,h)){var i=g?Object.getOwnPropertyDescriptor(b,h):null;i&&(i.get||i.set)?Object.defineProperty(f,h,i):f[h]=b[h]}return f["default"]=b,d&&d.set(b,f),f}function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function h(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 i(a,b,c){return b&&h(a.prototype,b),c&&h(a,c),a}function j(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&&k(a,b)}function k(a,b){return k=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},k(a,b)}function l(a){var b=o();return function(){var c,d=p(a);if(b){var e=p(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return m(this,c)}}function m(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 n(b)}function n(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(){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 p(a){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},p(a)}var q=function(a){function c(a){var b;return g(this,c),b=e.call(this,a),b.state={vapidJSONWebToken:"",vapidJSONWebKey:""},b.handleHttpVapidJSONWebTokenChange=b.handleHttpVapidJSONWebTokenChange.bind(n(b)),b.handleHttpVapidJSONWebKeyChange=b.handleHttpVapidJSONWebKeyChange.bind(n(b)),b}j(c,a);var e=l(c);return i(c,[{key:"componentDidMount",value:function componentDidMount(){this.configure(this.props)}},{key:"configure",value:function configure(a){if(a.vapidCreds){var b={};b.vapidJSONWebToken=a.vapidCreds.vapidJSONWebToken?a.vapidCreds.vapidJSONWebToken:"",b.vapidJSONWebKey=a.vapidCreds.vapidJSONWebKey?a.vapidCreds.vapidJSONWebKey:"",this.setState(b)}}},{key:"handleHttpVapidJSONWebTokenChange",value:function handleHttpVapidJSONWebTokenChange(a){var b=Object.assign(this.state,{vapidJSONWebToken:a.target.value});this.setState(b),this.props.onChange&&"function"==typeof this.props.onChange&&this.props.onChange(b)}},{key:"handleHttpVapidJSONWebKeyChange",value:function handleHttpVapidJSONWebKeyChange(a){var b=Object.assign(this.state,{vapidJSONWebKey:a.target.value});this.setState(b),this.props.onChange&&"function"==typeof this.props.onChange&&this.props.onChange(b)}},{key:"render",value:function render(){var a=this.props.t,c=this.state,e=c.vapidJSONWebToken,f=c.vapidJSONWebKey;return b["default"].createElement("div",{className:"testToolVapidAuth"},b["default"].createElement("div",{className:"vapidjsonwebtoken"},b["default"].createElement("div",{className:"labelText"},a("json_web_token")),b["default"].createElement(d.TextInput,{id:"vapidjsonwebtoken",hideLabel:!0,labelText:a("json_web_token"),value:e,onChange:this.handleHttpVapidJSONWebTokenChange})),b["default"].createElement("div",{className:"vapidjsonwebkey"},b["default"].createElement("div",{className:"labelText"},a("json_web_key")),b["default"].createElement(d.TextInput,{id:"vapidjsonwebkey",labelText:a("json_web_key"),hideLabel:!0,value:f,onChange:this.handleHttpVapidJSONWebKeyChange})))}}]),c}(b.Component);exports.TestToolVapidAuth=q;var r=(0,c.withTranslation)()(q);exports["default"]=r;