"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubHeaderListingContainer = void 0;
var react_1 = __importDefault(require("react"));
var react_native_1 = require("react-native");
var react_native_svg_1 = __importStar(require("react-native-svg"));
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
var react_native_fontawesome_1 = require("@fortawesome/react-native-fontawesome");
var _ = __importStar(require("lodash"));
var services_1 = require("../../../../services");
var native_1 = require("../../../Flex/native");
var RFValue_1 = require("../../../RFValue");
var native_2 = require("../../../TagsFilters/native");
var TextNative_1 = require("../../../TextNative");
var SubHeaderListingContainer_style_1 = require("./SubHeaderListingContainer.style");
function SubHeaderListingContainer(props) {
    var _a;
    var tagsFilters = props.tagsFilters, tagsFiltersRef = props.tagsFiltersRef, viewList = props.viewList, setTagsFilterSize = props.setTagsFilterSize, navActions = props.navActions;
    var filters = viewList.filters;
    function onChange(tags) {
        setTagsFilterSize(tags.length ? RFValue_1.RSValue(35) : 0);
    }
    return (react_1.default.createElement(react_native_1.View, { style: { backgroundColor: 'white' } },
        react_1.default.createElement(ResultsInfo, __assign({}, props)),
        tagsFilters && (react_1.default.createElement(SubHeaderListingContainer_style_1.TagsFiltersContainer, { view: (_a = tagsFiltersRef.current) === null || _a === void 0 ? void 0 : _a.tagsCount },
            react_1.default.createElement(native_2.TagsFilters, __assign({ ref: tagsFiltersRef }, tagsFilters, { filters: filters, onChange: onChange }))))));
}
exports.SubHeaderListingContainer = SubHeaderListingContainer;
var BarGradient = react_1.default.memo(function BarGradient() {
    return (react_1.default.createElement(react_native_svg_1.default, { height: "10px", width: "100%", fill: "transparent", color: "transparent" },
        react_1.default.createElement(react_native_svg_1.Defs, null,
            react_1.default.createElement(react_native_svg_1.LinearGradient, { id: "grad", x1: "0", y1: "0", x2: "0", y2: "1" },
                react_1.default.createElement(react_native_svg_1.Stop, { offset: "0", stopColor: "white", stopOpacity: "0.8" }),
                react_1.default.createElement(react_native_svg_1.Stop, { offset: "1", stopColor: "white", stopOpacity: "0" }))),
        react_1.default.createElement(react_native_svg_1.Rect, { x: "0", y: "0", height: "100%", width: "100%", fill: "url(#grad)" })));
});
function ResultsInfo(props) {
    var openFilters = props.openFilters, _a = props.showCountListing, showCountListing = _a === void 0 ? true : _a, viewList = props.viewList;
    var resourcesTotal = viewList.resourcesTotal;
    return (react_1.default.createElement(ResultsInfoRender, { showCountListing: showCountListing, resourcesTotal: resourcesTotal, openFilters: openFilters }));
}
var ResultsInfoRender = react_1.default.memo(function ResultsInfoRender(_a) {
    var showCountListing = _a.showCountListing, resourcesTotal = _a.resourcesTotal, openFilters = _a.openFilters;
    return (react_1.default.createElement(react_native_1.View, { style: { backgroundColor: 'black' } },
        react_1.default.createElement(SubHeaderListingContainer_style_1.BorderRoundedTop, null,
            react_1.default.createElement(native_1.Flex, { flex: 1, justifyContent: "center" },
                react_1.default.createElement(TextNative_1.TextNative, { size: 14 }, showCountListing && (react_1.default.createElement(react_1.default.Fragment, null,
                    react_1.default.createElement(TextNative_1.TextNative, { size: 13, bold: true }, services_1.NumberFormat(resourcesTotal, 0)),
                    ' ',
                    "resultados")))),
            react_1.default.createElement(native_1.Flex, { justifyContent: "center" },
                react_1.default.createElement(SubHeaderListingContainer_style_1.FilterBtn, { onPress: function () { return openFilters(); }, ripple: true, testID: "open-filter" },
                    react_1.default.createElement(SubHeaderListingContainer_style_1.TextFilter, null,
                        react_1.default.createElement(react_native_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faFilter, color: "white", size: RFValue_1.RFValue(12) }),
                        "\u00A0 FILTRAR"))))));
}, _.isEqual);
//# sourceMappingURL=SubHeaderListingContainer.js.map