"use strict";
/*
Search for accounts matching a given query.

If user is signed in, then their account_id is used to prioritize the search.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const search_1 = __importDefault(require("@cocalc/server/accounts/search"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
async function handle(req, res) {
    try {
        return res.json(await doUserSearch(req));
    }
    catch (err) {
        res.json({ error: err.message });
    }
}
exports.default = handle;
async function doUserSearch(req) {
    const { query } = (0, get_params_1.default)(req);
    return await (0, search_1.default)({ query });
}
//# sourceMappingURL=search.js.map