"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _utils = require("../../utils/utils");

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _styled = _interopRequireDefault(require("@emotion/styled"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var OutputDiv =
/*#__PURE__*/
(0, _styled.default)('div', {
  target: "e1srwukb0"
})("font-size:1.3em;margin-bottom:5px;");

var Prediction = function Prediction(_ref) {
  var dtNode = _ref.dtNode,
      interpreter = _ref.interpreter;

  var _interpreter$getPredi = interpreter.getPrediction(dtNode),
      confidence = _interpreter$getPredi.confidence,
      value = _interpreter$getPredi.value,
      distribution = _interpreter$getPredi.distribution;

  var std = distribution.standard_deviation;
  var PredictionDiv =
  /*#__PURE__*/
  (0, _styled.default)('div', {
    target: "e1srwukb1"
  })("background-color:", (0, _utils.computeLeafColor)(confidence), ";padding:10px;text-align:center;margin-top:10;");
  return _react.default.createElement("div", {
    className: "node-predictions"
  }, value != null ? _react.default.createElement(PredictionDiv, null, _react.default.createElement(OutputDiv, null, _react.default.createElement("code", null, interpreter.outputProperty), " ", value), confidence ? _react.default.createElement("div", null, "Confidence ", (confidence * 100).toFixed(2), "%") : null, std !== undefined ? _react.default.createElement("div", null, "Standard deviation ", std.toFixed(2)) : null) : null);
};

Prediction.propTypes = {
  dtNode: _propTypes.default.object.isRequired,
  interpreter: _propTypes.default.object.isRequired
};
var _default = Prediction;
exports.default = _default;