/*!
 * Copyright © 2024 Splunk Inc.
 * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
 * in part without a valid written license from Splunk Inc. is PROHIBITED.
 */
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 84);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("react");

/***/ }),

/***/ 1:
/***/ (function(module, exports) {

module.exports = require("prop-types");

/***/ }),

/***/ 11:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/extends");

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

module.exports = require("styled-components");

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);





var MARKER_THICKNESS = 15;
var MARKER_INNER_LENGTH = 30;
var MARKER_LABEL_WIDTH = 60;
var MARKER_LABEL_HEIGHT = 25;
var RADIUS = 2;
var DELTA_LENGTH = 12;
var ValueMarkerRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.path.withConfig({
  displayName: "GaugeValueMarker__ValueMarkerRect",
  componentId: "sc-1bxkeao-0"
})(["stroke-width:2px;fill:", ";"], function (props) {
  return props.valueMarkerFillColor;
});
var ValueMarkerLabelRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.rect.withConfig({
  displayName: "GaugeValueMarker__ValueMarkerLabelRect",
  componentId: "sc-1bxkeao-1"
})(["fill:", ";"], function (props) {
  return props.valueMarkerFillColor;
});
var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
  displayName: "GaugeValueMarker__ValueMarkerLabel",
  componentId: "sc-1bxkeao-2"
})(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
  return props.valueMarkerLabelFillColor;
});
/**
 * calculate the path of Value Marker shape
 * @method positionValueMarkerRect
 * @param {Object} input
 * @param {Number} input.x
 * @param {Number} input.y
 * @param {String} input.orientation
 * @param {Number} input.valueMarkerRectLength
 * @return {String} d containing a series of path commands that define the path to be
 */

var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
  var x = _ref.x,
      y = _ref.y,
      orientation = _ref.orientation,
      valueMarkerRectLength = _ref.valueMarkerRectLength,
      _ref$alignCenter = _ref.alignCenter,
      alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
  var hLength = MARKER_THICKNESS;
  var vLength = valueMarkerRectLength;
  var markerStartX = alignCenter ? x - MARKER_THICKNESS / 2 : x - MARKER_THICKNESS;
  var markerStartY = y;
  var innerHLength = hLength / 3;
  var innerVLength = MARKER_INNER_LENGTH;
  var innerStartX = markerStartX + innerHLength;
  var innerStartY = markerStartY + 7;

  if (orientation === 'vertical') {
    hLength = valueMarkerRectLength;
    vLength = MARKER_THICKNESS;
    markerStartX = x;
    markerStartY = alignCenter ? y - MARKER_THICKNESS / 2 : y;
    innerHLength = MARKER_INNER_LENGTH;
    innerVLength = vLength / 3;
    innerStartX = markerStartX + 7;
    innerStartY = markerStartY + innerVLength;
  }

  return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
};
/**
 * calculate the position of value marker label
 * @method positionLabel
 * @param {Object} input
 * @param {Number} input.x
 * @param {Number} input.y
 * @param {Number} input.length   gauge thickness
 * @param {String} input.orientation
 * @return {Object} positions
 * @return {Number} positions.labelRectX  x of value marker label rect
 * @return {Number} positions.labelRectY  y of value marker label rect
 * @return {Number} positions.labelX      x of value marker label text
 * @return {Number} positions.labelY      y of value marker label text
 */

var positionLabel = function positionLabel(_ref2) {
  var x = _ref2.x,
      y = _ref2.y,
      length = _ref2.length,
      orientation = _ref2.orientation,
      _ref2$alignCenter = _ref2.alignCenter,
      alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter; // for horizontal view

  var labelRectX = alignCenter ? x - MARKER_LABEL_WIDTH / 2 : x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
  var labelRectY = y + length;

  if (orientation === 'vertical') {
    labelRectX = x + length;
    labelRectY = alignCenter ? y - MARKER_LABEL_HEIGHT / 2 : y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
  }

  var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
  var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
  return {
    labelRectX: labelRectX,
    labelRectY: labelRectY,
    labelX: labelX,
    labelY: labelY
  };
};

var ValueMarker = function ValueMarker(_ref3) {
  var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);

  var x = props.x,
      y = props.y,
      length = props.length,
      min = props.min,
      max = props.max,
      value = props.value,
      orientation = props.orientation,
      showValue = props.showValue,
      usePercentageValue = props.usePercentageValue,
      valueMarkerFillColor = props.valueMarkerFillColor,
      valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
      alignCenter = props.alignCenter;
  var valueMarkerRectLength = length + DELTA_LENGTH;

  var _positionLabel = positionLabel({
    x: x,
    y: y,
    length: length,
    orientation: orientation,
    alignCenter: alignCenter
  }),
      labelRectX = _positionLabel.labelRectX,
      labelRectY = _positionLabel.labelRectY,
      labelX = _positionLabel.labelX,
      labelY = _positionLabel.labelY;

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
    "data-test": "value-marker-rect",
    d: positionValueMarkerRect({
      x: x,
      y: y,
      orientation: orientation,
      valueMarkerRectLength: valueMarkerRectLength,
      alignCenter: alignCenter
    }),
    valueMarkerFillColor: valueMarkerFillColor
  }), showValue && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabelRect, {
    "data-test": "value-marker-label-rect",
    x: labelRectX,
    y: labelRectY,
    width: MARKER_LABEL_WIDTH,
    height: MARKER_LABEL_HEIGHT,
    rx: RADIUS,
    ry: RADIUS,
    valueMarkerFillColor: valueMarkerFillColor
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabel, {
    "data-test": "value-marker-label",
    x: labelX,
    y: labelY,
    valueMarkerLabelFillColor: valueMarkerLabelFillColor
  }, usePercentageValue ? "".concat((value / (max - min) * 100).toFixed(2), "%") : Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(value, 0, {
    useThousandSeparators: true,
    useTrendUnits: true
  }))));
};

ValueMarker.propTypes = {
  x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  length: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
  orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
  showValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
  usePercentageValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
  valueMarkerFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
  valueMarkerLabelFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
  alignCenter: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool
};
ValueMarker.defaultProps = {
  min: 0,
  max: 100,
  orientation: 'horizontal',
  showValue: true,
  usePercentageValue: false,
  alignCenter: false
};
/* harmony default export */ __webpack_exports__["default"] = (ValueMarker);

/***/ }),

/***/ 9:
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/numberUtils");

/***/ })

/******/ });
//# sourceMappingURL=GaugeValueMarker.js.map