"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateProviderProps = void 0;
// @ts-expect-error missing types
const server_1 = __importDefault(require("@usereactify/search-internals/lib/server"));
const config_1 = require("./config");
const props_1 = require("./props");
const filters_1 = require("./filters");
const generateProviderProps = (options) => __awaiter(void 0, void 0, void 0, function* () {
    const config = yield (0, config_1.getConfig)(options.shopifyPermanentDomain);
    const filterStack = (0, filters_1.getFilterStack)({
        provider: options,
        config: config
    });
    const props = (0, props_1.getPropsFilterGroup)({
        provider: options,
        config: config,
        filterGroup: filterStack,
        query: options.query,
    });
    return Object.assign(Object.assign({}, options), { preload: {
            config: config,
            state: yield (0, server_1.default)(props, options.query, (0, props_1.getPropsBase)({
                config: config,
                provider: options,
                query: options.query,
            }))
        } });
});
exports.generateProviderProps = generateProviderProps;
//# sourceMappingURL=server.js.map