"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var classnames_1 = __importDefault(require("classnames"));
var ramda_1 = require("ramda");
var withTableContext_1 = require("../HOCs/withTableContext");
var basicTable_1 = require("../types/basicTable");
var useMaskedAttribute_1 = require("../hooks/useMaskedAttribute");
var MaskingSwitcher_1 = require("../MaskingSwitcher");
var styles_module_css_1 = __importDefault(require("./styles.module.css"));
var stopPropagation = function (event) {
    event.stopPropagation();
};
var BlobRenderer = function (_a) {
    var value = _a.value, _b = _a.columnData, dataTypeDefinition = _b.dataTypeDefinition, className = _b.className, entity = _a.rowValue.label, _c = _a.variant, variant = _c === void 0 ? basicTable_1.TableVariant.Wide : _c;
    var _d = (0, useMaskedAttribute_1.useMaskedAttribute)({
        attributeType: dataTypeDefinition,
        attributeValue: value,
        entity: entity
    }), isUnmaskingNeeded = _d.isUnmaskingNeeded, isMasked = _d.isMasked, toggleMasking = _d.toggleMasking, attributeValue = _d.attributeValue, isUnmasking = _d.isUnmasking;
    return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles_module_css_1.default.blobWrapper, styles_module_css_1.default[variant], className), onScroll: stopPropagation },
        attributeValue.value,
        isUnmaskingNeeded && (react_1.default.createElement(MaskingSwitcher_1.MaskingSwitcher, { isMasked: isMasked, onToggleMasking: toggleMasking, isUnmasking: isUnmasking }))));
};
exports.default = (0, withTableContext_1.withTableContext)((0, ramda_1.pick)(['variant']))(BlobRenderer);
