"use strict";
var BrowserAgentAgent;
(function (BrowserAgentAgent) {
    class SkillsService {
        static async fetchSkill(slug) {
            try {
                const config = await BrowserAgent.getStoredConfig();
                const baseUrl = config.serverUrl.replace(/\/+$/, "");
                const response = await fetch(`${baseUrl}/v1/skills/${encodeURIComponent(slug)}`, {
                    headers: config.authToken ? { Authorization: `Bearer ${config.authToken}` } : {}
                });
                if (!response.ok)
                    return null;
                const data = await response.json();
                return data?.ok && data.skill ? data.skill : null;
            }
            catch {
                return null;
            }
        }
    }
    BrowserAgentAgent.SkillsService = SkillsService;
})(BrowserAgentAgent || (BrowserAgentAgent = {}));
//# sourceMappingURL=SkillsService.js.map