"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.PolyfillPlaceholder = void 0;var _react = _interopRequireDefault(require("react"));


var _Emotion = require("../../../lib/theming/Emotion");
var _ThemeContext = require("../../../lib/theming/ThemeContext");
var _Input = require("../Input.styles");
var _needsPolyfillPlaceholder = require("../../../lib/needsPolyfillPlaceholder");

var _InputLayoutContext = require("./InputLayoutContext");









var PolyfillPlaceholder = exports.PolyfillPlaceholder = function PolyfillPlaceholder(_ref)





{var placeholder = _ref.children,align = _ref.align,value = _ref.value,defaultValue = _ref.defaultValue,isMaskVisible = _ref.isMaskVisible;
  var theme = _react.default.useContext(_ThemeContext.ThemeContext);
  var _React$useContext = _react.default.useContext(_InputLayoutContext.InputLayoutContext),focused = _React$useContext.focused,disabled = _React$useContext.disabled;

  var _placeholder = null;

  if (_needsPolyfillPlaceholder.needsPolyfillPlaceholder && placeholder && !isMaskVisible && !value && !defaultValue) {var _cx;
    _placeholder = /*#__PURE__*/
    _react.default.createElement("div", {
      className: (0, _Emotion.cx)(_Input.styles.placeholder(theme), (_cx = {}, _cx[
      _Input.styles.placeholderDisabled(theme)] = disabled, _cx[
      _Input.styles.placeholderFocus(theme)] = focused, _cx)
      ),
      style: { textAlign: align || 'inherit' } },

    placeholder
    );

  }

  return _placeholder;
};