diff --git a/.gitignore b/.gitignore index 15e369f..7209125 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,19 @@ node_modules +# Local database, runtime data, and transcripts +Data/*.db +Data/*.db-shm +Data/*.db-wal +Data/Transcripts/* +Data/dashboard-groups.json +Data/dashboard-users.json +Data/transcript-settings.json + +# Local log files +Logs/Output/* +Logs/Errors/* +Logs/Warns/* + # Dashboard UI source at repo root only (do not ignore public/dashboard/) /dashboard/ diff --git a/API/server.js b/API/server.js index 3c87429..49205e1 100644 --- a/API/server.js +++ b/API/server.js @@ -242,7 +242,7 @@ class APIServer { requirePermission(permission) { return (req, res, next) => { if (req.dashboardService) return next(); - if (req.dashboardIsOwner || req.dashboardImpersonatingGroup) return next(); + if (req.dashboardIsOwner && !req.dashboardImpersonatingGroup) return next(); if (hasPermission(req.dashboardPermissions, permission)) return next(); return forbid(res); }; @@ -251,7 +251,7 @@ class APIServer { requireConfigAccess(mode = 'view') { return (req, res, next) => { if (req.dashboardService) return next(); - if (req.dashboardIsOwner || req.dashboardImpersonatingGroup) return next(); + if (req.dashboardIsOwner && !req.dashboardImpersonatingGroup) return next(); const file = req.params?.file || req.body?.filename; if (!file) return next(); if (!canAccessConfig(req.dashboardPermissions, file, mode)) { @@ -637,6 +637,68 @@ h1{font-size:1.25rem}a{color:#a78bfa} } }); + app.post('/system/tickets/create', p('tickets'), async (req, res) => { + try { + const { department, subject, reason, userId } = req.body; + if (!this.client?.user) { + return res.status(503).json({ success: false, error: 'Bot is not connected to Discord.' }); + } + + const guild = this.client.guilds.cache.first(); + if (!guild) { + return res.status(404).json({ success: false, error: 'No connected Discord server found.' }); + } + + const deptKey = department || supportbot.Ticket?.DepartmentSystem?.DefaultDepartment || 'general'; + const deptConfig = supportbot.Ticket?.DepartmentSystem?.Departments?.[deptKey]; + if (deptConfig && deptConfig.Enabled === false) { + return res.status(400).json({ success: false, error: `Ticket department '${deptKey}' is currently disabled.` }); + } + + const targetUserId = userId || req.dashboardUser?.id || guild.ownerId; + let targetUser = await this.client.users.fetch(targetUserId).catch(() => null); + if (!targetUser) { + targetUser = this.client.user; + } + + const openCmd = this.client.commands.get(cmdconfig.OpenTicket?.Command || "new"); + if (!openCmd) { + return res.status(500).json({ success: false, error: 'Open ticket command not found in bot.' }); + } + + const fakeInteraction = { + guild, + user: targetUser, + member: await guild.members.fetch(targetUser.id).catch(() => null), + channel: guild.channels.cache.first(), + department: deptKey, + reason: subject || reason || "Opened via Web Dashboard", + priority: deptConfig?.DefaultPriority || supportbot.Ticket?.PrioritySystem?.DefaultPriority || "medium", + isCommand: () => false, + isChatInputCommand: () => false, + isButton: () => false, + isStringSelectMenu: () => false, + isModalSubmit: () => false, + deferred: false, + replied: false, + deferReply: async () => {}, + reply: async (payload) => { fakeInteraction.repliedPayload = payload; }, + followUp: async (payload) => { fakeInteraction.followUpPayload = payload; }, + editReply: async (payload) => { fakeInteraction.editReplyPayload = payload; } + }; + + await openCmd.run(fakeInteraction); + + res.json({ + success: true, + message: `Ticket successfully created for department: ${deptConfig?.Name || deptKey}!`, + }); + } catch (err) { + console.error('[API] Error creating ticket:', err); + res.status(500).json({ success: false, error: err.message || 'Failed to create ticket' }); + } + }); + app.get('/system/tickets/:ticketId/messages', p('tickets'), async (req, res) => { const { ticketId } = req.params; try { @@ -1051,7 +1113,7 @@ h1{font-size:1.25rem}a{color:#a78bfa} res.json({ success: true, data: { - users: listUsers(oauth), + users: listUsers(oauth, this.client), roles: ROLES, configFiles: CONFIG_FILES, }, @@ -1320,6 +1382,9 @@ h1{font-size:1.25rem}a{color:#a78bfa} }); app.put('/configs/raw', cv('edit'), async (req, res) => { + if (!hasPermission(req.dashboardUser?.permissions, 'configs.raw_yaml')) { + return res.status(403).json({ success: false, error: 'Forbidden: Raw YAML editing requires the Raw YAML Editor permission.' }); + } const validFiles = ['supportbot', 'ticket-panel', 'commands', 'messages', 'supportbot-ai', 'api']; const file = req.body.filename; let content = req.body.content; diff --git a/Commands/Tickets/close.js b/Commands/Tickets/close.js index 5eeaf48..3f3299d 100644 --- a/Commands/Tickets/close.js +++ b/Commands/Tickets/close.js @@ -33,9 +33,10 @@ function buildContainer(title, lines = []) { container.addSeparatorComponents(new Discord.SeparatorBuilder().setDivider(true)); - if (lines.length > 0) { + const textContent = lines.filter(Boolean).join("\n").trim(); + if (textContent.length > 0) { container.addTextDisplayComponents( - new Discord.TextDisplayBuilder().setContent(lines.join("\n")), + new Discord.TextDisplayBuilder().setContent(textContent), ); } diff --git a/Commands/Tickets/ticket.js b/Commands/Tickets/ticket.js index 2256e30..69ae6b3 100644 --- a/Commands/Tickets/ticket.js +++ b/Commands/Tickets/ticket.js @@ -28,22 +28,7 @@ const Command = require("../../Structures/Command.js"); const TicketNumberID = require("../../Structures/TicketID.js"); async function isBlacklisted(userId) { - let blacklistData; - try { - blacklistData = JSON.parse( - fs.readFileSync("./Data/BlacklistedUsers.json", "utf8"), - ); - } catch (error) { - console.error("Error reading BlacklistedUsers.json:", error); - return false; - } - - if (!blacklistData || !Array.isArray(blacklistData.blacklistedUsers)) { - console.error("blacklistedUsers is not defined or is not an array"); - return false; - } - - return blacklistData.blacklistedUsers.includes(userId); + return typeof db.isUserBlacklisted === "function" ? db.isUserBlacklisted(userId) : false; } async function getClockedInUsers(guild) { diff --git a/Commands/Tickets/ticketpanel.js b/Commands/Tickets/ticketpanel.js index 0862d12..cb82e7e 100644 --- a/Commands/Tickets/ticketpanel.js +++ b/Commands/Tickets/ticketpanel.js @@ -116,6 +116,7 @@ module.exports = new Command({ } const departmentOptions = Object.entries(departments) + .filter(([_, dept]) => dept && dept.Enabled !== false) .slice(0, 25) .map(([key, dept]) => ({ label: dept.Name || key, diff --git a/Commands/Utils/mod.js b/Commands/Utils/mod.js index c4e0692..545049f 100644 --- a/Commands/Utils/mod.js +++ b/Commands/Utils/mod.js @@ -1,6 +1,7 @@ const fs = require("fs"); const { ApplicationCommandOptionType, ApplicationCommandType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType, MessageFlags } = require("discord.js"); const yaml = require("js-yaml"); +const db = require("../../Structures/Database.js"); const supportbot = require("../../Structures/ConfigStore").supportbot; const cmdconfig = require("../../Structures/ConfigStore").commands; const msgconfig = require("../../Structures/ConfigStore").messages; @@ -18,28 +19,28 @@ function chunkArray(arr, size) { module.exports = new Command({ name: cmdconfig.Mod.Command, - description: cmdconfig.Mod.Command, + description: cmdconfig.Mod.Description || "Moderation commands", type: ApplicationCommandType.ChatInput, options: [ { name: cmdconfig.Mod.TicketBlacklist.Command, - description: cmdconfig.Mod.TicketBlacklist.Description, + description: cmdconfig.Mod.TicketBlacklist.Description || "Ticket Blacklist Commands", type: ApplicationCommandOptionType.SubcommandGroup, options: [ { name: cmdconfig.Mod.TicketBlacklist.Add.Command, - description: msgconfig.Mod.TicketBlacklist.Add.Description || "Add a user to the ticket blacklist", + description: msgconfig.Mod.TicketBlacklist.Add.Description || "Add a user to the blacklist", type: ApplicationCommandOptionType.Subcommand, options: [ { name: 'user', - description: msgconfig.Mod.TicketBlacklist.Add.UserDescription || "User to blacklist", + description: 'The user to blacklist', type: ApplicationCommandOptionType.User, required: true }, { - name: 'reason', - description: msgconfig.Mod.TicketBlacklist.Add.ReasonDescription || "Reason for blacklisting", + name: 'reason', + description: 'Reason for blacklisting', type: ApplicationCommandOptionType.String, required: false } @@ -47,18 +48,18 @@ module.exports = new Command({ }, { name: cmdconfig.Mod.TicketBlacklist.Remove.Command, - description: msgconfig.Mod.TicketBlacklist.Remove.Description || "Remove a user from the ticket blacklist", + description: cmdconfig.Mod.TicketBlacklist.Remove.Description || "Remove a user from the blacklist", type: ApplicationCommandOptionType.Subcommand, options: [ { name: 'user', - description: msgconfig.Mod.TicketBlacklist.Remove.UserDescription || "User to remove from blacklist", + description: 'The user to remove from the blacklist', type: ApplicationCommandOptionType.User, required: true }, { name: 'reason', - description: msgconfig.Mod.TicketBlacklist.Remove.ReasonDescription || "Reason for removing from blacklist", + description: 'Reason for unblacklisting', type: ApplicationCommandOptionType.String, required: false } @@ -67,60 +68,32 @@ module.exports = new Command({ { name: "view", description: msgconfig.Mod.TicketBlacklist.View.Description || "View all blacklisted users", - type: ApplicationCommandOptionType.Subcommand, + type: ApplicationCommandOptionType.Subcommand } ] } ], - permissions: cmdconfig.Mod.Permission, - async run(interaction) { - const { getRole } = interaction.client; - - let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild); - let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild); - let Moderator = await getRole(supportbot.Roles.StaffMember.Moderator, interaction.guild); - - if (!SupportStaff || !Admin || !Moderator) { - const missingRolesEmbed = new EmbedBuilder() - .setDescription(msgconfig.Error.InvalidChannel || "Required roles are missing!") - .setColor(supportbot.Embed.Colours.Warn); - return interaction.reply({ embeds: [missingRolesEmbed] }); - } - - const NoPerms = new EmbedBuilder() - .setDescription(msgconfig.Error.IncorrectPerms || "You do not have the correct permissions!") - .setColor(supportbot.Embed.Colours.Warn); - - if (!interaction.member.roles.cache.has(Admin.id) && !interaction.member.roles.cache.has(Moderator.id) && (!supportbot.Mod.AllowSupportStaff || !interaction.member.roles.cache.has(SupportStaff.id))) { - return interaction.reply({ embeds: [NoPerms] }); - } - - const subcommand = interaction.options.getSubcommand(false); + run: async ({ interaction }) => { + const subcommandGroup = interaction.options.getSubcommandGroup(); + const subcommand = interaction.options.getSubcommand(); const user = interaction.options.getUser('user'); const reason = interaction.options.getString('reason') || "No reason provided"; try { - let blacklistedUsers; - try { - blacklistedUsers = JSON.parse(fs.readFileSync("./Data/BlacklistedUsers.json", "utf8")).blacklistedUsers; - if (!Array.isArray(blacklistedUsers)) { - blacklistedUsers = []; - } - } catch (error) { - blacklistedUsers = []; - } + const blacklistedUsers = typeof db.getBlacklistedUsers === "function" ? db.getBlacklistedUsers() : []; if (subcommand === cmdconfig.Mod.TicketBlacklist.Add.Command) { - if (blacklistedUsers.includes(user.id)) { + if (db.isUserBlacklisted && db.isUserBlacklisted(user.id)) { const alreadyBlacklistedEmbed = new EmbedBuilder() .setDescription(msgconfig.Mod.TicketBlacklist.Add.AlreadyBlacklisted.replace("{userTag}", user.tag) || ":x: User is already blacklisted.") .setColor(supportbot.Embed.Colours.Warn); return interaction.reply({ embeds: [alreadyBlacklistedEmbed], flags: MessageFlags.Ephemeral }); } - blacklistedUsers.push(user.id); - fs.writeFileSync("./Data/BlacklistedUsers.json", JSON.stringify({ "blacklistedUsers": blacklistedUsers }, null, 4)); + if (typeof db.addBlacklistedUser === "function") { + db.addBlacklistedUser(user.id, reason, interaction.user.tag); + } const successEmbed = new EmbedBuilder() .setDescription(msgconfig.Mod.TicketBlacklist.Add.Success.replace("{userTag}", user.tag) || ":white_check_mark: User has been blacklisted.") @@ -133,7 +106,7 @@ module.exports = new Command({ .setColor(msgconfig.TicketBlacklistLog.Colour || supportbot.Embed.Colours.Success) .setFooter({ text: supportbot.Embed.Footer, iconURL: interaction.user.displayAvatarURL() }) .setDescription(`> **User:** ${user.tag} (\`${user.id}\`)\n> **Actioned by:** <@${interaction.user.id}>`) - .addFields({ name: "Action", value: "\`\`\`Removed from blacklist\`\`\`", inline: false }) + .addFields({ name: "Action", value: "\`\`\`Added to blacklist\`\`\`", inline: false }) .addFields({ name: "Reason", value: `\`\`\`${reason}\`\`\``, inline: false }); blacklistChannel.send({ embeds: [blacklistLogEmbed] }); @@ -145,15 +118,16 @@ module.exports = new Command({ }); } else if (subcommand === cmdconfig.Mod.TicketBlacklist.Remove.Command) { - if (!blacklistedUsers.includes(user.id)) { + if (db.isUserBlacklisted && !db.isUserBlacklisted(user.id)) { const notBlacklistedEmbed = new EmbedBuilder() .setDescription(msgconfig.Mod.TicketBlacklist.Remove.NotBlacklisted.replace("{userTag}", user.tag) || ":x: User is not blacklisted.") .setColor(supportbot.Embed.Colours.Warn); return interaction.reply({ embeds: [notBlacklistedEmbed], flags: MessageFlags.Ephemeral }); } - blacklistedUsers = blacklistedUsers.filter(id => id !== user.id); - fs.writeFileSync("./Data/BlacklistedUsers.json", JSON.stringify({ "blacklistedUsers": blacklistedUsers }, null, 4)); + if (typeof db.removeBlacklistedUser === "function") { + db.removeBlacklistedUser(user.id); + } const removedEmbed = new EmbedBuilder() .setDescription(msgconfig.Mod.TicketBlacklist.Remove.Success.replace("{userTag}", user.tag) || ":white_check_mark: User has been removed from the blacklist.") diff --git a/Configs/messages.yml b/Configs/messages.yml index a6ff5e9..5ee6d6c 100644 --- a/Configs/messages.yml +++ b/Configs/messages.yml @@ -8,7 +8,8 @@ # Installed with MIT License # # Discord Support: https://discord.gg/emeraldsrv -# Official Website & Marketplace: https://emeraldsrv.com +# Official Documentation: https://docs.emeraldsrv.com +# Addons Marketplace: https://community.emeraldsrv.com # # Messages Configuration (messages.yml) diff --git a/Configs/supportbot-ai.yml b/Configs/supportbot-ai.yml index 4f47c42..e8f9f89 100644 --- a/Configs/supportbot-ai.yml +++ b/Configs/supportbot-ai.yml @@ -1,15 +1,3 @@ -# ___ _ ___ _ -# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_ -# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | | -# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_| -# |_| |_| -# -# SupportBot created by Emerald Services -# Installed with MIT License -# -# Discord Support: https://discord.gg/emeraldsrv -# Official Website & Marketplace: https://emeraldsrv.com - # ------------------------- # SupportBot AI # @@ -20,8 +8,8 @@ Enabled: true General: - Provider: "groq" - Model: "MODEL_NAME" + Provider: "openai" + Model: "MODEL" Model_API_Key: "MODEL_API_KEY" # Providers Available: # "openai" - Use OpenAI's GPT models. Example: "gpt-5.4" "gpt-5-mini" @@ -33,7 +21,7 @@ General: Temperature: 0.4 Name: "SupportBot AI" - PastebinAPI_Key: "PASTEBIN_API_KEY" + PastebinAPI_Key: "YOUR_PASTEBIN_API_KEY" PastebinAPI_URL: "https://pastebin.com/api/api_post.php" Style: diff --git a/Configs/supportbot.yml b/Configs/supportbot.yml index b7ee41f..e68a47a 100644 --- a/Configs/supportbot.yml +++ b/Configs/supportbot.yml @@ -8,11 +8,11 @@ # Installed with MIT License # # Discord Support: https://discord.gg/emeraldsrv -# Official Website & Marketplace: https://emeraldsrv.com +# Website: https://emeraldsrv.dev # # SupportBot Configuration (supportbot.yml) -SupportBot_Version: "v26.2-pre1" +SupportBot_Version: "v26.2-pre2" # ------------------------- # General @@ -20,12 +20,32 @@ SupportBot_Version: "v26.2-pre1" General: Name: "SupportBot" - Token: "DISCORD_BOT_TOKEN" + Token: "YOUR_BOT_TOKEN_HERE" Addons: Enabled: true - GuildId: "GUILD_ID" + GuildId: "YOUR_GUILD_ID_HERE" # ------------------------- +# Database Configuration +# ------------------------- + +Database: + # Driver options: "mysql" (works for MariaDB & MySQL) or "sqlite" + Driver: "mysql" + + # Connection Settings for MariaDB / MySQL (used when Driver is "mysql" or "mariadb") + MySQL: + Host: "localhost" + Port: 3306 + User: "root" + Password: "password" + Database: "supportbot" + ConnectionLimit: 10 + + # Connection Settings for SQLite (used when Driver is "sqlite") + SQLite: + File: "./Data/supportbot.db" + # Activity # ------------------------- @@ -33,12 +53,12 @@ Activity: Status: "SupportBot" Type: "Watching" StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME" - # Available Activity Types: - # - Playing - # - Watching - # - Listening - # - Competing - # - Streaming (URL required) + # Available Types: + # Playing + # Watching + # Listening + # Competing + # Streaming (URL required) # You can also update the activity via Discord using: /settings @@ -54,6 +74,7 @@ Embed: Warn: "#fca117" Footer: "SupportBot | Developed by Emerald Development" + # Use 0x to change the colour of the embeds. # ------------------------- # Roles @@ -365,4 +386,4 @@ MessageUpdate: Colour: "#f2a024" Translate: - TranslateLog: "CHANNEL_ID" \ No newline at end of file + TranslateLog: "CHANNEL_ID" diff --git a/Configs/ticket-panel.yml b/Configs/ticket-panel.yml index 09775d6..4de8d43 100644 --- a/Configs/ticket-panel.yml +++ b/Configs/ticket-panel.yml @@ -8,7 +8,8 @@ # Installed with MIT License # # Discord Support: https://discord.gg/emeraldsrv -# Official Website & Marketplace: https://emeraldsrv.com +# Official Documentation: https://docs.emeraldsrv.com +# Addons Marketplace: https://community.emeraldsrv.com # # Ticket Creation Panel Configuration (ticket-panel.yml) @@ -20,7 +21,8 @@ Panel: true Style: Title: "## 📬 Open Ticket" - Description: "Tap the button to open a support ticket, Our team will respond as soon as possible." + Description: "Tap the button to open a support ticket, Our team will respond as + soon as possible." Image: "https://cdn.1tzemerald.space/Emerald%20Services/SBPoster.png" Color: "#45b463" Layout: "3" diff --git a/Events/interactionCreate.js b/Events/interactionCreate.js index 379182b..0c98ebc 100644 --- a/Events/interactionCreate.js +++ b/Events/interactionCreate.js @@ -140,6 +140,13 @@ module.exports = new Event("interactionCreate", async (client, interaction) => { if (interaction.isStringSelectMenu()) { if (interaction.customId === "ticketdepartmentselect") { const selectedDepartment = interaction.values[0]; + const deptConfig = supportbot.Ticket?.DepartmentSystem?.Departments?.[selectedDepartment]; + if (deptConfig && deptConfig.Enabled === false) { + return interaction.reply({ + content: "Ticket creation for this department is currently disabled.", + flags: Discord.MessageFlags.Ephemeral, + }); + } if (supportbot.Ticket.TicketReason) { const modal = new Discord.ModalBuilder() @@ -680,7 +687,15 @@ module.exports = new Event("interactionCreate", async (client, interaction) => { }); } - if (interaction.customId === "createticket") { + if (interaction.customId === "createticket" || interaction.customId === "openticket") { + const panelDisabled = panelconfig.Panel === false || supportbot.Ticket?.Enabled === false; + if (panelDisabled) { + return interaction.reply({ + content: "Ticket creation is currently disabled.", + flags: Discord.MessageFlags.Ephemeral, + }); + } + if (supportbot.Ticket.TicketReason) { const modal = new Discord.ModalBuilder() .setCustomId("ticketReasonModal") diff --git a/Structures/BotStartup.js b/Structures/BotStartup.js index da4b4de..7e67b72 100644 --- a/Structures/BotStartup.js +++ b/Structures/BotStartup.js @@ -85,6 +85,14 @@ async function logStartup(client, options = {}) { info("Version", botVersion); info("Node.js", process.version); info("Discord.js", `v${Discord.version}`); + const db = require("./Database.js"); + const dbInfo = db.getDatabaseInfo ? db.getDatabaseInfo() : null; + if (dbInfo) { + const dbDisplay = dbInfo.type === "mysql" + ? `${dbInfo.driver} (${dbInfo.host}:${dbInfo.port}/${dbInfo.database})` + : `${dbInfo.driver} (${dbInfo.file})`; + info("Database", dbDisplay); + } info("Logged in as", client.user.tag); info("Guilds", `${client.guilds.cache.size}`); @@ -102,6 +110,16 @@ async function logStartup(client, options = {}) { console.log(""); } +function checkSetup() { + const { isSetupComplete } = require("./DashboardSetup.js"); + if (!isSetupComplete()) { + const port = configStore.api?.API?.Port || 25575; + section("Setup Required"); + status("Onboarding setup incomplete", false, `http://localhost:${port}/setup`); + console.log(""); + } +} + async function checkConfigs(client) { const supportbot = configStore.supportbot; const health = syncGuildHealth(client); @@ -169,6 +187,8 @@ async function runBotReady(client, options = {}) { if (logCommands) { logSlashCommandsRegistered(client); } + + checkSetup(); } module.exports = { diff --git a/Structures/DashboardGroupStore.js b/Structures/DashboardGroupStore.js index 069bd86..76175ec 100644 --- a/Structures/DashboardGroupStore.js +++ b/Structures/DashboardGroupStore.js @@ -22,7 +22,7 @@ const DEFAULT_GROUPS = [ color: "#3B82F6", // Blue discordRoleId: null, isSystem: true, - permissions: fullPermissions(), + permissions: fullPermissions(false, false), }, { id: "support", @@ -151,6 +151,9 @@ function createGroup(payload = {}) { } function updateGroup(id, payload = {}) { + if (id === "owner") { + throw new Error('System group "Owner" cannot be modified.'); + } const groups = loadStore(); const index = groups.findIndex((g) => g.id === id); if (index === -1) { diff --git a/Structures/DashboardPermissions.js b/Structures/DashboardPermissions.js index bd3bdcd..4b6ae2b 100644 --- a/Structures/DashboardPermissions.js +++ b/Structures/DashboardPermissions.js @@ -17,29 +17,32 @@ function configMap(view, edit) { return configs; } -function fullPermissions() { +function fullPermissions(rawYaml = true, userManage = true) { return { overview: true, tickets: true, logs: true, transcripts: true, + rawYaml: Boolean(rawYaml), settings: { view: true, update: true }, configs: configMap(true, true), - users: { view: true, manage: true }, + users: { view: true, manage: Boolean(userManage) }, }; } function permissionsFromRole(role, customPermissions) { switch (role) { case "owner": + return fullPermissions(true, true); case "admin": - return fullPermissions(); + return fullPermissions(false, false); case "moderator": return { overview: true, tickets: true, logs: true, transcripts: true, + rawYaml: false, settings: { view: true, update: false }, configs: configMap(true, false), users: { view: false, manage: false }, @@ -50,6 +53,7 @@ function permissionsFromRole(role, customPermissions) { tickets: true, logs: true, transcripts: false, + rawYaml: false, settings: { view: true, update: false }, configs: configMap(true, true), users: { view: false, manage: false }, @@ -60,6 +64,7 @@ function permissionsFromRole(role, customPermissions) { tickets: true, logs: true, transcripts: true, + rawYaml: false, settings: { view: true, update: false }, configs: configMap(true, false), users: { view: false, manage: false }, @@ -80,6 +85,7 @@ function normalizePermissions(input) { tickets: input.tickets ?? input.overview ?? base.tickets, logs: input.logs ?? base.logs, transcripts: input.transcripts ?? base.transcripts, + rawYaml: Boolean(input.rawYaml ?? input.configs?.rawYaml ?? base.rawYaml), settings: { view: input.settings?.view ?? base.settings.view, update: input.settings?.update ?? base.settings.update, @@ -105,6 +111,9 @@ function hasPermission(permissions, check) { if (check === "tickets") return Boolean(permissions.tickets ?? permissions.overview); if (check === "logs") return Boolean(permissions.logs); if (check === "transcripts") return Boolean(permissions.transcripts); + if (check === "configs.raw_yaml" || check === "configs.rawYaml" || check === "rawYaml") { + return Boolean(permissions.rawYaml ?? permissions.configs?.rawYaml ?? false); + } if (check === "settings.view") return Boolean(permissions.settings?.view); if (check === "settings.update") return Boolean(permissions.settings?.update); if (check === "users.view") return Boolean(permissions.users?.view); diff --git a/Structures/DashboardSetup.js b/Structures/DashboardSetup.js index 1f4df8c..0d981b7 100644 --- a/Structures/DashboardSetup.js +++ b/Structures/DashboardSetup.js @@ -84,6 +84,7 @@ function getOwnerIds(oauth) { function buildSteps(apiRoot, supportbot) { const oauth = apiRoot?.OAuth || {}; const token = supportbot?.General?.Token; + const dbConfig = supportbot?.Database || {}; return [ { @@ -92,6 +93,12 @@ function buildSteps(apiRoot, supportbot) { description: "From the Discord Developer Portal → your application → Bot → Reset Token.", complete: isValidBotToken(token), }, + { + id: "database", + title: "Database storage", + description: "Choose SQLite or MySQL database engine for storing bot data.", + complete: Boolean(dbConfig.Driver), + }, { id: "secretKey", title: "Dashboard session secret", @@ -334,12 +341,58 @@ function validateSecretKey(secretKey) { return { ok: true }; } +async function validateDatabase(dbDriver, dbHost, dbPort, dbUser, dbPassword, dbDatabase) { + const driver = String(dbDriver || "sqlite").toLowerCase(); + if (driver === "mysql" || driver === "mariadb") { + const host = String(dbHost || "").trim(); + const port = Number(dbPort) || 3306; + const user = String(dbUser || "").trim(); + const password = String(dbPassword || ""); + const database = String(dbDatabase || "").trim(); + + if (isEmpty(host)) return { ok: false, error: "MySQL Host is required." }; + if (isEmpty(user)) return { ok: false, error: "MySQL User is required." }; + if (isEmpty(database)) return { ok: false, error: "MySQL Database Name is required." }; + + try { + const mysql = require("mysql2/promise"); + const connection = await mysql.createConnection({ + host, + port, + user, + password, + database, + connectTimeout: 5000, + }); + await connection.end(); + return { ok: true, driver: "mysql" }; + } catch (err) { + return { + ok: false, + error: `MySQL Connection Failed: ${err.message || err.code || "Could not connect to database host."}`, + }; + } + } + + return { ok: true, driver: "sqlite" }; +} + async function validateSetupPayload(payload) { const results = {}; if (payload.botToken != null) { results.botToken = await validateBotToken(payload.botToken); } + if (payload.dbDriver != null) { + results.database = await validateDatabase( + payload.dbDriver, + payload.dbHost, + payload.dbPort, + payload.dbUser, + payload.dbPassword, + payload.dbDatabase, + ); + } if (payload.secretKey != null) { results.secretKey = validateSecretKey(payload.secretKey); } @@ -415,7 +468,24 @@ function applySetup(payload) { fs.writeFileSync(API_FILE, apiDoc.toString()); const sbDoc = YAML.parseDocument(fs.readFileSync(SUPPORTBOT_FILE, "utf8")); - sbDoc.setIn(["General", "Token"], String(payload.botToken).trim()); + if (payload.botToken != null && String(payload.botToken).trim() !== "") { + sbDoc.setIn(["General", "Token"], String(payload.botToken).trim()); + } + + if (payload.dbDriver != null) { + const driver = String(payload.dbDriver).toLowerCase() === "mysql" ? "mysql" : "sqlite"; + sbDoc.setIn(["Database", "Driver"], driver); + if (driver === "mysql") { + sbDoc.setIn(["Database", "MySQL", "Host"], String(payload.dbHost || "127.0.0.1").trim()); + sbDoc.setIn(["Database", "MySQL", "Port"], Number(payload.dbPort) || 3306); + sbDoc.setIn(["Database", "MySQL", "User"], String(payload.dbUser || "").trim()); + sbDoc.setIn(["Database", "MySQL", "Password"], String(payload.dbPassword || "")); + sbDoc.setIn(["Database", "MySQL", "Database"], String(payload.dbDatabase || "").trim()); + } else { + sbDoc.setIn(["Database", "SQLite", "File"], "./Data/supportbot.db"); + } + } + fs.writeFileSync(SUPPORTBOT_FILE, sbDoc.toString()); configStore.reloadFile("api"); diff --git a/Structures/DashboardUserStore.js b/Structures/DashboardUserStore.js index dba2f35..2a4c9ef 100644 --- a/Structures/DashboardUserStore.js +++ b/Structures/DashboardUserStore.js @@ -160,12 +160,24 @@ function formatPublicUser(entry, access, discordProfile) { }; } -function listUsers(oauth) { +function listUsers(oauth, discordClient) { bootstrapFromOAuth(oauth); const store = readStore(); const yamlOwners = getOwnerIds(oauth); - return Object.values(store.users).map((entry) => { + let updated = false; + + const usersList = Object.values(store.users).map((entry) => { + if (discordClient?.users?.cache) { + const cached = discordClient.users.cache.get(String(entry.id)); + if (cached && (!entry.username || !entry.avatar)) { + entry.username = cached.username || entry.username; + entry.globalName = cached.globalName || cached.username || entry.globalName; + entry.avatar = cached.avatar || entry.avatar; + updated = true; + } + } + const access = resolvePermissions(entry, oauth, entry.id) || { permissions: permissionsFromRole("viewer"), role: entry.role, @@ -174,8 +186,8 @@ function listUsers(oauth) { return { id: entry.id, - username: entry.username, - globalName: entry.globalName, + username: entry.username || (yamlOwners.has(String(entry.id)) ? "Owner" : "User"), + globalName: entry.globalName || entry.username || null, avatar: entry.avatar ? discordAvatarUrl({ id: entry.id, avatar: entry.avatar }) : discordAvatarUrl({ id: entry.id, avatar: null }), @@ -192,6 +204,12 @@ function listUsers(oauth) { updatedAt: entry.updatedAt, }; }); + + if (updated) { + writeStore(store); + } + + return usersList; } function addUser(payload, actorId, oauth) { diff --git a/Structures/Database.js b/Structures/Database.js index d7b190e..381f970 100644 --- a/Structures/Database.js +++ b/Structures/Database.js @@ -1,40 +1,641 @@ -// SupportBot | JSON fallback adapter for environments without native addons (Pterodactyl) +// SupportBot | Unified SQL Database Adapter (MySQL/MariaDB & SQLite) const fs = require("fs"); const path = require("path"); +const yaml = require("js-yaml"); -const DB_PATH = path.join(__dirname, "../Data/supportbot.json"); +const CONFIG_PATH = path.join(__dirname, "../Configs/supportbot.yml"); +const LEGACY_JSON_PATH = path.join(__dirname, "../Data/supportbot.json"); +const SQLITE_DB_PATH = path.join(__dirname, "../Data/supportbot.db"); -function load() { - try { - const raw = fs.readFileSync(DB_PATH, "utf8"); - return JSON.parse(raw); - } catch (e) { - return { - suggestions: {}, - profiles: {}, - tickets: {}, - ticket_panel: [], - ticket_users: {}, - settings: {}, +// Load config +let dbConfig = { Driver: "sqlite", MySQL: {}, SQLite: { File: "./Data/supportbot.db" } }; +try { + if (fs.existsSync(CONFIG_PATH)) { + const rawYaml = fs.readFileSync(CONFIG_PATH, "utf8"); + const parsed = yaml.load(rawYaml); + if (parsed && parsed.Database) { + dbConfig = parsed.Database; + } + } +} catch (e) { + console.warn("[Database] Warning: Failed to parse Database section in supportbot.yml, defaulting to SQLite."); +} + +const driver = String(dbConfig.Driver || "sqlite").toLowerCase(); +const isMySQL = driver === "mysql" || driver === "mariadb"; + +let sqliteDb = null; +let mysqlPool = null; +let mysqlReady = false; +const mysqlWriteQueue = []; + +// In-memory state cache for synchronous, high-performance reads +const state = { + tickets: {}, + ticket_panel: [], + ticket_users: {}, + profiles: {}, + settings: {}, + blacklisted_users: {}, +}; + +// ---------------------------------------------------- +// Database Initialization +// ---------------------------------------------------- +function initDatabase() { + if (isMySQL) { + initMySQL(); + } else { + initSQLite(); + } + migrateLegacyJSON(); +} + +function initSQLite() { + const Database = require("better-sqlite3"); + const dbDir = path.dirname(SQLITE_DB_PATH); + if (!fs.existsSync(dbDir)) { + fs.mkdirSync(dbDir, { recursive: true }); + } + + sqliteDb = new Database(SQLITE_DB_PATH); + sqliteDb.pragma("journal_mode = WAL"); + + sqliteDb.exec(` + CREATE TABLE IF NOT EXISTS tickets ( + ticket_id TEXT PRIMARY KEY, + user_id TEXT, + subject TEXT, + description TEXT, + department TEXT, + priority TEXT, + status TEXT, + ai_mode_enabled INTEGER DEFAULT 0, + ai_channel_id TEXT, + ai_type TEXT, + ai_enabled_by TEXT, + ai_enabled_at INTEGER, + question_answers TEXT, + ticket_name TEXT, + ticket_number TEXT, + voice_channel_id TEXT, + created_at INTEGER, + updated_at INTEGER + ); + + CREATE TABLE IF NOT EXISTS ticket_panels ( + id INTEGER PRIMARY KEY, + message_id TEXT, + channel_id TEXT, + created_at INTEGER + ); + + CREATE TABLE IF NOT EXISTS ticket_users ( + ticket_id TEXT, + user_id TEXT, + PRIMARY KEY (ticket_id, user_id) + ); + + CREATE TABLE IF NOT EXISTS profiles ( + user_id TEXT PRIMARY KEY, + bio TEXT DEFAULT '', + timezone TEXT DEFAULT '', + clocked_in INTEGER DEFAULT 0 + ); + + CREATE TABLE IF NOT EXISTS settings ( + setting_key TEXT PRIMARY KEY, + setting_value TEXT + ); + + CREATE TABLE IF NOT EXISTS blacklisted_users ( + user_id TEXT PRIMARY KEY, + reason TEXT, + added_by TEXT, + created_at INTEGER + ); + `); + + loadSQLiteState(); + const clr = { reset: "\x1b[0m", gray: "\x1b[90m", green: "\x1b[32m", white: "\x1b[37m" }; + console.log(`${clr.green}✓${clr.reset} ${clr.white}Database Connected${clr.reset} ${clr.gray}to SQLite (${SQLITE_DB_PATH})${clr.reset}`); +} + +function loadSQLiteState() { + const tickets = sqliteDb.prepare("SELECT * FROM tickets").all(); + for (const r of tickets) { + state.tickets[r.ticket_id] = { + ticket_id: r.ticket_id, + user_id: r.user_id, + subject: r.subject || "", + description: r.description || "", + department: r.department || "general", + priority: r.priority || "medium", + status: r.status || "open", + aiModeEnabled: r.ai_mode_enabled, + aiChannelId: r.ai_channel_id, + aiType: r.ai_type, + aiEnabledBy: r.ai_enabled_by, + aiEnabledAt: r.ai_enabled_at, + questionAnswers: r.question_answers || "[]", + ticketName: r.ticket_name, + ticketNumber: r.ticket_number, + voiceChannelId: r.voice_channel_id, + created_at: r.created_at, + updated_at: r.updated_at, + }; + } + + const panels = sqliteDb.prepare("SELECT * FROM ticket_panels ORDER BY id ASC").all(); + state.ticket_panel = panels.map((p) => ({ + id: p.id, + message_id: p.message_id, + channel_id: p.channel_id, + created_at: p.created_at, + })); + + const ticketUsers = sqliteDb.prepare("SELECT * FROM ticket_users").all(); + for (const tu of ticketUsers) { + state.ticket_users[tu.ticket_id] = state.ticket_users[tu.ticket_id] || []; + if (!state.ticket_users[tu.ticket_id].includes(tu.user_id)) { + state.ticket_users[tu.ticket_id].push(tu.user_id); + } + } + + const profiles = sqliteDb.prepare("SELECT * FROM profiles").all(); + for (const p of profiles) { + state.profiles[p.user_id] = { + user_id: p.user_id, + bio: p.bio || "", + timezone: p.timezone || "", + clockedIn: p.clocked_in, + }; + } + + const settings = sqliteDb.prepare("SELECT * FROM settings").all(); + for (const s of settings) { + try { + state.settings[s.setting_key] = JSON.parse(s.setting_value); + } catch { + state.settings[s.setting_key] = s.setting_value; + } + } + + const blacklisted = sqliteDb.prepare("SELECT * FROM blacklisted_users").all(); + for (const b of blacklisted) { + state.blacklisted_users[b.user_id] = { + user_id: b.user_id, + reason: b.reason || "", + added_by: b.added_by || "", + created_at: b.created_at, }; } } -function save(state) { +function initMySQL() { + const mysql = require("mysql2"); + const mysqlOpts = dbConfig.MySQL || {}; + + mysqlPool = mysql.createPool({ + host: mysqlOpts.Host || "127.0.0.1", + port: mysqlOpts.Port || 3306, + user: mysqlOpts.User || "supportbot", + password: mysqlOpts.Password || "", + database: mysqlOpts.Database || "supportbot", + connectionLimit: mysqlOpts.ConnectionLimit || 10, + waitForConnections: true, + }); + + const poolPromise = mysqlPool.promise(); + + (async () => { + try { + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS tickets ( + ticket_id VARCHAR(255) PRIMARY KEY, + user_id VARCHAR(255), + subject TEXT, + description TEXT, + department VARCHAR(255), + priority VARCHAR(255), + status VARCHAR(255), + ai_mode_enabled INT DEFAULT 0, + ai_channel_id VARCHAR(255), + ai_type VARCHAR(255), + ai_enabled_by VARCHAR(255), + ai_enabled_at BIGINT, + question_answers TEXT, + ticket_name VARCHAR(255), + ticket_number VARCHAR(255), + voice_channel_id VARCHAR(255), + created_at BIGINT, + updated_at BIGINT + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS ticket_panels ( + id BIGINT PRIMARY KEY, + message_id VARCHAR(255), + channel_id VARCHAR(255), + created_at BIGINT + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS ticket_users ( + ticket_id VARCHAR(255), + user_id VARCHAR(255), + PRIMARY KEY (ticket_id, user_id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS profiles ( + user_id VARCHAR(255) PRIMARY KEY, + bio TEXT, + timezone VARCHAR(255), + clocked_in INT DEFAULT 0 + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS settings ( + setting_key VARCHAR(255) PRIMARY KEY, + setting_value LONGTEXT + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + await poolPromise.query(` + CREATE TABLE IF NOT EXISTS blacklisted_users ( + user_id VARCHAR(255) PRIMARY KEY, + reason TEXT, + added_by VARCHAR(255), + created_at BIGINT + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `); + + // Load initial state from MySQL + const [tickets] = await poolPromise.query("SELECT * FROM tickets"); + for (const r of tickets) { + state.tickets[r.ticket_id] = { + ticket_id: r.ticket_id, + user_id: r.user_id, + subject: r.subject || "", + description: r.description || "", + department: r.department || "general", + priority: r.priority || "medium", + status: r.status || "open", + aiModeEnabled: r.ai_mode_enabled, + aiChannelId: r.ai_channel_id, + aiType: r.ai_type, + aiEnabledBy: r.ai_enabled_by, + aiEnabledAt: r.ai_enabled_at, + questionAnswers: r.question_answers || "[]", + ticketName: r.ticket_name, + ticketNumber: r.ticket_number, + voiceChannelId: r.voice_channel_id, + created_at: Number(r.created_at), + updated_at: Number(r.updated_at), + }; + } + + const [panels] = await poolPromise.query("SELECT * FROM ticket_panels ORDER BY id ASC"); + state.ticket_panel = panels.map((p) => ({ + id: Number(p.id), + message_id: p.message_id, + channel_id: p.channel_id, + created_at: Number(p.created_at), + })); + + const [ticketUsers] = await poolPromise.query("SELECT * FROM ticket_users"); + for (const tu of ticketUsers) { + state.ticket_users[tu.ticket_id] = state.ticket_users[tu.ticket_id] || []; + if (!state.ticket_users[tu.ticket_id].includes(tu.user_id)) { + state.ticket_users[tu.ticket_id].push(tu.user_id); + } + } + + const [profiles] = await poolPromise.query("SELECT * FROM profiles"); + for (const p of profiles) { + state.profiles[p.user_id] = { + user_id: p.user_id, + bio: p.bio || "", + timezone: p.timezone || "", + clockedIn: p.clocked_in, + }; + } + + const [settings] = await poolPromise.query("SELECT * FROM settings"); + for (const s of settings) { + try { + state.settings[s.setting_key] = JSON.parse(s.setting_value); + } catch { + state.settings[s.setting_key] = s.setting_value; + } + } + + const [blacklisted] = await poolPromise.query("SELECT * FROM blacklisted_users"); + for (const b of blacklisted) { + state.blacklisted_users[b.user_id] = { + user_id: b.user_id, + reason: b.reason || "", + added_by: b.added_by || "", + created_at: Number(b.created_at), + }; + } + + mysqlReady = true; + const clr = { reset: "\x1b[0m", gray: "\x1b[90m", green: "\x1b[32m", white: "\x1b[37m" }; + console.log(`${clr.green}✓${clr.reset} ${clr.white}Database Connected${clr.reset} ${clr.gray}to MySQL (${mysqlOpts.Host}:${mysqlOpts.Port}/${mysqlOpts.Database})${clr.reset}`); + + while (mysqlWriteQueue.length > 0) { + const fn = mysqlWriteQueue.shift(); + try { fn(); } catch (e) {} + } + } catch (err) { + console.error("[Database] Error initializing MySQL tables or state:", err.message); + } + })(); +} + +// ---------------------------------------------------- +// Legacy JSON Migration Utility +// ---------------------------------------------------- +function migrateLegacyJSON() { + if (!fs.existsSync(LEGACY_JSON_PATH)) return; + try { - fs.mkdirSync(path.dirname(DB_PATH), { recursive: true }); - fs.writeFileSync(DB_PATH, JSON.stringify(state, null, 2), "utf8"); + const raw = fs.readFileSync(LEGACY_JSON_PATH, "utf8"); + const jsonState = JSON.parse(raw); + console.log("[Database] Legacy supportbot.json detected. Migrating records to SQL..."); + + if (jsonState.tickets) { + for (const tId of Object.keys(jsonState.tickets)) { + const t = jsonState.tickets[tId]; + if (t && !state.tickets[tId]) { + const ticketObj = { + id: t.ticket_id || tId, + user: t.user_id, + reason: t.subject, + description: t.description, + department: t.department, + priority: t.priority, + aiModeEnabled: t.aiModeEnabled, + aiChannelId: t.aiChannelId, + aiType: t.aiType, + aiEnabledBy: t.aiEnabledBy, + aiEnabledAt: t.aiEnabledAt, + questionAnswers: typeof t.questionAnswers === "string" ? JSON.parse(t.questionAnswers) : t.questionAnswers || [], + name: t.ticketName, + number: t.ticketNumber, + }; + exportsModule.addTicket(ticketObj); + } + } + } + + if (jsonState.ticket_panel && Array.isArray(jsonState.ticket_panel)) { + for (const p of jsonState.ticket_panel) { + exportsModule.saveTicketPanel(p.message_id, p.channel_id); + } + } + + if (jsonState.profiles) { + for (const uId of Object.keys(jsonState.profiles)) { + const prof = jsonState.profiles[uId]; + if (prof) { + state.profiles[uId] = prof; + persistProfile(uId); + } + } + } + + if (jsonState.settings) { + exportsModule.saveSettings(jsonState.settings); + } + + // Archive legacy json file + const backupPath = LEGACY_JSON_PATH + ".bak"; + fs.renameSync(LEGACY_JSON_PATH, backupPath); + console.log(`[Database] Legacy supportbot.json successfully migrated and archived to ${backupPath}`); } catch (e) { - console.error("Failed to persist database:", e); + console.error("[Database] Failed to migrate legacy supportbot.json:", e); + } + + // Migrate legacy BlacklistedUsers.json if present + const legacyBlacklistPath = path.join(__dirname, "../Data/BlacklistedUsers.json"); + if (fs.existsSync(legacyBlacklistPath)) { + try { + const raw = fs.readFileSync(legacyBlacklistPath, "utf8"); + const data = JSON.parse(raw); + if (data && Array.isArray(data.blacklistedUsers)) { + for (const uId of data.blacklistedUsers) { + exportsModule.addBlacklistedUser(uId, "Migrated from BlacklistedUsers.json", "System"); + } + } + fs.renameSync(legacyBlacklistPath, legacyBlacklistPath + ".bak"); + console.log(`[Database] Legacy BlacklistedUsers.json successfully migrated and archived.`); + } catch (e) { + console.error("[Database] Failed to migrate BlacklistedUsers.json:", e); + } } } -const state = load(); +// ---------------------------------------------------- +// SQL Persistence Helpers +// ---------------------------------------------------- +function persistTicket(ticketId) { + const t = state.tickets[ticketId]; + if (!t) return; + + if (isMySQL && mysqlPool) { + const sql = ` + INSERT INTO tickets ( + ticket_id, user_id, subject, description, department, priority, status, + ai_mode_enabled, ai_channel_id, ai_type, ai_enabled_by, ai_enabled_at, + question_answers, ticket_name, ticket_number, voice_channel_id, created_at, updated_at + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ON DUPLICATE KEY UPDATE + user_id=VALUES(user_id), subject=VALUES(subject), description=VALUES(description), + department=VALUES(department), priority=VALUES(priority), status=VALUES(status), + ai_mode_enabled=VALUES(ai_mode_enabled), ai_channel_id=VALUES(ai_channel_id), + ai_type=VALUES(ai_type), ai_enabled_by=VALUES(ai_enabled_by), ai_enabled_at=VALUES(ai_enabled_at), + question_answers=VALUES(question_answers), ticket_name=VALUES(ticket_name), + ticket_number=VALUES(ticket_number), voice_channel_id=VALUES(voice_channel_id), updated_at=VALUES(updated_at); + `; + const params = [ + t.ticket_id, + t.user_id || "", + t.subject || "", + t.description || "", + t.department || "general", + t.priority || "medium", + t.status || "open", + t.aiModeEnabled ? 1 : 0, + t.aiChannelId || null, + t.aiType || null, + t.aiEnabledBy || null, + t.aiEnabledAt || null, + typeof t.questionAnswers === "string" ? t.questionAnswers : JSON.stringify(t.questionAnswers || []), + t.ticketName || null, + t.ticketNumber || null, + t.voiceChannelId || null, + t.created_at || Date.now(), + t.updated_at || Date.now(), + ]; + mysqlPool.query(sql, params, (err) => { + if (err) console.error("[Database] MySQL persistTicket error:", err.message); + }); + } else if (sqliteDb) { + const stmt = sqliteDb.prepare(` + INSERT INTO tickets ( + ticket_id, user_id, subject, description, department, priority, status, + ai_mode_enabled, ai_channel_id, ai_type, ai_enabled_by, ai_enabled_at, + question_answers, ticket_name, ticket_number, voice_channel_id, created_at, updated_at + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ON CONFLICT(ticket_id) DO UPDATE SET + user_id=excluded.user_id, subject=excluded.subject, description=excluded.description, + department=excluded.department, priority=excluded.priority, status=excluded.status, + ai_mode_enabled=excluded.ai_mode_enabled, ai_channel_id=excluded.ai_channel_id, + ai_type=excluded.ai_type, ai_enabled_by=excluded.ai_enabled_by, ai_enabled_at=excluded.ai_enabled_at, + question_answers=excluded.question_answers, ticket_name=excluded.ticket_name, + ticket_number=excluded.ticket_number, voice_channel_id=excluded.voice_channel_id, updated_at=excluded.updated_at; + `); + stmt.run( + t.ticket_id, + t.user_id || "", + t.subject || "", + t.description || "", + t.department || "general", + t.priority || "medium", + t.status || "open", + t.aiModeEnabled ? 1 : 0, + t.aiChannelId || null, + t.aiType || null, + t.aiEnabledBy || null, + t.aiEnabledAt || null, + typeof t.questionAnswers === "string" ? t.questionAnswers : JSON.stringify(t.questionAnswers || []), + t.ticketName || null, + t.ticketNumber || null, + t.voiceChannelId || null, + t.created_at || Date.now(), + t.updated_at || Date.now() + ); + } +} + +function persistPanel(panelRow) { + if (isMySQL && mysqlPool) { + mysqlPool.query( + "INSERT INTO ticket_panels (id, message_id, channel_id, created_at) VALUES (?, ?, ?, ?)", + [panelRow.id, panelRow.message_id, panelRow.channel_id, panelRow.created_at], + (err) => { + if (err) console.error("[Database] MySQL persistPanel error:", err.message); + } + ); + } else if (sqliteDb) { + const stmt = sqliteDb.prepare("INSERT INTO ticket_panels (id, message_id, channel_id, created_at) VALUES (?, ?, ?, ?)"); + stmt.run(panelRow.id, panelRow.message_id, panelRow.channel_id, panelRow.created_at); + } +} + +function persistTicketUser(ticketId, userId, action = "add") { + if (action === "add") { + if (isMySQL && mysqlPool) { + mysqlPool.query("INSERT IGNORE INTO ticket_users (ticket_id, user_id) VALUES (?, ?)", [ticketId, userId], (err) => { + if (err) console.error("[Database] MySQL persistTicketUser error:", err.message); + }); + } else if (sqliteDb) { + sqliteDb.prepare("INSERT OR IGNORE INTO ticket_users (ticket_id, user_id) VALUES (?, ?)").run(ticketId, userId); + } + } else { + if (isMySQL && mysqlPool) { + mysqlPool.query("DELETE FROM ticket_users WHERE ticket_id = ? AND user_id = ?", [ticketId, userId], (err) => { + if (err) console.error("[Database] MySQL deleteTicketUser error:", err.message); + }); + } else if (sqliteDb) { + sqliteDb.prepare("DELETE FROM ticket_users WHERE ticket_id = ? AND user_id = ?").run(ticketId, userId); + } + } +} + +function persistProfile(userId) { + const p = state.profiles[userId]; + if (!p) return; + + if (isMySQL && mysqlPool) { + const sql = ` + INSERT INTO profiles (user_id, bio, timezone, clocked_in) VALUES (?, ?, ?, ?) + ON DUPLICATE KEY UPDATE bio=VALUES(bio), timezone=VALUES(timezone), clocked_in=VALUES(clocked_in); + `; + mysqlPool.query(sql, [p.user_id, p.bio || "", p.timezone || "", p.clockedIn ? 1 : 0], (err) => { + if (err) console.error("[Database] MySQL persistProfile error:", err.message); + }); + } else if (sqliteDb) { + const stmt = sqliteDb.prepare(` + INSERT INTO profiles (user_id, bio, timezone, clocked_in) VALUES (?, ?, ?, ?) + ON CONFLICT(user_id) DO UPDATE SET bio=excluded.bio, timezone=excluded.timezone, clocked_in=excluded.clocked_in; + `); + stmt.run(p.user_id, p.bio || "", p.timezone || "", p.clockedIn ? 1 : 0); + } +} + +function persistSettings() { + const settingsObj = state.settings || {}; + for (const k of Object.keys(settingsObj)) { + const val = JSON.stringify(settingsObj[k]); + if (isMySQL && mysqlPool) { + mysqlPool.query( + "INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value=VALUES(setting_value)", + [k, val], + (err) => { + if (err) console.error("[Database] MySQL persistSettings error:", err.message); + } + ); + } else if (sqliteDb) { + sqliteDb.prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON CONFLICT(setting_key) DO UPDATE SET setting_value=excluded.setting_value").run(k, val); + } + } +} + +function persistBlacklistedUser(userId, action = "add") { + if (isMySQL && !mysqlReady) { + mysqlWriteQueue.push(() => persistBlacklistedUser(userId, action)); + return; + } + const b = state.blacklisted_users[userId]; + if (action === "add" && b) { + if (isMySQL && mysqlPool) { + const sql = ` + INSERT INTO blacklisted_users (user_id, reason, added_by, created_at) VALUES (?, ?, ?, ?) + ON DUPLICATE KEY UPDATE reason=VALUES(reason), added_by=VALUES(added_by), created_at=VALUES(created_at); + `; + mysqlPool.query(sql, [b.user_id, b.reason || "", b.added_by || "", b.created_at || Date.now()], (err) => { + if (err) console.error("[Database] MySQL persistBlacklistedUser error:", err.message); + }); + } else if (sqliteDb) { + const stmt = sqliteDb.prepare(` + INSERT INTO blacklisted_users (user_id, reason, added_by, created_at) VALUES (?, ?, ?, ?) + ON CONFLICT(user_id) DO UPDATE SET reason=excluded.reason, added_by=excluded.added_by, created_at=excluded.created_at; + `); + stmt.run(b.user_id, b.reason || "", b.added_by || "", b.created_at || Date.now()); + } + } else { + if (isMySQL && mysqlPool) { + mysqlPool.query("DELETE FROM blacklisted_users WHERE user_id = ?", [userId], (err) => { + if (err) console.error("[Database] MySQL removeBlacklistedUser error:", err.message); + }); + } else if (sqliteDb) { + sqliteDb.prepare("DELETE FROM blacklisted_users WHERE user_id = ?").run(userId); + } + } +} function ensureProfile(userId) { if (!state.profiles[userId]) { state.profiles[userId] = { user_id: userId, bio: "", timezone: "", clockedIn: 0 }; - save(state); + persistProfile(userId); } } @@ -43,7 +644,7 @@ function normaliseTicketRow(row) { let questionAnswers = []; if (row.questionAnswers) { try { - questionAnswers = JSON.parse(row.questionAnswers); + questionAnswers = typeof row.questionAnswers === "string" ? JSON.parse(row.questionAnswers) : row.questionAnswers; } catch { questionAnswers = []; } @@ -57,7 +658,7 @@ function normaliseTicketRow(row) { }; } -module.exports = { +const exportsModule = { addTicket(ticket) { const now = Date.now(); const id = ticket.id; @@ -84,7 +685,7 @@ module.exports = { status: existing.status || "open", }; - save(state); + persistTicket(id); if (global.apiServer) { global.apiServer.broadcast("ticket_created", { @@ -104,7 +705,7 @@ module.exports = { if (!t) return; t.questionAnswers = JSON.stringify(questionAnswers); t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, updateTicketVoice(ticketId, voiceChannelId) { @@ -112,7 +713,7 @@ module.exports = { if (!t) return; t.voiceChannelId = voiceChannelId; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, updateTicketStatus(ticketId, status) { @@ -120,7 +721,7 @@ module.exports = { if (!t) return; t.status = status; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); if (global.apiServer && status === "closed") { global.apiServer.broadcast("ticket_closed", { ticket_id: ticketId }); @@ -132,7 +733,7 @@ module.exports = { if (!t) return; t.department = department; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, updateTicketPriority(ticketId, priority) { @@ -140,7 +741,7 @@ module.exports = { if (!t) return; t.priority = priority; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, setTicketAIState(ticketId, aiState = {}) { @@ -152,7 +753,7 @@ module.exports = { t.aiEnabledBy = aiState.enabledBy || null; t.aiEnabledAt = aiState.enabledAt ? new Date(aiState.enabledAt).getTime() : aiState.enabled ? Date.now() : null; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, enableTicketAI(ticketId, aiChannelId = null, aiType = null, enabledBy = null) { @@ -164,7 +765,7 @@ module.exports = { t.aiEnabledBy = enabledBy; t.aiEnabledAt = Date.now(); t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, disableTicketAI(ticketId) { @@ -172,7 +773,7 @@ module.exports = { if (!t) return; t.aiModeEnabled = 0; t.updated_at = Date.now(); - save(state); + persistTicket(ticketId); }, getTicket(ticketId) { @@ -193,8 +794,9 @@ module.exports = { }, saveTicketPanel(messageId, channelId) { - state.ticket_panel.push({ id: Date.now(), message_id: messageId, channel_id: channelId, created_at: Date.now() }); - save(state); + const row = { id: Date.now(), message_id: messageId, channel_id: channelId, created_at: Date.now() }; + state.ticket_panel.push(row); + persistPanel(row); }, getTicketPanel() { @@ -204,19 +806,18 @@ module.exports = { }, addUserToTicket(ticketId, userId) { - state.ticket_users[ticketId] = state.ticket_users[ticketId] || new Set(); - // Sets cannot be serialized directly; store as array - const arr = new Set(state.ticket_users[ticketId]); - arr.add(userId); - state.ticket_users[ticketId] = Array.from(arr); - save(state); + state.ticket_users[ticketId] = state.ticket_users[ticketId] || []; + if (!state.ticket_users[ticketId].includes(userId)) { + state.ticket_users[ticketId].push(userId); + persistTicketUser(ticketId, userId, "add"); + } }, removeUserFromTicket(ticketId, userId) { - const arr = new Set(state.ticket_users[ticketId] || []); - arr.delete(userId); - state.ticket_users[ticketId] = Array.from(arr); - save(state); + if (state.ticket_users[ticketId]) { + state.ticket_users[ticketId] = state.ticket_users[ticketId].filter((u) => u !== userId); + persistTicketUser(ticketId, userId, "remove"); + } }, getTicketUsers(ticketId) { @@ -237,11 +838,64 @@ module.exports = { setClockedIn(userId, clockedIn) { ensureProfile(userId); state.profiles[userId].clockedIn = clockedIn ? 1 : 0; - save(state); + persistProfile(userId); }, saveSettings(obj) { state.settings = obj || {}; - save(state); + persistSettings(); + }, + + addBlacklistedUser(userId, reason = "", addedBy = "") { + state.blacklisted_users[userId] = { + user_id: userId, + reason, + added_by: addedBy, + created_at: Date.now(), + }; + persistBlacklistedUser(userId, "add"); + }, + + removeBlacklistedUser(userId) { + if (state.blacklisted_users[userId]) { + delete state.blacklisted_users[userId]; + persistBlacklistedUser(userId, "remove"); + } + }, + + isUserBlacklisted(userId) { + return Boolean(state.blacklisted_users[userId]); + }, + + getBlacklistedUsers() { + return Object.keys(state.blacklisted_users); + }, + + getBlacklistedUserDetails() { + return Object.values(state.blacklisted_users); + }, + + getDatabaseInfo() { + if (isMySQL) { + const mysqlOpts = dbConfig.MySQL || {}; + return { + driver: "MySQL", + host: mysqlOpts.Host || "127.0.0.1", + port: mysqlOpts.Port || 3306, + database: mysqlOpts.Database || "supportbot", + type: "mysql" + }; + } + const sqliteOpts = dbConfig.SQLite || {}; + return { + driver: "SQLite", + file: sqliteOpts.File || "./Data/supportbot.db", + type: "sqlite" + }; }, }; + +// Initialize database on require +initDatabase(); + +module.exports = exportsModule; diff --git a/Structures/GuildManager.js b/Structures/GuildManager.js index 537117b..3298ce3 100644 --- a/Structures/GuildManager.js +++ b/Structures/GuildManager.js @@ -180,6 +180,7 @@ function buildResourcesFromGuild(guild) { return { guildId: guild.id, guildName: guild.name, + guildIcon: guild.iconURL({ extension: "png", size: 64 }) || null, roles, channels, categories, diff --git a/Structures/TicketID.js b/Structures/TicketID.js index 7fb941e..d7e25a0 100644 --- a/Structures/TicketID.js +++ b/Structures/TicketID.js @@ -1,30 +1,46 @@ // SupportBot | Emerald Services // Ticket ID Structure -const db = require("./Database") +const db = require("./Database"); class TicketNumberID { static async pad() { - let num = await this.get() - let n = num + "" - await this.set(num + 1) - return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n + let num = await this.get(); + let n = num + ""; + await this.set(num + 1); + return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n; } static async get() { - const row = db.getTicketPanel() - if (!row) return await this.set(0) - return row.id + const settings = db.getSettings ? db.getSettings() : {}; + if (typeof settings.ticket_counter === "number") { + return settings.ticket_counter; + } + + const row = db.getTicketPanel ? db.getTicketPanel() : null; + if (row && typeof row.message_id === "string" && row.message_id.startsWith("panel-")) { + const parsed = parseInt(row.message_id.replace("panel-", ""), 10); + if (!isNaN(parsed)) return parsed; + } + + if (row && typeof row.id === "number" && row.id < 1000000) { + return row.id; + } + + return 0; } static async set(value) { - db.saveTicketPanel(`panel-${value}`, "none") - return value + const settings = db.getSettings ? db.getSettings() : {}; + settings.ticket_counter = value; + if (db.saveSettings) db.saveSettings(settings); + if (db.saveTicketPanel) db.saveTicketPanel(`panel-${value}`, "none"); + return value; } static async reset() { - return await this.set(0) + return await this.set(0); } } -module.exports = TicketNumberID +module.exports = TicketNumberID; diff --git a/index.js b/index.js index c03fb79..39529f4 100644 --- a/index.js +++ b/index.js @@ -20,27 +20,30 @@ const client = new Client({ intents: ["Guilds", "GuildMembers", "GuildMessages", "MessageContent"], }); +const { isSetupComplete } = require("./Structures/DashboardSetup.js"); const APIServer = require("./API/server.js"); -// Start dashboard API immediately — do not wait for Discord clientReady const api = new APIServer(client); client.apiServer = api; +const port = api.config?.Port || 25575; if (api.config?.Enabled) { - const port = api.config.Port || 3000; api.start(port); - console.log( - `[Dashboard] API listening on http://localhost:${port} (bot may still be connecting)`, - ); + if (!isSetupComplete()) { + console.log(`\n\x1b[33m\x1b[1m[Setup Required] Go to http://localhost:${port}/setup to set up your bot and dashboard.\x1b[0m\n`); + } } else { console.warn("[Dashboard] API disabled in Configs/api.yml"); } -client.start(configStore.supportbot.General.Token); +const token = configStore.supportbot?.General?.Token; +const isPlaceholderToken = !token || token.includes("BOT_TOKEN") || token.includes("CHANGE_ME") || token.length < 30; -client.on("clientReady", () => { - console.log("[Dashboard] Discord bot is ready — full stats and guild tools are available"); -}); +if (isPlaceholderToken) { + console.warn(`\x1b[33m[SupportBot] Bot token is not configured yet. Complete setup at http://localhost:${port}/setup\x1b[0m`); +} else { + client.start(token); +} // SupportBot - New Logging System diff --git a/package.json b/package.json index 9df8d29..5a9f1ce 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "js-yaml": "^4.1.0", "moment": "^2.29.3", "ms": "^2.1.3", + "mysql2": "^3.23.3", "openai": "^4.50.0", "systeminformation": "^5.31.5", "yaml": "^2.8.3" diff --git a/public/dashboard/assets/index-BpDEEtaJ.js b/public/dashboard/assets/index-BpDEEtaJ.js deleted file mode 100644 index 05bdc74..0000000 --- a/public/dashboard/assets/index-BpDEEtaJ.js +++ /dev/null @@ -1,206 +0,0 @@ -var h3=Object.defineProperty;var g3=(e,n,a)=>n in e?h3(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var $b=(e,n,a)=>g3(e,typeof n!="symbol"?n+"":n,a);function x3(e,n){for(var a=0;ao[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function a(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=a(l);fetch(l.href,c)}})();function A0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},Fi={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Bb;function v3(){if(Bb)return Fi;Bb=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(o,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var m in l)m!=="key"&&(c[m]=l[m])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:d,ref:l!==void 0?l:null,props:c}}return Fi.Fragment=n,Fi.jsx=a,Fi.jsxs=a,Fi}var Ub;function b3(){return Ub||(Ub=1,Jm.exports=v3()),Jm.exports}var s=b3(),ep={exports:{}},Pe={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Hb;function y3(){if(Hb)return Pe;Hb=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function w(_){return _===null||typeof _!="object"?null:(_=y&&_[y]||_["@@iterator"],typeof _=="function"?_:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function N(_,D,G){this.props=_,this.context=D,this.refs=E,this.updater=G||j}N.prototype.isReactComponent={},N.prototype.setState=function(_,D){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,D,"setState")},N.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function k(){}k.prototype=N.prototype;function T(_,D,G){this.props=_,this.context=D,this.refs=E,this.updater=G||j}var A=T.prototype=new k;A.constructor=T,S(A,N.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function M(){}var z={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function K(_,D,G){var V=G.ref;return{$$typeof:e,type:_,key:D,ref:V!==void 0?V:null,props:G}}function U(_,D){return K(_.type,D,_.props)}function q(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function ue(_){var D={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(G){return D[G]})}var pe=/\/+/g;function xe(_,D){return typeof _=="object"&&_!==null&&_.key!=null?ue(""+_.key):D.toString(36)}function se(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(M,M):(_.status="pending",_.then(function(D){_.status==="pending"&&(_.status="fulfilled",_.value=D)},function(D){_.status==="pending"&&(_.status="rejected",_.reason=D)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function L(_,D,G,V,F){var oe=typeof _;(oe==="undefined"||oe==="boolean")&&(_=null);var ae=!1;if(_===null)ae=!0;else switch(oe){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(_.$$typeof){case e:case n:ae=!0;break;case b:return ae=_._init,L(ae(_._payload),D,G,V,F)}}if(ae)return F=F(_),ae=V===""?"."+xe(_,0):V,O(F)?(G="",ae!=null&&(G=ae.replace(pe,"$&/")+"/"),L(F,D,G,"",function(Y){return Y})):F!=null&&(q(F)&&(F=U(F,G+(F.key==null||_&&_.key===F.key?"":(""+F.key).replace(pe,"$&/")+"/")+ae)),D.push(F)),1;ae=0;var be=V===""?".":V+":";if(O(_))for(var ve=0;ve<_.length;ve++)V=_[ve],oe=be+xe(V,ve),ae+=L(V,D,G,oe,F);else if(ve=w(_),typeof ve=="function")for(_=ve.call(_),ve=0;!(V=_.next()).done;)V=V.value,oe=be+xe(V,ve++),ae+=L(V,D,G,oe,F);else if(oe==="object"){if(typeof _.then=="function")return L(se(_),D,G,V,F);throw D=String(_),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return ae}function I(_,D,G){if(_==null)return _;var V=[],F=0;return L(_,V,"","",function(oe){return D.call(G,oe,F++)}),V}function H(_){if(_._status===-1){var D=_._result;D=D(),D.then(function(G){(_._status===0||_._status===-1)&&(_._status=1,_._result=G)},function(G){(_._status===0||_._status===-1)&&(_._status=2,_._result=G)}),_._status===-1&&(_._status=0,_._result=D)}if(_._status===1)return _._result.default;throw _._result}var Z=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},te={map:I,forEach:function(_,D,G){I(_,function(){D.apply(this,arguments)},G)},count:function(_){var D=0;return I(_,function(){D++}),D},toArray:function(_){return I(_,function(D){return D})||[]},only:function(_){if(!q(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Pe.Activity=g,Pe.Children=te,Pe.Component=N,Pe.Fragment=a,Pe.Profiler=l,Pe.PureComponent=T,Pe.StrictMode=o,Pe.Suspense=p,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(_){return z.H.useMemoCache(_)}},Pe.cache=function(_){return function(){return _.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(_,D,G){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var V=S({},_.props),F=_.key;if(D!=null)for(oe in D.key!==void 0&&(F=""+D.key),D)!B.call(D,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&D.ref===void 0||(V[oe]=D[oe]);var oe=arguments.length-2;if(oe===1)V.children=G;else if(1>>1,te=L[Z];if(0>>1;Z<_;){var D=2*(Z+1)-1,G=L[D],V=D+1,F=L[V];if(0>l(G,H))Vl(F,G)?(L[Z]=F,L[V]=H,Z=V):(L[Z]=G,L[D]=H,Z=D);else if(Vl(F,H))L[Z]=F,L[V]=H,Z=V;else break e}}return I}function l(L,I){var H=L.sortIndex-I.sortIndex;return H!==0?H:L.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,m=d.now();e.unstable_now=function(){return d.now()-m}}var p=[],h=[],b=1,g=null,y=3,w=!1,j=!1,S=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function A(L){for(var I=a(h);I!==null;){if(I.callback===null)o(h);else if(I.startTime<=L)o(h),I.sortIndex=I.expirationTime,n(p,I);else break;I=a(h)}}function O(L){if(S=!1,A(L),!j)if(a(p)!==null)j=!0,M||(M=!0,ue());else{var I=a(h);I!==null&&se(O,I.startTime-L)}}var M=!1,z=-1,B=5,K=-1;function U(){return E?!0:!(e.unstable_now()-KL&&U());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,y=g.priorityLevel;var te=Z(g.expirationTime<=L);if(L=e.unstable_now(),typeof te=="function"){g.callback=te,A(L),I=!0;break t}g===a(p)&&o(p),A(L)}else o(p);g=a(p)}if(g!==null)I=!0;else{var _=a(h);_!==null&&se(O,_.startTime-L),I=!1}}break e}finally{g=null,y=H,w=!1}I=void 0}}finally{I?ue():M=!1}}}var ue;if(typeof T=="function")ue=function(){T(q)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,xe=pe.port2;pe.port1.onmessage=q,ue=function(){xe.postMessage(null)}}else ue=function(){N(q,0)};function se(L,I){z=N(function(){L(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125Z?(L.sortIndex=H,n(h,L),a(p)===null&&L===a(h)&&(S?(k(z),z=-1):S=!0,se(O,H-Z))):(L.sortIndex=te,n(p,L),j||w||(j=!0,M||(M=!0,ue()))),L},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(L){var I=y;return function(){var H=y;y=I;try{return L.apply(this,arguments)}finally{y=H}}}})(rp)),rp}var Fb;function C3(){return Fb||(Fb=1,np.exports=w3()),np.exports}var ap={exports:{}},ln={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Wb;function S3(){if(Wb)return ln;Wb=1;var e=Ku();function n(p){var h="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ap.exports=S3(),ap.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var qb;function j3(){if(qb)return Wi;qb=1;var e=C3(),n=Ku(),a=M0();function o(t){var r="https://react.dev/errors/"+t;if(1te||(t.current=Z[te],Z[te]=null,te--)}function G(t,r){te++,Z[te]=t.current,t.current=r}var V=_(null),F=_(null),oe=_(null),ae=_(null);function be(t,r){switch(G(oe,r),G(F,t),G(V,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?lb(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=lb(r),t=cb(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}D(V),G(V,t)}function ve(){D(V),D(F),D(oe)}function Y(t){t.memoizedState!==null&&G(ae,t);var r=V.current,i=cb(r,t.type);r!==i&&(G(F,t),G(V,i))}function le(t){F.current===t&&(D(V),D(F)),ae.current===t&&(D(ae),Ui._currentValue=H)}var ye,Te;function Le(t){if(ye===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);ye=r&&r[1]||"",Te=-1)":-1x||P[u]!==Q[x]){var ie=` -`+P[u].replace(" at new "," at ");return t.displayName&&ie.includes("")&&(ie=ie.replace("",t.displayName)),ie}while(1<=u&&0<=x);break}}}finally{rt=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Le(i):""}function Mt(t,r){switch(t.tag){case 26:case 27:case 5:return Le(t.type);case 16:return Le("Lazy");case 13:return t.child!==r&&r!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return ht(t.type,!1);case 11:return ht(t.type.render,!1);case 1:return ht(t.type,!0);case 31:return Le("Activity");default:return""}}function Tr(t){try{var r="",i=null;do r+=Mt(t,i),i=t,t=t.return;while(t);return r}catch(u){return` -Error generating stack: `+u.message+` -`+u.stack}}var _t=Object.prototype.hasOwnProperty,Ya=e.unstable_scheduleCallback,qa=e.unstable_cancelCallback,qt=e.unstable_shouldYield,dr=e.unstable_requestPaint,Kt=e.unstable_now,ti=e.unstable_getCurrentPriorityLevel,fr=e.unstable_ImmediatePriority,Lo=e.unstable_UserBlockingPriority,Rr=e.unstable_NormalPriority,Xt=e.unstable_LowPriority,Qn=e.unstable_IdlePriority,zo=e.log,mr=e.unstable_setDisableYieldValue,pr=null,Ht=null;function ee(t){if(typeof zo=="function"&&mr(t),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(pr,t)}catch{}}var re=Math.clz32?Math.clz32:De,ke=Math.log,we=Math.LN2;function De(t){return t>>>=0,t===0?32:31-(ke(t)/we|0)|0}var at=256,ct=262144,mt=4194304;function Zt(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Me(t,r,i){var u=t.pendingLanes;if(u===0)return 0;var x=0,v=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var R=u&134217727;return R!==0?(u=R&~v,u!==0?x=Zt(u):(C&=R,C!==0?x=Zt(C):i||(i=R&~t,i!==0&&(x=Zt(i))))):(R=u&~v,R!==0?x=Zt(R):C!==0?x=Zt(C):i||(i=u&~t,i!==0&&(x=Zt(i)))),x===0?0:r!==0&&r!==x&&(r&v)===0&&(v=x&-x,i=r&-r,v>=i||v===32&&(i&4194048)!==0)?r:x}function Je(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function St(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kt(){var t=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),t}function Jn(t){for(var r=[],i=0;31>i;i++)r.push(t);return r}function wt(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function dn(t,r,i,u,x,v){var C=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var R=t.entanglements,P=t.expirationTimes,Q=t.hiddenUpdates;for(i=C&~i;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var cN=/[\n"\\]/g;function $n(t){return t.replace(cN,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Wd(t,r,i,u,x,v,C,R){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),r!=null?C==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+In(r)):t.value!==""+In(r)&&(t.value=""+In(r)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),r!=null?Yd(t,C,In(r)):i!=null?Yd(t,C,In(i)):u!=null&&t.removeAttribute("value"),x==null&&v!=null&&(t.defaultChecked=!!v),x!=null&&(t.checked=x&&typeof x!="function"&&typeof x!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.name=""+In(R):t.removeAttribute("name")}function nx(t,r,i,u,x,v,C,R){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),r!=null||i!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){Fd(t);return}i=i!=null?""+In(i):"",r=r!=null?""+In(r):i,R||r===t.value||(t.value=r),t.defaultValue=r}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=R?t.checked:!!u,t.defaultChecked=!!u,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),Fd(t)}function Yd(t,r,i){r==="number"&&Gl(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Vo(t,r,i,u){if(t=t.options,r){r={};for(var x=0;x"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qd=!1;if(_r)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){Qd=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{Qd=!1}var ia=null,Jd=null,Wl=null;function cx(){if(Wl)return Wl;var t,r=Jd,i=r.length,u,x="value"in ia?ia.value:ia.textContent,v=x.length;for(t=0;t=li),hx=" ",gx=!1;function xx(t,r){switch(t){case"keyup":return PN.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yo=!1;function $N(t,r){switch(t){case"compositionend":return vx(r);case"keypress":return r.which!==32?null:(gx=!0,hx);case"textInput":return t=r.data,t===hx&&gx?null:t;default:return null}}function BN(t,r){if(Yo)return t==="compositionend"||!af&&xx(t,r)?(t=cx(),Wl=Jd=ia=null,Yo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:i,offset:r-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Ex(i)}}function Tx(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?Tx(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function Rx(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Gl(t.document);r instanceof t.HTMLIFrameElement;){try{var i=typeof r.contentWindow.location.href=="string"}catch{i=!1}if(i)t=r.contentWindow;else break;r=Gl(t.document)}return r}function lf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var qN=_r&&"documentMode"in document&&11>=document.documentMode,qo=null,cf=null,fi=null,uf=!1;function Ax(t,r,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;uf||qo==null||qo!==Gl(u)||(u=qo,"selectionStart"in u&&lf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),fi&&di(fi,u)||(fi=u,u=$c(cf,"onSelect"),0>=C,x-=C,hr=1<<32-re(r)+x|i<Ue?(Ke=Re,Re=null):Ke=Re.sibling;var tt=J(W,Re,X[Ue],ce);if(tt===null){Re===null&&(Re=Ke);break}t&&Re&&tt.alternate===null&&r(W,Re),$=v(tt,$,Ue),et===null?_e=tt:et.sibling=tt,et=tt,Re=Ke}if(Ue===X.length)return i(W,Re),Qe&&Dr(W,Ue),_e;if(Re===null){for(;UeUe?(Ke=Re,Re=null):Ke=Re.sibling;var Ra=J(W,Re,tt.value,ce);if(Ra===null){Re===null&&(Re=Ke);break}t&&Re&&Ra.alternate===null&&r(W,Re),$=v(Ra,$,Ue),et===null?_e=Ra:et.sibling=Ra,et=Ra,Re=Ke}if(tt.done)return i(W,Re),Qe&&Dr(W,Ue),_e;if(Re===null){for(;!tt.done;Ue++,tt=X.next())tt=de(W,tt.value,ce),tt!==null&&($=v(tt,$,Ue),et===null?_e=tt:et.sibling=tt,et=tt);return Qe&&Dr(W,Ue),_e}for(Re=u(Re);!tt.done;Ue++,tt=X.next())tt=ne(Re,W,Ue,tt.value,ce),tt!==null&&(t&&tt.alternate!==null&&Re.delete(tt.key===null?Ue:tt.key),$=v(tt,$,Ue),et===null?_e=tt:et.sibling=tt,et=tt);return t&&Re.forEach(function(p3){return r(W,p3)}),Qe&&Dr(W,Ue),_e}function ft(W,$,X,ce){if(typeof X=="object"&&X!==null&&X.type===S&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case w:e:{for(var _e=X.key;$!==null;){if($.key===_e){if(_e=X.type,_e===S){if($.tag===7){i(W,$.sibling),ce=x($,X.props.children),ce.return=W,W=ce;break e}}else if($.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===B&&so(_e)===$.type){i(W,$.sibling),ce=x($,X.props),vi(ce,X),ce.return=W,W=ce;break e}i(W,$);break}else r(W,$);$=$.sibling}X.type===S?(ce=to(X.props.children,W.mode,ce,X.key),ce.return=W,W=ce):(ce=nc(X.type,X.key,X.props,null,W.mode,ce),vi(ce,X),ce.return=W,W=ce)}return C(W);case j:e:{for(_e=X.key;$!==null;){if($.key===_e)if($.tag===4&&$.stateNode.containerInfo===X.containerInfo&&$.stateNode.implementation===X.implementation){i(W,$.sibling),ce=x($,X.children||[]),ce.return=W,W=ce;break e}else{i(W,$);break}else r(W,$);$=$.sibling}ce=xf(X,W.mode,ce),ce.return=W,W=ce}return C(W);case B:return X=so(X),ft(W,$,X,ce)}if(se(X))return Ne(W,$,X,ce);if(ue(X)){if(_e=ue(X),typeof _e!="function")throw Error(o(150));return X=_e.call(X),Oe(W,$,X,ce)}if(typeof X.then=="function")return ft(W,$,cc(X),ce);if(X.$$typeof===T)return ft(W,$,oc(W,X),ce);uc(W,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,$!==null&&$.tag===6?(i(W,$.sibling),ce=x($,X),ce.return=W,W=ce):(i(W,$),ce=gf(X,W.mode,ce),ce.return=W,W=ce),C(W)):i(W,$)}return function(W,$,X,ce){try{xi=0;var _e=ft(W,$,X,ce);return os=null,_e}catch(Re){if(Re===as||Re===ic)throw Re;var et=jn(29,Re,null,W.mode);return et.lanes=ce,et.return=W,et}finally{}}}var lo=Jx(!0),ev=Jx(!1),fa=!1;function Rf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Af(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ma(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pa(t,r,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(nt&2)!==0){var x=u.pending;return x===null?r.next=r:(r.next=x.next,x.next=r),u.pending=r,r=tc(t),Px(t,null,i),r}return ec(t,u,r,i),tc(t)}function bi(t,r,i){if(r=r.updateQueue,r!==null&&(r=r.shared,(i&4194048)!==0)){var u=r.lanes;u&=t.pendingLanes,i|=u,r.lanes=i,fn(t,i)}}function Mf(t,r){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var x=null,v=null;if(i=i.firstBaseUpdate,i!==null){do{var C={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};v===null?x=v=C:v=v.next=C,i=i.next}while(i!==null);v===null?x=v=r:v=v.next=r}else x=v=r;i={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=r:t.next=r,i.lastBaseUpdate=r}var _f=!1;function yi(){if(_f){var t=rs;if(t!==null)throw t}}function wi(t,r,i,u){_f=!1;var x=t.updateQueue;fa=!1;var v=x.firstBaseUpdate,C=x.lastBaseUpdate,R=x.shared.pending;if(R!==null){x.shared.pending=null;var P=R,Q=P.next;P.next=null,C===null?v=Q:C.next=Q,C=P;var ie=t.alternate;ie!==null&&(ie=ie.updateQueue,R=ie.lastBaseUpdate,R!==C&&(R===null?ie.firstBaseUpdate=Q:R.next=Q,ie.lastBaseUpdate=P))}if(v!==null){var de=x.baseState;C=0,ie=Q=P=null,R=v;do{var J=R.lane&-536870913,ne=J!==R.lane;if(ne?(qe&J)===J:(u&J)===J){J!==0&&J===ns&&(_f=!0),ie!==null&&(ie=ie.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ne=t,Oe=R;J=r;var ft=i;switch(Oe.tag){case 1:if(Ne=Oe.payload,typeof Ne=="function"){de=Ne.call(ft,de,J);break e}de=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Oe.payload,J=typeof Ne=="function"?Ne.call(ft,de,J):Ne,J==null)break e;de=g({},de,J);break e;case 2:fa=!0}}J=R.callback,J!==null&&(t.flags|=64,ne&&(t.flags|=8192),ne=x.callbacks,ne===null?x.callbacks=[J]:ne.push(J))}else ne={lane:J,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ie===null?(Q=ie=ne,P=de):ie=ie.next=ne,C|=J;if(R=R.next,R===null){if(R=x.shared.pending,R===null)break;ne=R,R=ne.next,ne.next=null,x.lastBaseUpdate=ne,x.shared.pending=null}}while(!0);ie===null&&(P=de),x.baseState=P,x.firstBaseUpdate=Q,x.lastBaseUpdate=ie,v===null&&(x.shared.lanes=0),ba|=C,t.lanes=C,t.memoizedState=de}}function tv(t,r){if(typeof t!="function")throw Error(o(191,t));t.call(r)}function nv(t,r){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;tv?v:8;var C=L.T,R={};L.T=R,Zf(t,!1,r,i);try{var P=x(),Q=L.S;if(Q!==null&&Q(R,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var ie=r4(P,u);ji(t,r,ie,Rn(t))}else ji(t,r,u,Rn(t))}catch(de){ji(t,r,{then:function(){},status:"rejected",reason:de},Rn())}finally{I.p=v,C!==null&&R.types!==null&&(C.types=R.types),L.T=C}}function c4(){}function Kf(t,r,i,u){if(t.tag!==5)throw Error(o(476));var x=Dv(t).queue;Ov(t,x,r,H,i===null?c4:function(){return Lv(t),i(u)})}function Dv(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:H},next:null};var i={};return r.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:i},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function Lv(t){var r=Dv(t);r.next===null&&(r=t.alternate.memoizedState),ji(t,r.next.queue,{},Rn())}function Xf(){return en(Ui)}function zv(){return Rt().memoizedState}function Pv(){return Rt().memoizedState}function u4(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var i=Rn();t=ma(i);var u=pa(r,t,i);u!==null&&(yn(u,r,i),bi(u,r,i)),r={cache:Nf()},t.payload=r;return}r=r.return}}function d4(t,r,i){var u=Rn();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},yc(t)?$v(r,i):(i=pf(t,r,i,u),i!==null&&(yn(i,t,u),Bv(i,r,u)))}function Iv(t,r,i){var u=Rn();ji(t,r,i,u)}function ji(t,r,i,u){var x={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(yc(t))$v(r,x);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var C=r.lastRenderedState,R=v(C,i);if(x.hasEagerState=!0,x.eagerState=R,Sn(R,C))return ec(t,r,x,0),pt===null&&Jl(),!1}catch{}finally{}if(i=pf(t,r,x,u),i!==null)return yn(i,t,u),Bv(i,r,u),!0}return!1}function Zf(t,r,i,u){if(u={lane:2,revertLane:Rm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},yc(t)){if(r)throw Error(o(479))}else r=pf(t,i,u,2),r!==null&&yn(r,t,2)}function yc(t){var r=t.alternate;return t===$e||r!==null&&r===$e}function $v(t,r){is=mc=!0;var i=t.pending;i===null?r.next=r:(r.next=i.next,i.next=r),t.pending=r}function Bv(t,r,i){if((i&4194048)!==0){var u=r.lanes;u&=t.pendingLanes,i|=u,r.lanes=i,fn(t,i)}}var Ni={readContext:en,use:gc,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Ni.useEffectEvent=jt;var Uv={readContext:en,use:gc,useCallback:function(t,r){return cn().memoizedState=[t,r===void 0?null:r],t},useContext:en,useEffect:jv,useImperativeHandle:function(t,r,i){i=i!=null?i.concat([t]):null,vc(4194308,4,Tv.bind(null,r,t),i)},useLayoutEffect:function(t,r){return vc(4194308,4,t,r)},useInsertionEffect:function(t,r){vc(4,2,t,r)},useMemo:function(t,r){var i=cn();r=r===void 0?null:r;var u=t();if(co){ee(!0);try{t()}finally{ee(!1)}}return i.memoizedState=[u,r],u},useReducer:function(t,r,i){var u=cn();if(i!==void 0){var x=i(r);if(co){ee(!0);try{i(r)}finally{ee(!1)}}}else x=r;return u.memoizedState=u.baseState=x,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:x},u.queue=t,t=t.dispatch=d4.bind(null,$e,t),[u.memoizedState,t]},useRef:function(t){var r=cn();return t={current:t},r.memoizedState=t},useState:function(t){t=Gf(t);var r=t.queue,i=Iv.bind(null,$e,r);return r.dispatch=i,[t.memoizedState,i]},useDebugValue:Yf,useDeferredValue:function(t,r){var i=cn();return qf(i,t,r)},useTransition:function(){var t=Gf(!1);return t=Ov.bind(null,$e,t.queue,!0,!1),cn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,i){var u=$e,x=cn();if(Qe){if(i===void 0)throw Error(o(407));i=i()}else{if(i=r(),pt===null)throw Error(o(349));(qe&127)!==0||lv(u,r,i)}x.memoizedState=i;var v={value:i,getSnapshot:r};return x.queue=v,jv(uv.bind(null,u,v,t),[t]),u.flags|=2048,cs(9,{destroy:void 0},cv.bind(null,u,v,i,r),null),i},useId:function(){var t=cn(),r=pt.identifierPrefix;if(Qe){var i=gr,u=hr;i=(u&~(1<<32-re(u)-1)).toString(32)+i,r="_"+r+"R_"+i,i=pc++,0<\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?C.createElement("select",{is:u.is}):C.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?C.createElement(x,{is:u.is}):C.createElement(x)}}v[Qt]=r,v[pn]=u;e:for(C=r.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===r)break e;for(;C.sibling===null;){if(C.return===null||C.return===r)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}r.stateNode=v;e:switch(nn(v,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Br(r)}}return vt(r),dm(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,i),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==u&&Br(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(o(166));if(t=oe.current,es(r)){if(t=r.stateNode,i=r.memoizedProps,u=null,x=Jt,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}t[Qt]=r,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||sb(t.nodeValue,i)),t||ua(r,!0)}else t=Bc(t).createTextNode(u),t[Qt]=r,r.stateNode=t}return vt(r),null;case 31:if(i=r.memoizedState,t===null||t.memoizedState!==null){if(u=es(r),i!==null){if(t===null){if(!u)throw Error(o(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[Qt]=r}else no(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;vt(r),t=!1}else i=wf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return r.flags&256?(En(r),r):(En(r),null);if((r.flags&128)!==0)throw Error(o(558))}return vt(r),null;case 13:if(u=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(x=es(r),u!==null&&u.dehydrated!==null){if(t===null){if(!x)throw Error(o(318));if(x=r.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(o(317));x[Qt]=r}else no(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;vt(r),x=!1}else x=wf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=x),x=!0;if(!x)return r.flags&256?(En(r),r):(En(r),null)}return En(r),(r.flags&128)!==0?(r.lanes=i,r):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=r.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==x&&(u.flags|=2048)),i!==t&&i&&(r.child.flags|=8192),Nc(r,r.updateQueue),vt(r),null);case 4:return ve(),t===null&&Om(r.stateNode.containerInfo),vt(r),null;case 10:return zr(r.type),vt(r),null;case 19:if(D(Tt),u=r.memoizedState,u===null)return vt(r),null;if(x=(r.flags&128)!==0,v=u.rendering,v===null)if(x)ki(u,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(v=fc(t),v!==null){for(r.flags|=128,ki(u,!1),t=v.updateQueue,r.updateQueue=t,Nc(r,t),r.subtreeFlags=0,t=i,i=r.child;i!==null;)Ix(i,t),i=i.sibling;return G(Tt,Tt.current&1|2),Qe&&Dr(r,u.treeForkCount),r.child}t=t.sibling}u.tail!==null&&Kt()>Ac&&(r.flags|=128,x=!0,ki(u,!1),r.lanes=4194304)}else{if(!x)if(t=fc(v),t!==null){if(r.flags|=128,x=!0,t=t.updateQueue,r.updateQueue=t,Nc(r,t),ki(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!Qe)return vt(r),null}else 2*Kt()-u.renderingStartTime>Ac&&i!==536870912&&(r.flags|=128,x=!0,ki(u,!1),r.lanes=4194304);u.isBackwards?(v.sibling=r.child,r.child=v):(t=u.last,t!==null?t.sibling=v:r.child=v,u.last=v)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Kt(),t.sibling=null,i=Tt.current,G(Tt,x?i&1|2:i&1),Qe&&Dr(r,u.treeForkCount),t):(vt(r),null);case 22:case 23:return En(r),Df(),u=r.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(i&536870912)!==0&&(r.flags&128)===0&&(vt(r),r.subtreeFlags&6&&(r.flags|=8192)):vt(r),i=r.updateQueue,i!==null&&Nc(r,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==i&&(r.flags|=2048),t!==null&&D(oo),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),r.memoizedState.cache!==i&&(r.flags|=2048),zr(Ot),vt(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function g4(t,r){switch(bf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return zr(Ot),ve(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return le(r),null;case 31:if(r.memoizedState!==null){if(En(r),r.alternate===null)throw Error(o(340));no()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(En(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(o(340));no()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return D(Tt),null;case 4:return ve(),null;case 10:return zr(r.type),null;case 22:case 23:return En(r),Df(),t!==null&&D(oo),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return zr(Ot),null;case 25:return null;default:return null}}function d1(t,r){switch(bf(r),r.tag){case 3:zr(Ot),ve();break;case 26:case 27:case 5:le(r);break;case 4:ve();break;case 31:r.memoizedState!==null&&En(r);break;case 13:En(r);break;case 19:D(Tt);break;case 10:zr(r.type);break;case 22:case 23:En(r),Df(),t!==null&&D(oo);break;case 24:zr(Ot)}}function Ti(t,r){try{var i=r.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var x=u.next;i=x;do{if((i.tag&t)===t){u=void 0;var v=i.create,C=i.inst;u=v(),C.destroy=u}i=i.next}while(i!==x)}}catch(R){st(r,r.return,R)}}function xa(t,r,i){try{var u=r.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var v=x.next;u=v;do{if((u.tag&t)===t){var C=u.inst,R=C.destroy;if(R!==void 0){C.destroy=void 0,x=r;var P=i,Q=R;try{Q()}catch(ie){st(x,P,ie)}}}u=u.next}while(u!==v)}}catch(ie){st(r,r.return,ie)}}function f1(t){var r=t.updateQueue;if(r!==null){var i=t.stateNode;try{nv(r,i)}catch(u){st(t,t.return,u)}}}function m1(t,r,i){i.props=uo(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){st(t,r,u)}}function Ri(t,r){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(x){st(t,r,x)}}function xr(t,r){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(x){st(t,r,x)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(x){st(t,r,x)}else i.current=null}function p1(t){var r=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(x){st(t,t.return,x)}}function fm(t,r,i){try{var u=t.stateNode;I4(u,t.type,i,r),u[pn]=r}catch(x){st(t,t.return,x)}}function h1(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ja(t.type)||t.tag===4}function mm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||h1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ja(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function pm(t,r,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,r?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,r):(r=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.appendChild(t),i=i._reactRootContainer,i!=null||r.onclick!==null||(r.onclick=Mr));else if(u!==4&&(u===27&&ja(t.type)&&(i=t.stateNode,r=null),t=t.child,t!==null))for(pm(t,r,i),t=t.sibling;t!==null;)pm(t,r,i),t=t.sibling}function Ec(t,r,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,r?i.insertBefore(t,r):i.appendChild(t);else if(u!==4&&(u===27&&ja(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(Ec(t,r,i),t=t.sibling;t!==null;)Ec(t,r,i),t=t.sibling}function g1(t){var r=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,x=r.attributes;x.length;)r.removeAttributeNode(x[0]);nn(r,u,i),r[Qt]=t,r[pn]=i}catch(v){st(t,t.return,v)}}var Ur=!1,zt=!1,hm=!1,x1=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function x4(t,r){if(t=t.containerInfo,zm=Yc,t=Rx(t),lf(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var x=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{i.nodeType,v.nodeType}catch{i=null;break e}var C=0,R=-1,P=-1,Q=0,ie=0,de=t,J=null;t:for(;;){for(var ne;de!==i||x!==0&&de.nodeType!==3||(R=C+x),de!==v||u!==0&&de.nodeType!==3||(P=C+u),de.nodeType===3&&(C+=de.nodeValue.length),(ne=de.firstChild)!==null;)J=de,de=ne;for(;;){if(de===t)break t;if(J===i&&++Q===x&&(R=C),J===v&&++ie===u&&(P=C),(ne=de.nextSibling)!==null)break;de=J,J=de.parentNode}de=ne}i=R===-1||P===-1?null:{start:R,end:P}}else i=null}i=i||{start:0,end:0}}else i=null;for(Pm={focusedElem:t,selectionRange:i},Yc=!1,Gt=r;Gt!==null;)if(r=Gt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Gt=t;else for(;Gt!==null;){switch(r=Gt,v=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i title"))),nn(v,u,i),v[Qt]=t,Vt(v),u=v;break e;case"link":var C=Sb("link","href",x).get(u+(i.href||""));if(C){for(var R=0;Rft&&(C=ft,ft=Oe,Oe=C);var W=kx(R,Oe),$=kx(R,ft);if(W&&$&&(ne.rangeCount!==1||ne.anchorNode!==W.node||ne.anchorOffset!==W.offset||ne.focusNode!==$.node||ne.focusOffset!==$.offset)){var X=de.createRange();X.setStart(W.node,W.offset),ne.removeAllRanges(),Oe>ft?(ne.addRange(X),ne.extend($.node,$.offset)):(X.setEnd($.node,$.offset),ne.addRange(X))}}}}for(de=[],ne=R;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;Ri?32:i,L.T=null,i=Cm,Cm=null;var v=wa,C=Wr;if(It=0,ps=wa=null,Wr=0,(nt&6)!==0)throw Error(o(331));var R=nt;if(nt|=4,T1(v.current),N1(v,v.current,C,i),nt=R,Li(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(pr,v)}catch{}return!0}finally{I.p=x,L.T=u,W1(t,r)}}function q1(t,r,i){r=Un(i,r),r=tm(t.stateNode,r,2),t=pa(t,r,2),t!==null&&(wt(t,2),vr(t))}function st(t,r,i){if(t.tag===3)q1(t,t,i);else for(;r!==null;){if(r.tag===3){q1(r,t,i);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ya===null||!ya.has(u))){t=Un(i,t),i=Kv(2),u=pa(r,i,2),u!==null&&(Xv(i,u,r,t),wt(u,2),vr(u));break}}r=r.return}}function Em(t,r,i){var u=t.pingCache;if(u===null){u=t.pingCache=new y4;var x=new Set;u.set(r,x)}else x=u.get(r),x===void 0&&(x=new Set,u.set(r,x));x.has(i)||(vm=!0,x.add(i),t=N4.bind(null,t,r,i),r.then(t,t))}function N4(t,r,i){var u=t.pingCache;u!==null&&u.delete(r),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,pt===t&&(qe&i)===i&&(Nt===4||Nt===3&&(qe&62914560)===qe&&300>Kt()-Rc?(nt&2)===0&&hs(t,0):bm|=i,ms===qe&&(ms=0)),vr(t)}function K1(t,r){r===0&&(r=kt()),t=eo(t,r),t!==null&&(wt(t,r),vr(t))}function E4(t){var r=t.memoizedState,i=0;r!==null&&(i=r.retryLane),K1(t,i)}function k4(t,r){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,x=t.memoizedState;x!==null&&(i=x.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(r),K1(t,i)}function T4(t,r){return Ya(t,r)}var zc=null,xs=null,km=!1,Pc=!1,Tm=!1,Sa=0;function vr(t){t!==xs&&t.next===null&&(xs===null?zc=xs=t:xs=xs.next=t),Pc=!0,km||(km=!0,A4())}function Li(t,r){if(!Tm&&Pc){Tm=!0;do for(var i=!1,u=zc;u!==null;){if(t!==0){var x=u.pendingLanes;if(x===0)var v=0;else{var C=u.suspendedLanes,R=u.pingedLanes;v=(1<<31-re(42|t)+1)-1,v&=x&~(C&~R),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(i=!0,J1(u,v))}else v=qe,v=Me(u,u===pt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||Je(u,v)||(i=!0,J1(u,v));u=u.next}while(i);Tm=!1}}function R4(){X1()}function X1(){Pc=km=!1;var t=0;Sa!==0&&B4()&&(t=Sa);for(var r=Kt(),i=null,u=zc;u!==null;){var x=u.next,v=Z1(u,r);v===0?(u.next=null,i===null?zc=x:i.next=x,x===null&&(xs=i)):(i=u,(t!==0||(v&3)!==0)&&(Pc=!0)),u=x}It!==0&&It!==5||Li(t),Sa!==0&&(Sa=0)}function Z1(t,r){for(var i=t.suspendedLanes,u=t.pingedLanes,x=t.expirationTimes,v=t.pendingLanes&-62914561;0R)break;var ie=P.transferSize,de=P.initiatorType;ie&&ib(de)&&(P=P.responseEnd,C+=ie*(P"u"?null:document;function bb(t,r,i){var u=vs;if(u&&typeof r=="string"&&r){var x=$n(r);x='link[rel="'+t+'"][href="'+x+'"]',typeof i=="string"&&(x+='[crossorigin="'+i+'"]'),vb.has(x)||(vb.add(x),t={rel:t,crossOrigin:i,href:r},u.querySelector(x)===null&&(r=u.createElement("link"),nn(r,"link",t),Vt(r),u.head.appendChild(r)))}}function K4(t){Yr.D(t),bb("dns-prefetch",t,null)}function X4(t,r){Yr.C(t,r),bb("preconnect",t,r)}function Z4(t,r,i){Yr.L(t,r,i);var u=vs;if(u&&t&&r){var x='link[rel="preload"][as="'+$n(r)+'"]';r==="image"&&i&&i.imageSrcSet?(x+='[imagesrcset="'+$n(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(x+='[imagesizes="'+$n(i.imageSizes)+'"]')):x+='[href="'+$n(t)+'"]';var v=x;switch(r){case"style":v=bs(t);break;case"script":v=ys(t)}Yn.has(v)||(t=g({rel:"preload",href:r==="image"&&i&&i.imageSrcSet?void 0:t,as:r},i),Yn.set(v,t),u.querySelector(x)!==null||r==="style"&&u.querySelector($i(v))||r==="script"&&u.querySelector(Bi(v))||(r=u.createElement("link"),nn(r,"link",t),Vt(r),u.head.appendChild(r)))}}function Q4(t,r){Yr.m(t,r);var i=vs;if(i&&t){var u=r&&typeof r.as=="string"?r.as:"script",x='link[rel="modulepreload"][as="'+$n(u)+'"][href="'+$n(t)+'"]',v=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ys(t)}if(!Yn.has(v)&&(t=g({rel:"modulepreload",href:t},r),Yn.set(v,t),i.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Bi(v)))return}u=i.createElement("link"),nn(u,"link",t),Vt(u),i.head.appendChild(u)}}}function J4(t,r,i){Yr.S(t,r,i);var u=vs;if(u&&t){var x=Uo(u).hoistableStyles,v=bs(t);r=r||"default";var C=x.get(v);if(!C){var R={loading:0,preload:null};if(C=u.querySelector($i(v)))R.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":r},i),(i=Yn.get(v))&&Gm(t,i);var P=C=u.createElement("link");Vt(P),nn(P,"link",t),P._p=new Promise(function(Q,ie){P.onload=Q,P.onerror=ie}),P.addEventListener("load",function(){R.loading|=1}),P.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Hc(C,r,u)}C={type:"stylesheet",instance:C,count:1,state:R},x.set(v,C)}}}function e3(t,r){Yr.X(t,r);var i=vs;if(i&&t){var u=Uo(i).hoistableScripts,x=ys(t),v=u.get(x);v||(v=i.querySelector(Bi(x)),v||(t=g({src:t,async:!0},r),(r=Yn.get(x))&&Fm(t,r),v=i.createElement("script"),Vt(v),nn(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(x,v))}}function t3(t,r){Yr.M(t,r);var i=vs;if(i&&t){var u=Uo(i).hoistableScripts,x=ys(t),v=u.get(x);v||(v=i.querySelector(Bi(x)),v||(t=g({src:t,async:!0,type:"module"},r),(r=Yn.get(x))&&Fm(t,r),v=i.createElement("script"),Vt(v),nn(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(x,v))}}function yb(t,r,i,u){var x=(x=oe.current)?Uc(x):null;if(!x)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(r=bs(i.href),i=Uo(x).hoistableStyles,u=i.get(r),u||(u={type:"style",instance:null,count:0,state:null},i.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=bs(i.href);var v=Uo(x).hoistableStyles,C=v.get(t);if(C||(x=x.ownerDocument||x,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,C),(v=x.querySelector($i(t)))&&!v._p&&(C.instance=v,C.state.loading=5),Yn.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Yn.set(t,i),v||n3(x,t,i,C.state))),r&&u===null)throw Error(o(528,""));return C}if(r&&u!==null)throw Error(o(529,""));return null;case"script":return r=i.async,i=i.src,typeof i=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=ys(i),i=Uo(x).hoistableScripts,u=i.get(r),u||(u={type:"script",instance:null,count:0,state:null},i.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function bs(t){return'href="'+$n(t)+'"'}function $i(t){return'link[rel="stylesheet"]['+t+"]"}function wb(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function n3(t,r,i,u){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=t.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),nn(r,"link",i),Vt(r),t.head.appendChild(r))}function ys(t){return'[src="'+$n(t)+'"]'}function Bi(t){return"script[async]"+t}function Cb(t,r,i){if(r.count++,r.instance===null)switch(r.type){case"style":var u=t.querySelector('style[data-href~="'+$n(i.href)+'"]');if(u)return r.instance=u,Vt(u),u;var x=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Vt(u),nn(u,"style",x),Hc(u,i.precedence,t),r.instance=u;case"stylesheet":x=bs(i.href);var v=t.querySelector($i(x));if(v)return r.state.loading|=4,r.instance=v,Vt(v),v;u=wb(i),(x=Yn.get(x))&&Gm(u,x),v=(t.ownerDocument||t).createElement("link"),Vt(v);var C=v;return C._p=new Promise(function(R,P){C.onload=R,C.onerror=P}),nn(v,"link",u),r.state.loading|=4,Hc(v,i.precedence,t),r.instance=v;case"script":return v=ys(i.src),(x=t.querySelector(Bi(v)))?(r.instance=x,Vt(x),x):(u=i,(x=Yn.get(v))&&(u=g({},i),Fm(u,x)),t=t.ownerDocument||t,x=t.createElement("script"),Vt(x),nn(x,"link",u),t.head.appendChild(x),r.instance=x);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Hc(u,i.precedence,t));return r.instance}function Hc(t,r,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,v=x,C=0;C title"):null)}function r3(t,r,i){if(i===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Nb(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function a3(t,r,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var x=bs(u.href),v=r.querySelector($i(x));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Gc.bind(t),r.then(t,t)),i.state.loading|=4,i.instance=v,Vt(v);return}v=r.ownerDocument||r,u=wb(u),(x=Yn.get(x))&&Gm(u,x),v=v.createElement("link"),Vt(v);var C=v;C._p=new Promise(function(R,P){C.onload=R,C.onerror=P}),nn(v,"link",u),i.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,r),(r=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Gc.bind(t),r.addEventListener("load",i),r.addEventListener("error",i))}}var Wm=0;function o3(t,r){return t.stylesheets&&t.count===0&&Wc(t,t.stylesheets),0Wm?50:800)+r);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function Gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Fc=null;function Wc(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Fc=new Map,r.forEach(s3,t),Fc=null,Gc.call(t))}function s3(t,r){if(!(r.state.loading&4)){var i=Fc.get(t);if(i)var u=i.get(null);else{i=new Map,Fc.set(t,i);for(var x=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),tp.exports=j3(),tp.exports}var E3=N3();/** - * react-router v7.15.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var Xb="popstate";function Zb(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function k3(e={}){function n(o,l){var h;let c=(h=l.state)==null?void 0:h.masked,{pathname:d,search:m,hash:p}=c||o.location;return Up("",{pathname:d,search:m,hash:p},l.state&&l.state.usr||null,l.state&&l.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function a(o,l){return typeof l=="string"?l:sl(l)}return R3(n,a,null,e)}function yt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Xn(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function T3(){return Math.random().toString(36).substring(2,10)}function Qb(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Up(e,n,a=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?$s(n):n,state:a,key:n&&n.key||o||T3(),mask:l}}function sl({pathname:e="/",search:n="",hash:a=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function $s(e){let n={};if(e){let a=e.indexOf("#");a>=0&&(n.hash=e.substring(a),e=e.substring(0,a));let o=e.indexOf("?");o>=0&&(n.search=e.substring(o),e=e.substring(0,o)),e&&(n.pathname=e)}return n}function R3(e,n,a,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,d=l.history,m="POP",p=null,h=b();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function b(){return(d.state||{idx:null}).idx}function g(){m="POP";let E=b(),N=E==null?null:E-h;h=E,p&&p({action:m,location:S.location,delta:N})}function y(E,N){m="PUSH";let k=Zb(E)?E:Up(S.location,E,N);h=b()+1;let T=Qb(k,h),A=S.createHref(k.mask||k);try{d.pushState(T,"",A)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;l.location.assign(A)}c&&p&&p({action:m,location:S.location,delta:1})}function w(E,N){m="REPLACE";let k=Zb(E)?E:Up(S.location,E,N);h=b();let T=Qb(k,h),A=S.createHref(k.mask||k);d.replaceState(T,"",A),c&&p&&p({action:m,location:S.location,delta:0})}function j(E){return A3(E)}let S={get action(){return m},get location(){return e(l,d)},listen(E){if(p)throw new Error("A history only accepts one active listener");return l.addEventListener(Xb,g),p=E,()=>{l.removeEventListener(Xb,g),p=null}},createHref(E){return n(l,E)},createURL:j,encodeLocation(E){let N=j(E);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:y,replace:w,go(E){return d.go(E)}};return S}function A3(e,n=!1){let a="http://localhost";typeof window<"u"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),yt(a,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:sl(e);return o=o.replace(/ $/,"%20"),!n&&o.startsWith("//")&&(o=a+o),new URL(o,a)}function _0(e,n,a="/"){return M3(e,n,a,!1)}function M3(e,n,a,o,l){let c=typeof n=="string"?$s(n):n,d=Jr(c.pathname||"/",a);if(d==null)return null;let m=_3(e),p=null,h=G3(d);for(let b=0;p==null&&b{let b={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(o)&&p)return;yt(b.relativePath.startsWith(o),`Absolute route path "${b.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(o.length)}let g=sr([o,b.relativePath]),y=a.concat(b);d.children&&d.children.length>0&&(yt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),O0(d.children,n,y,g,p)),!(d.path==null&&!d.index)&&n.push({path:g,score:B3(g,d.index),routesMeta:y})};return e.forEach((d,m)=>{var p;if(d.path===""||!((p=d.path)!=null&&p.includes("?")))c(d,m);else for(let h of D0(d.path))c(d,m,!0,h)}),n}function D0(e){let n=e.split("/");if(n.length===0)return[];let[a,...o]=n,l=a.endsWith("?"),c=a.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let d=D0(o.join("/")),m=[];return m.push(...d.map(p=>p===""?c:[c,p].join("/"))),l&&m.push(...d),m.map(p=>e.startsWith("/")&&p===""?"/":p)}function O3(e){e.sort((n,a)=>n.score!==a.score?a.score-n.score:U3(n.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var D3=/^:[\w-]+$/,L3=3,z3=2,P3=1,I3=10,$3=-2,Jb=e=>e==="*";function B3(e,n){let a=e.split("/"),o=a.length;return a.some(Jb)&&(o+=$3),n&&(o+=z3),a.filter(l=>!Jb(l)).reduce((l,c)=>l+(D3.test(c)?L3:c===""?P3:I3),o)}function U3(e,n){return e.length===n.length&&e.slice(0,-1).every((o,l)=>o===n[l])?e[e.length-1]-n[n.length-1]:0}function H3(e,n,a=!1){let{routesMeta:o}=e,l={},c="/",d=[];for(let m=0;m{if(b==="*"){let j=m[y]||"";d=c.slice(0,c.length-j.length).replace(/(.)\/+$/,"$1")}const w=m[y];return g&&!w?h[b]=void 0:h[b]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:d,pattern:e}}function V3(e,n=!1,a=!0){Xn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,p,h,b)=>{if(o.push({paramName:m,isOptional:p!=null}),p){let g=b.charAt(h+d.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),o]}function G3(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Xn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Jr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let a=n.endsWith("/")?n.length-1:n.length,o=e.charAt(a);return o&&o!=="/"?null:e.slice(a)||"/"}var F3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function W3(e,n="/"){let{pathname:a,search:o="",hash:l=""}=typeof e=="string"?$s(e):e,c;return a?(a=L0(a),a.startsWith("/")?c=ey(a.substring(1),"/"):c=ey(a,n)):c=n,{pathname:c,search:K3(o),hash:X3(l)}}function ey(e,n){let a=Ru(n).split("/");return e.split("/").forEach(l=>{l===".."?a.length>1&&a.pop():l!=="."&&a.push(l)}),a.length>1?a.join("/"):"/"}function op(e,n,a,o){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Y3(e){return e.filter((n,a)=>a===0||n.route.path&&n.route.path.length>0)}function Mh(e){let n=Y3(e);return n.map((a,o)=>o===n.length-1?a.pathname:a.pathnameBase)}function Xu(e,n,a,o=!1){let l;typeof e=="string"?l=$s(e):(l={...e},yt(!l.pathname||!l.pathname.includes("?"),op("?","pathname","search",l)),yt(!l.pathname||!l.pathname.includes("#"),op("#","pathname","hash",l)),yt(!l.search||!l.search.includes("#"),op("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,m;if(d==null)m=a;else{let g=n.length-1;if(!o&&d.startsWith("..")){let y=d.split("/");for(;y[0]==="..";)y.shift(),g-=1;l.pathname=y.join("/")}m=g>=0?n[g]:"/"}let p=W3(l,m),h=d&&d!=="/"&&d.endsWith("/"),b=(c||d===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(h||b)&&(p.pathname+="/"),p}var L0=e=>e.replace(/\/\/+/g,"/"),sr=e=>L0(e.join("/")),Ru=e=>e.replace(/\/+$/,""),q3=e=>Ru(e).replace(/^\/*/,"/"),K3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,X3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Z3=class{constructor(e,n,a,o=!1){this.status=e,this.statusText=n||"",this.internal=o,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function Q3(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function J3(e){let n=e.map(a=>a.route.path).filter(Boolean);return sr(n)||"/"}var z0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function P0(e,n){let a=e;if(typeof a!="string"||!F3.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,l=!1;if(z0)try{let c=new URL(window.location.href),d=a.startsWith("//")?new URL(c.protocol+a):new URL(a),m=Jr(d.pathname,n);d.origin===c.origin&&m!=null?a=m+d.search+d.hash:l=!0}catch{Xn(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var I0=["POST","PUT","PATCH","DELETE"];new Set(I0);var eE=["GET",...I0];new Set(eE);var Bs=f.createContext(null);Bs.displayName="DataRouter";var Zu=f.createContext(null);Zu.displayName="DataRouterState";var $0=f.createContext(!1);function tE(){return f.useContext($0)}var B0=f.createContext({isTransitioning:!1});B0.displayName="ViewTransition";var nE=f.createContext(new Map);nE.displayName="Fetchers";var rE=f.createContext(null);rE.displayName="Await";var Dn=f.createContext(null);Dn.displayName="Navigation";var bl=f.createContext(null);bl.displayName="Location";var cr=f.createContext({outlet:null,matches:[],isDataRoute:!1});cr.displayName="Route";var _h=f.createContext(null);_h.displayName="RouteError";var U0="REACT_ROUTER_ERROR",aE="REDIRECT",oE="ROUTE_ERROR_RESPONSE";function sE(e){if(e.startsWith(`${U0}:${aE}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function iE(e){if(e.startsWith(`${U0}:${oE}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Z3(n.status,n.statusText,n.data)}catch{}}function lE(e,{relative:n}={}){yt(Us(),"useHref() may be used only in the context of a component.");let{basename:a,navigator:o}=f.useContext(Dn),{hash:l,pathname:c,search:d}=yl(e,{relative:n}),m=c;return a!=="/"&&(m=c==="/"?a:sr([a,c])),o.createHref({pathname:m,search:d,hash:l})}function Us(){return f.useContext(bl)!=null}function Ln(){return yt(Us(),"useLocation() may be used only in the context of a component."),f.useContext(bl).location}var H0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function V0(e){f.useContext(Dn).static||f.useLayoutEffect(e)}function Ro(){let{isDataRoute:e}=f.useContext(cr);return e?SE():cE()}function cE(){yt(Us(),"useNavigate() may be used only in the context of a component.");let e=f.useContext(Bs),{basename:n,navigator:a}=f.useContext(Dn),{matches:o}=f.useContext(cr),{pathname:l}=Ln(),c=JSON.stringify(Mh(o)),d=f.useRef(!1);return V0(()=>{d.current=!0}),f.useCallback((p,h={})=>{if(Xn(d.current,H0),!d.current)return;if(typeof p=="number"){a.go(p);return}let b=Xu(p,JSON.parse(c),l,h.relative==="path");e==null&&n!=="/"&&(b.pathname=b.pathname==="/"?n:sr([n,b.pathname])),(h.replace?a.replace:a.push)(b,h.state,h)},[n,a,c,l,e])}var uE=f.createContext(null);function dE(e){let n=f.useContext(cr).outlet;return f.useMemo(()=>n&&f.createElement(uE.Provider,{value:e},n),[n,e])}function yl(e,{relative:n}={}){let{matches:a}=f.useContext(cr),{pathname:o}=Ln(),l=JSON.stringify(Mh(a));return f.useMemo(()=>Xu(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function fE(e,n){return G0(e,n)}function G0(e,n,a){var E;yt(Us(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=f.useContext(Dn),{matches:l}=f.useContext(cr),c=l[l.length-1],d=c?c.params:{},m=c?c.pathname:"/",p=c?c.pathnameBase:"/",h=c&&c.route;{let N=h&&h.path||"";W0(m,!h||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${m}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let b=Ln(),g;if(n){let N=typeof n=="string"?$s(n):n;yt(p==="/"||((E=N.pathname)==null?void 0:E.startsWith(p)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${N.pathname}" was given in the \`location\` prop.`),g=N}else g=b;let y=g.pathname||"/",w=y;if(p!=="/"){let N=p.replace(/^\//,"").split("/");w="/"+y.replace(/^\//,"").split("/").slice(N.length).join("/")}let j=a&&a.state.matches.length?a.state.matches.map(N=>Object.assign(N,{route:a.manifest[N.route.id]||N.route})):_0(e,{pathname:w});Xn(h||j!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Xn(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let S=xE(j&&j.map(N=>Object.assign({},N,{params:Object.assign({},d,N.params),pathname:sr([p,o.encodeLocation?o.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?p:sr([p,o.encodeLocation?o.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),l,a);return n&&S?f.createElement(bl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function mE(){let e=CE(),n=Q3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:c},"ErrorBoundary")," or"," ",f.createElement("code",{style:c},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},n),a?f.createElement("pre",{style:l},a):null,d)}var pE=f.createElement(mE,null),F0=class extends f.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const a=iE(e.digest);a&&(e=a)}let n=e!==void 0?f.createElement(cr.Provider,{value:this.props.routeContext},f.createElement(_h.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(hE,{error:e},n):n}};F0.contextType=$0;var sp=new WeakMap;function hE({children:e,error:n}){let{basename:a}=f.useContext(Dn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=sE(n.digest);if(o){let l=sp.get(n);if(l)throw l;let c=P0(o.location,a);if(z0&&!sp.get(n))if(c.isExternal||o.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw sp.set(n,d),d}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function gE({routeContext:e,match:n,children:a}){let o=f.useContext(Bs);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(cr.Provider,{value:e},a)}function xE(e,n=[],a){let o=a==null?void 0:a.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o==null?void 0:o.errors;if(c!=null){let b=l.findIndex(g=>g.route.id&&(c==null?void 0:c[g.route.id])!==void 0);yt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,b+1))}let d=!1,m=-1;if(a&&o){d=o.renderFallback;for(let b=0;b=0?l=l.slice(0,m+1):l=[l[0]];break}}}}let p=a==null?void 0:a.onError,h=o&&p?(b,g)=>{var y,w;p(b,{location:o.location,params:((w=(y=o.matches)==null?void 0:y[0])==null?void 0:w.params)??{},pattern:J3(o.matches),errorInfo:g})}:void 0;return l.reduceRight((b,g,y)=>{let w,j=!1,S=null,E=null;o&&(w=c&&g.route.id?c[g.route.id]:void 0,S=g.route.errorElement||pE,d&&(m<0&&y===0?(W0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,E=null):m===y&&(j=!0,E=g.route.hydrateFallbackElement||null)));let N=n.concat(l.slice(0,y+1)),k=()=>{let T;return w?T=S:j?T=E:g.route.Component?T=f.createElement(g.route.Component,null):g.route.element?T=g.route.element:T=b,f.createElement(gE,{match:g,routeContext:{outlet:b,matches:N,isDataRoute:o!=null},children:T})};return o&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(F0,{location:o.location,revalidation:o.revalidation,component:S,error:w,children:k(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:h}):k()},null)}function Oh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vE(e){let n=f.useContext(Bs);return yt(n,Oh(e)),n}function bE(e){let n=f.useContext(Zu);return yt(n,Oh(e)),n}function yE(e){let n=f.useContext(cr);return yt(n,Oh(e)),n}function Dh(e){let n=yE(e),a=n.matches[n.matches.length-1];return yt(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function wE(){return Dh("useRouteId")}function CE(){var o;let e=f.useContext(_h),n=bE("useRouteError"),a=Dh("useRouteError");return e!==void 0?e:(o=n.errors)==null?void 0:o[a]}function SE(){let{router:e}=vE("useNavigate"),n=Dh("useNavigate"),a=f.useRef(!1);return V0(()=>{a.current=!0}),f.useCallback(async(l,c={})=>{Xn(a.current,H0),a.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...c}))},[e,n])}var ty={};function W0(e,n,a){!n&&!ty[e]&&(ty[e]=!0,Xn(!1,a))}f.memo(jE);function jE({routes:e,manifest:n,future:a,state:o,isStatic:l,onError:c}){return G0(e,void 0,{manifest:n,state:o,isStatic:l,onError:c})}function Qr({to:e,replace:n,state:a,relative:o}){yt(Us()," may be used only in the context of a component.");let{static:l}=f.useContext(Dn);Xn(!l," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:c}=f.useContext(cr),{pathname:d}=Ln(),m=Ro(),p=Xu(e,Mh(c),d,o==="path"),h=JSON.stringify(p);return f.useEffect(()=>{m(JSON.parse(h),{replace:n,state:a,relative:o})},[m,h,o,n,a]),null}function NE(e){return dE(e.context)}function rn(e){yt(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function EE({basename:e="/",children:n=null,location:a,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){yt(!Us(),"You cannot render a inside another . You should never have more than one in your app.");let m=e.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:m,navigator:l,static:c,useTransitions:d,future:{}}),[m,l,c,d]);typeof a=="string"&&(a=$s(a));let{pathname:h="/",search:b="",hash:g="",state:y=null,key:w="default",mask:j}=a,S=f.useMemo(()=>{let E=Jr(h,m);return E==null?null:{location:{pathname:E,search:b,hash:g,state:y,key:w,mask:j},navigationType:o}},[m,h,b,g,y,w,o,j]);return Xn(S!=null,` is not able to match the URL "${h}${b}${g}" because it does not start with the basename, so the won't render anything.`),S==null?null:f.createElement(Dn.Provider,{value:p},f.createElement(bl.Provider,{children:n,value:S}))}function ny({children:e,location:n}){return fE(Hp(e),n)}function Hp(e,n=[]){let a=[];return f.Children.forEach(e,(o,l)=>{if(!f.isValidElement(o))return;let c=[...n,l];if(o.type===f.Fragment){a.push.apply(a,Hp(o.props.children,c));return}yt(o.type===rn,`[${typeof o.type=="string"?o.type:o.type.name}] is not a component. All component children of must be a or `),yt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=Hp(o.props.children,c)),a.push(d)}),a}var xu="get",vu="application/x-www-form-urlencoded";function Qu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function kE(e){return Qu(e)&&e.tagName.toLowerCase()==="button"}function TE(e){return Qu(e)&&e.tagName.toLowerCase()==="form"}function RE(e){return Qu(e)&&e.tagName.toLowerCase()==="input"}function AE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ME(e,n){return e.button===0&&(!n||n==="_self")&&!AE(e)}function Vp(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,a)=>{let o=e[a];return n.concat(Array.isArray(o)?o.map(l=>[a,l]):[[a,o]])},[]))}function _E(e,n){let a=Vp(e);return n&&n.forEach((o,l)=>{a.has(l)||n.getAll(l).forEach(c=>{a.append(l,c)})}),a}var eu=null;function OE(){if(eu===null)try{new FormData(document.createElement("form"),0),eu=!1}catch{eu=!0}return eu}var DE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ip(e){return e!=null&&!DE.has(e)?(Xn(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${vu}"`),null):e}function LE(e,n){let a,o,l,c,d;if(TE(e)){let m=e.getAttribute("action");o=m?Jr(m,n):null,a=e.getAttribute("method")||xu,l=ip(e.getAttribute("enctype"))||vu,c=new FormData(e)}else if(kE(e)||RE(e)&&(e.type==="submit"||e.type==="image")){let m=e.form;if(m==null)throw new Error('Cannot submit a `,O=>`${A}-${O.id}`)}const E=y`
${n.i18n.searchDescription}
${n.i18n.skinToneDescription}
${w(n.skinTones,(k,T)=>y`
${k}
`,k=>k)}
${w(n.currentEmojisWithCategories,(k,T)=>y`
${j(k.emojis,n.searchMode,"emo")}
`,k=>k.category)}
`,N=(k,T)=>{for(const A of e.querySelectorAll(`[${k}]`))T(A,A.getAttribute(k))};if(p){e.appendChild(E);for(const k of["click","focusout","input","keydown","keyup"])N(`data-on-${k}`,(T,A)=>{T.addEventListener(k,o[A])});N("data-ref",(k,T)=>{c[T]=k}),d.addEventListener("abort",()=>{e.removeChild(E)})}N("data-action",(k,T)=>{let A=m.get(T);A||m.set(T,A=new WeakSet),A.has(k)||(A.add(k),l[T](k))})}const Wu=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function gP(e){let n=!1,a;const o=new Map,l=new Set;let c;const d=()=>{if(n)return;const h=[...l];l.clear();try{for(const b of h)b()}finally{c=!1,l.size&&(c=!0,Wu(d))}},m=new Proxy({},{get(h,b){if(a){let g=o.get(b);g||(g=new Set,o.set(b,g)),g.add(a)}return h[b]},set(h,b,g){if(h[b]!==g){h[b]=g;const y=o.get(b);if(y){for(const w of y)l.add(w);c||(c=!0,Wu(d))}}return!0}}),p=h=>{const b=()=>{const g=a;a=b;try{return h()}finally{a=g}};return b()};return e.addEventListener("abort",()=>{n=!0}),{state:m,createEffect:p}}function zp(e,n,a){if(e.length!==n.length)return!1;for(let o=0;o{l.disconnect()})),l.observe(e)}}const Pp=[],{assign:mu}=Object;function vP(e,n){const a={},o=new AbortController,l=o.signal,{state:c,createEffect:d}=gP(l),m=new Map;mu(c,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),mu(c,n),mu(c,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Pz,isRtl:!1,currentGroupIndex:0,groups:Mp,databaseLoaded:!1,activeSearchItemId:void 0}),d(()=>{c.currentGroup!==c.groups[c.currentGroupIndex]&&(c.currentGroup=c.groups[c.currentGroupIndex])});const p=Y=>{e.getElementById(Y).focus()},h=Y=>e.getElementById(`emo-${Y.id}`),b=(Y,le)=>{a.rootElement.dispatchEvent(new CustomEvent(Y,{detail:le,bubbles:!0,composed:!0}))},g=(Y,le)=>Y.id===le.id,y=(Y,le)=>{const{category:ye,emojis:Te}=Y,{category:Le,emojis:rt}=le;return ye!==Le?!1:zp(Te,rt,g)},w=Y=>{zp(c.currentEmojis,Y,g)||(c.currentEmojis=Y)},j=Y=>{c.searchMode!==Y&&(c.searchMode=Y)},S=Y=>{zp(c.currentEmojisWithCategories,Y,y)||(c.currentEmojisWithCategories=Y)},E=(Y,le)=>le&&Y.skins&&Y.skins[le]||Y.unicode,T={labelWithSkin:(Y,le)=>eP([Y.name||E(Y,le),Y.annotation,...Y.shortcodes||Pp].filter(Boolean)).join(", "),titleForEmoji:Y=>Y.annotation||(Y.shortcodes||Pp).join(", "),unicodeWithSkin:E},A={onClickSkinToneButton:F,onEmojiClick:D,onNavClick:H,onNavKeydown:Z,onSearchKeydown:I,onSkinToneOptionsClick:V,onSkinToneOptionsFocusOut:be,onSkinToneOptionsKeydown:oe,onSkinToneOptionsKeyup:ae,onSearchInput:ve},O={calculateEmojiGridStyle:B,updateOnIntersection:K};let M=!0;d(()=>{hP(e,c,T,A,O,a,l,m,M),M=!1}),c.emojiVersion||Op().then(Y=>{Y||(c.message=c.i18n.emojiUnsupportedMessage)}),d(()=>{async function Y(){let le=!1;const ye=setTimeout(()=>{le=!0,c.message=c.i18n.loadingMessage},Lz);try{await c.database.ready(),c.databaseLoaded=!0}catch(Te){console.error(Te),c.message=c.i18n.networkErrorMessage}finally{clearTimeout(ye),le&&(le=!1,c.message="")}}c.database&&Y()}),d(()=>{c.pickerStyle=` - --num-groups: ${c.groups.length}; - --indicator-opacity: ${c.searchMode?0:1}; - --num-skintones: ${i0};`}),d(()=>{c.customEmoji&&c.database&&z()}),d(()=>{c.customEmoji&&c.customEmoji.length?c.groups!==Nh&&(c.groups=Nh):c.groups!==Mp&&(c.currentGroupIndex&&c.currentGroupIndex--,c.groups=Mp)}),d(()=>{async function Y(){c.databaseLoaded&&(c.currentSkinTone=await c.database.getPreferredSkinTone())}Y()}),d(()=>{c.skinTones=Array(i0).fill().map((Y,le)=>qz(c.skinToneEmoji,le))}),d(()=>{c.skinToneButtonText=c.skinTones[c.currentSkinTone]}),d(()=>{c.skinToneButtonLabel=c.i18n.skinToneLabel.replace("{skinTone}",c.i18n.skinTones[c.currentSkinTone])}),d(()=>{async function Y(){const{database:le}=c,ye=(await Promise.all(Iz.map(Te=>le.getEmojiByUnicodeOrName(Te)))).filter(Boolean);c.defaultFavoriteEmojis=ye}c.databaseLoaded&&Y()});function z(){const{customEmoji:Y,database:le}=c,ye=Y||Pp;le.customEmoji!==ye&&(le.customEmoji=ye)}d(()=>{async function Y(){z();const{database:le,defaultFavoriteEmojis:ye,numColumns:Te}=c,Le=await le.getTopFavoriteEmoji(Te),rt=await xe(H5([...Le,...ye],ht=>ht.unicode||ht.name).slice(0,Te));c.currentFavorites=rt}c.databaseLoaded&&c.defaultFavoriteEmojis&&Y()});function B(Y){Zz(Y,l,()=>{{const le=getComputedStyle(a.rootElement),ye=parseInt(le.getPropertyValue("--num-columns"),10),Te=le.getPropertyValue("direction")==="rtl";c.numColumns=ye,c.isRtl=Te}})}function K(Y){xP(Y,l,le=>{for(const{target:ye,isIntersecting:Te}of le)ye.classList.toggle("onscreen",Te)})}d(()=>{async function Y(){const{searchText:le,currentGroup:ye,databaseLoaded:Te,customEmoji:Le}=c;if(!Te)c.currentEmojis=[],c.searchMode=!1;else if(le.length>=Oz){const rt=await L(le);c.searchText===le&&(w(rt),j(!0))}else{const{id:rt}=ye;if(rt!==-1||Le&&Le.length){const ht=await se(rt);c.currentGroup.id===rt&&(w(ht),j(!1))}}}Y()});const U=()=>{Nu(()=>tP(a.tabpanelElement))};d(()=>{const{currentEmojis:Y,emojiVersion:le}=c,ye=Y.filter(Te=>Te.unicode).filter(Te=>l0(Te)&&!Eh.has(Te.unicode));if(!le&&ye.length)w(Y),Nu(()=>q(ye));else{const Te=le?Y:Y.filter(ue);w(Te),U()}});function q(Y){Jz(Y,a.baselineEmoji,h)?U():c.currentEmojis=[...c.currentEmojis]}function ue(Y){return!Y.unicode||!l0(Y)||Eh.get(Y.unicode)}async function pe(Y){const le=c.emojiVersion||await Op();return Y.filter(({version:ye})=>!ye||ye<=le)}async function xe(Y){return Kz(Y,c.emojiVersion||await Op())}async function se(Y){const le=Y===-1?c.customEmoji:await c.database.getEmojiByGroup(Y);return xe(await pe(le))}async function L(Y){return xe(await pe(await c.database.getEmojiBySearchQuery(Y)))}d(()=>{}),d(()=>{function Y(){const{searchMode:ye,currentEmojis:Te}=c;if(ye)return[{category:"",emojis:Te}];const Le=new Map;for(const rt of Te){const ht=rt.category||"";let Mt=Le.get(ht);Mt||(Mt=[],Le.set(ht,Mt)),Mt.push(rt)}return[...Le.entries()].map(([rt,ht])=>({category:rt,emojis:ht})).sort((rt,ht)=>c.customCategorySorting(rt.category,ht.category))}const le=Y();S(le)}),d(()=>{c.activeSearchItemId=c.activeSearchItem!==-1&&c.currentEmojis[c.activeSearchItem].id}),d(()=>{const{rawSearchText:Y}=c;B5(()=>{c.searchText=(Y||"").trim(),c.activeSearchItem=-1})});function I(Y){if(!c.searchMode||!c.currentEmojis.length)return;const le=ye=>{yr(Y),c.activeSearchItem=Dp(ye,c.activeSearchItem,c.currentEmojis)};switch(Y.key){case"ArrowDown":return le(!1);case"ArrowUp":return le(!0);case"Enter":if(c.activeSearchItem===-1)c.activeSearchItem=0;else return yr(Y),_(c.currentEmojis[c.activeSearchItem].id)}}function H(Y){const{target:le}=Y,ye=le.closest(".nav-button");if(!ye)return;const Te=parseInt(ye.dataset.groupId,10);a.searchElement.value="",c.rawSearchText="",c.searchText="",c.activeSearchItem=-1,c.currentGroupIndex=c.groups.findIndex(Le=>Le.id===Te)}function Z(Y){const{target:le,key:ye}=Y,Te=Le=>{Le&&(yr(Y),Le.focus())};switch(ye){case"ArrowLeft":return Te(le.previousElementSibling);case"ArrowRight":return Te(le.nextElementSibling);case"Home":return Te(le.parentElement.firstElementChild);case"End":return Te(le.parentElement.lastElementChild)}}async function te(Y){const le=await c.database.getEmojiByUnicodeOrName(Y),ye=[...c.currentEmojis,...c.currentFavorites].find(Le=>Le.id===Y),Te=ye.unicode&&E(ye,c.currentSkinTone);return await c.database.incrementFavoriteEmojiCount(Y),{emoji:le,skinTone:c.currentSkinTone,...Te&&{unicode:Te},...ye.name&&{name:ye.name}}}async function _(Y){const le=te(Y);b("emoji-click-sync",le),b("emoji-click",await le)}function D(Y){const{target:le}=Y;if(!le.classList.contains("emoji"))return;yr(Y);const ye=le.id.substring(4);_(ye)}function G(Y){c.currentSkinTone=Y,c.skinTonePickerExpanded=!1,p("skintone-button"),b("skin-tone-change",{skinTone:Y}),c.database.setPreferredSkinTone(Y)}function V(Y){const{target:{id:le}}=Y,ye=le&&le.match(/^skintone-(\d)/);if(!ye)return;yr(Y);const Te=parseInt(ye[1],10);G(Te)}function F(Y){c.skinTonePickerExpanded=!c.skinTonePickerExpanded,c.activeSkinTone=c.currentSkinTone,c.skinTonePickerExpanded&&(yr(Y),Nu(()=>p("skintone-list")))}d(()=>{c.skinTonePickerExpanded?a.skinToneDropdown.addEventListener("transitionend",()=>{c.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):c.skinTonePickerExpandedAfterAnimation=!1});function oe(Y){if(!c.skinTonePickerExpanded)return;const le=async ye=>{yr(Y),c.activeSkinTone=ye};switch(Y.key){case"ArrowUp":return le(Dp(!0,c.activeSkinTone,c.skinTones));case"ArrowDown":return le(Dp(!1,c.activeSkinTone,c.skinTones));case"Home":return le(0);case"End":return le(c.skinTones.length-1);case"Enter":return yr(Y),G(c.activeSkinTone);case"Escape":return yr(Y),c.skinTonePickerExpanded=!1,p("skintone-button")}}function ae(Y){if(c.skinTonePickerExpanded)switch(Y.key){case" ":return yr(Y),G(c.activeSkinTone)}}async function be(Y){const{relatedTarget:le}=Y;(!le||le.id!=="skintone-list")&&(c.skinTonePickerExpanded=!1)}function ve(Y){c.rawSearchText=Y.target.value}return{$set(Y){mu(c,Y)},$destroy(){o.abort()}}}const bP="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",yP="en";var wP={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},CP=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const V5=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],SP=`:host{--emoji-font-family:${U5}}`;class Hg extends HTMLElement{constructor(n){super(),this.attachShadow({mode:"open"});const a=document.createElement("style");a.textContent=CP+SP,this.shadowRoot.appendChild(a),this._ctx={locale:yP,dataSource:bP,skinToneEmoji:zz,customCategorySorting:$z,customEmoji:null,i18n:wP,emojiVersion:null,...n};for(const o of V5)o!=="database"&&Object.prototype.hasOwnProperty.call(this,o)&&(this._ctx[o]=this[o],delete this[o]);this._dbFlush()}connectedCallback(){h0(this),this._cmp||(this._cmp=vP(this.shadowRoot,this._ctx))}disconnectedCallback(){h0(this),Wu(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:n}=this._ctx;n.close().catch(a=>console.error(a))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(n,a,o){this._set(n.replace(/-([a-z])/g,(l,c)=>c.toUpperCase()),n==="emoji-version"?parseFloat(o):o)}_set(n,a){this._ctx[n]=a,this._cmp&&this._cmp.$set({[n]:a}),["locale","dataSource"].includes(n)&&this._dbFlush()}_dbCreate(){const{locale:n,dataSource:a,database:o}=this._ctx;(!o||o.locale!==n||o.dataSource!==a)&&this._set("database",new _z({locale:n,dataSource:a}))}_dbFlush(){Wu(()=>this._dbCreate())}}const G5={};for(const e of V5)G5[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(n){if(e==="database")throw new Error("database is read-only");this._set(e,n)}};Object.defineProperties(Hg.prototype,G5);function h0(e){e instanceof Hg||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Hg);function jP({onPick:e}){const n=f.useRef(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const o=document.createElement("emoji-picker");o.className="unicode-emoji-picker-el",o.setAttribute("data-theme","dark");const l=c=>{var p;const d=c.detail,m=(d==null?void 0:d.unicode)??((p=d==null?void 0:d.emoji)==null?void 0:p.unicode);m&&e(m)};return o.addEventListener("emoji-click",l),a.appendChild(o),()=>{o.removeEventListener("emoji-click",l),o.remove()}},[e]),s.jsx("div",{ref:n,className:"unicode-emoji-panel-host overflow-hidden rounded-lg border border-border/50"})}const NP=/^<(a?):([^:>]+):(\d{17,20})>$/;function Eu(e,n,a=!1){return`${a?"`}function F5(e){const n=String(e??"").trim();if(!n)return{kind:"empty",value:""};const a=n.match(NP);return a?{kind:"custom",value:n,animated:a[1]==="a",name:a[2],id:a[3]}:{kind:"unicode",value:n}}function W5(e,n=!1){return`https://cdn.discordapp.com/emojis/${e}.${n?"gif":"png"}?size=64`}function EP(e,n=[]){const a=F5(e);if(a.kind==="custom"&&a.id&&!a.name){const o=n.find(l=>l.id===a.id);if(o)return{kind:"custom",value:Eu(o.name,o.id,o.animated),name:o.name,id:o.id,animated:o.animated}}if(a.kind==="custom"&&a.id){const o=n.find(l=>l.id===a.id);if(o&&a.value!==Eu(o.name,o.id,o.animated))return{kind:"custom",value:Eu(o.name,o.id,o.animated),name:o.name,id:o.id,animated:o.animated}}return a}function kP({value:e,guildEmojis:n,size:a="md"}){const o=EP(e,n),l=a==="lg"?"size-10":"size-7",c=a==="lg"?"text-3xl":"text-2xl";return o.kind==="empty"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"No emoji selected"}):o.kind==="custom"&&o.id?s.jsxs("span",{className:"inline-flex items-center gap-3",children:[s.jsx("img",{src:W5(o.id,o.animated),alt:o.name??"custom emoji",className:fe(l,"shrink-0 rounded-md"),loading:"lazy"}),s.jsxs("span",{className:"flex flex-col items-start gap-0.5",children:[s.jsxs("span",{className:"text-sm font-medium",children:[":",o.name,":"]}),s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:o.value})]})]}):s.jsx("span",{className:fe(c,"leading-none"),title:o.value,children:o.value})}function TP({id:e,label:n,description:a,value:o,onChange:l,readOnly:c}){const[d,m]=f.useState(!1),[p,h]=f.useState("server"),[b,g]=f.useState(null),[y,w]=f.useState(""),[j,S]=f.useState(!1),[E,N]=f.useState(""),k=f.useCallback(async(U=!1)=>{S(!0),w("");try{const q=await Ee.getGuildResources(U);q.data?(g(q.data),Array.isArray(q.data.emojis)||w("Server response is missing emojis. Restart the bot after updating.")):w("No guild data returned.")}catch(q){w(q instanceof Error?q.message:"Could not load server emojis")}finally{S(!1)}},[]);f.useEffect(()=>{d&&k(!0)},[d,k]);const T=f.useMemo(()=>Array.isArray(b==null?void 0:b.emojis)?b.emojis:[],[b]),A=f.useMemo(()=>{const U=E.trim().toLowerCase();return U?T.filter(q=>q.name.toLowerCase().includes(U)):T},[T,E]),O=String(o??""),M=F5(O);function z(U){l(U),m(!1)}function B(U){l(Eu(U.name,U.id,U.animated)),m(!1)}function K(){l("")}return s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:e,children:n}),a?s.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null,s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(kP,{value:o,guildEmojis:T,size:"lg"})}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(he,{type:"button",variant:"secondary",size:"sm",disabled:c,onClick:()=>m(!0),children:"Choose emoji"}),O?s.jsx(he,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:K,children:"Clear"}):null]})]}),s.jsx(zl,{open:d,onOpenChange:m,children:s.jsxs(qs,{className:"max-h-[min(90vh,720px)] max-w-lg gap-0 overflow-hidden p-0 sm:max-w-xl",children:[s.jsxs(Ks,{className:"space-y-1 border-b border-border px-5 py-4",children:[s.jsx(Xs,{children:"Choose emoji"}),s.jsxs(Zs,{children:["Server emojis save as"," ",s.jsx("code",{className:"rounded bg-muted px-1 text-xs",children:"<:name:id>"}),". Standard emojis save as Unicode characters."]})]}),s.jsxs(N5,{value:p,onValueChange:U=>h(U),className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs(zg,{className:"mx-5 mt-3 grid h-9 w-auto grid-cols-2",children:[s.jsx(xo,{value:"server",children:"Server"}),s.jsx(xo,{value:"unicode",children:"All emojis"})]}),s.jsxs(wh,{value:"server",className:"mt-0 flex-1 px-5 pb-4 pt-3",children:[s.jsxs("div",{className:"relative mb-3",children:[s.jsx(ge,{icon:ad,size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(Ie,{placeholder:"Search by name…",value:E,onChange:U=>N(U.target.value),className:"h-9 border-border bg-secondary/30 pl-9"})]}),b?s.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:[b.guildName," · ",T.length," custom emoji",T.length===1?"":"s"]}):null,s.jsx($l,{className:"h-[min(50vh,320px)] rounded-lg border border-border/50 bg-secondary/20",children:j?s.jsx("div",{className:"grid grid-cols-6 gap-2 p-3 sm:grid-cols-8",children:Array.from({length:24}).map((U,q)=>s.jsx(Be,{className:"aspect-square rounded-lg"},q))}):y?s.jsxs("div",{className:"space-y-3 p-4 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:y}),s.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>void k(!0),children:"Retry"})]}):A.length===0?s.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground",children:T.length===0?"No custom emojis in this server, or the bot needs the Guild Emojis intent (restart after update).":"No emojis match your search."}):s.jsx("div",{className:"grid grid-cols-6 gap-1.5 p-2 sm:grid-cols-8",children:A.map(U=>{const q=M.kind==="custom"&&M.id===U.id;return s.jsx("button",{type:"button",title:`:${U.name}:`,className:fe("flex aspect-square items-center justify-center rounded-lg border border-transparent bg-background/50 transition-colors hover:border-primary/30 hover:bg-accent",q&&"border-primary/50 bg-primary/15 ring-2 ring-primary/30"),onClick:()=>B(U),children:s.jsx("img",{src:U.url??W5(U.id,U.animated),alt:U.name,className:"size-8 object-contain",loading:"lazy"})},U.id)})})})]}),s.jsx(wh,{value:"unicode",className:"mt-0 px-5 pb-4 pt-3",children:s.jsx(jP,{onPick:z})})]})]})}),s.jsx(Ie,{value:O,disabled:c,onChange:U=>l(U.target.value),placeholder:"Unicode or <:name:id>",className:"border-border bg-secondary/30 font-mono text-xs"})]})}const g0="BOT_TOKEN",RP="MODEL_API_KEY";function Vg({field:e,value:n,onChange:a,readOnly:o}){const l=e.path.replace(/\./g,"-");if(e.type==="googleFont")return s.jsx(_L,{field:e,value:n,onChange:a,readOnly:o});if(e.type==="boolean")return s.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border bg-secondary/20 px-3 py-2.5",children:[s.jsxs("div",{children:[s.jsx(ze,{htmlFor:l,className:"font-medium",children:e.label}),e.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}):null]}),s.jsx(At,{id:l,checked:!!n,disabled:o,onCheckedChange:a})]});if(e.type==="stringList")return s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:e.label}),e.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}):null,s.jsx(RL,{value:Array.isArray(n)?n:[],onChange:a})]});if(e.type==="select"&&e.options)return s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:l,children:e.label}),s.jsxs(No,{value:String(n??""),disabled:o,onValueChange:a,children:[s.jsx(Ba,{id:l,className:"border-border bg-secondary/30",children:s.jsx(Eo,{placeholder:"Select…"})}),s.jsx(Ua,{children:e.options.map(d=>s.jsx(an,{value:d.value,children:d.label},d.value))})]})]});if(e.type==="color"){const d=jr(String(n??"#000000"));return s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:l,children:e.label}),e.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}):null,s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Id,{value:d,onChange:a}),s.jsx(Ie,{id:l,value:d,disabled:o,onChange:m=>a(m.target.value),onBlur:m=>a(jr(m.target.value,d)),className:"border-border bg-secondary/30 font-mono uppercase",placeholder:"#000000",maxLength:7})]})]})}if(e.type==="emoji")return s.jsx(TP,{id:l,label:e.label,description:e.description,value:n,onChange:a,readOnly:o});if(e.type==="discordChannel"||e.type==="discordRole"||e.type==="discordCategory"){const d=e.type==="discordRole"?"role":e.type==="discordCategory"?"category":"channel";return s.jsx(OL,{id:l,label:e.label,description:e.description,kind:d,value:n,onChange:a,readOnly:o})}if(e.type==="secret"){const d=n===g0||n===RP||!n?"":"••••••••••••";return s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:l,children:e.label}),e.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}):null,s.jsx(Ie,{id:l,type:"password",value:d,disabled:o,placeholder:e.placeholder??"Unchanged if empty",onChange:m=>{const p=m.target.value;a(p||(e.placeholder??g0))},className:"border-border bg-secondary/30"})]})}const c="border-border bg-secondary/30";return e.type==="textarea"?s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:l,children:e.label}),s.jsx(Ld,{id:l,value:String(n??""),disabled:o,onChange:d=>a(d.target.value),className:`min-h-[88px] ${c}`})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:l,children:e.label}),e.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}):null,s.jsx(Ie,{id:l,type:e.type==="number"?"number":"text",value:n==null?"":String(n),disabled:o,onChange:d=>a(e.type==="number"?Number(d.target.value):d.target.value),placeholder:e.placeholder??(e.type==="discordId"?"Discord snowflake ID":void 0),className:c})]})}const Xe=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("rounded-xl border border-border bg-card text-card-foreground shadow-none",e),...n}));Xe.displayName="Card";const it=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("flex flex-col space-y-1.5 p-6",e),...n}));it.displayName="CardHeader";const lt=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("font-semibold leading-none tracking-tight",e),...n}));lt.displayName="CardTitle";const Et=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("text-sm text-muted-foreground",e),...n}));Et.displayName="CardDescription";const Ze=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("p-6 pt-0",e),...n}));Ze.displayName="CardContent";const Gg=f.forwardRef(({className:e,...n},a)=>s.jsx("div",{ref:a,className:fe("flex items-center p-6 pt-0",e),...n}));Gg.displayName="CardFooter";function x0(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function AP(e,n){if(typeof n=="boolean")return"boolean";if(typeof n=="number")return"number";if(Array.isArray(n))return"stringList";if(typeof n=="string"){const a=e.toLowerCase();return/emoji/.test(a)?"emoji":/guild.?id|guild_id/.test(a)?"discordId":/category/.test(a)?"discordCategory":/channel|forum/.test(a)?"discordChannel":/role|staff|admin|moderator/.test(a)?"discordRole":n.length>100?"textarea":"text"}return"text"}function Fg(e,n=""){const a=[];for(const[o,l]of Object.entries(e)){const c=n?`${n}.${o}`:o;if(Array.isArray(l)){if(l.length>0&&typeof l[0]=="object"&&l[0]!==null&&!Array.isArray(l[0]))continue;a.push({path:c,label:x0(o),type:"stringList"});continue}if(l&&typeof l=="object"&&Object.keys(l).length>0){a.push(...Fg(l,c));continue}a.push({path:c,label:x0(o),type:AP(o,l)})}return a}function MP(e){const n=Fg(e);return n.length===0?[{title:"Configuration",fields:[]}]:[{title:"Settings",description:"Values from this addon’s config file.",fields:n}]}function To(e,n){const a=n.split(".");let o=e;for(const l of a){if(o==null||typeof o!="object")return;o=o[l]}return o}function xl(e,n,a){const o=n.split("."),l=structuredClone(e);let c=l;for(let d=0;d"u")return;let n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}const OP=e=>{switch(e){case"success":return zP;case"info":return IP;case"warning":return PP;case"error":return $P;default:return null}},DP=Array(12).fill(0),LP=({visible:e,className:n})=>me.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},me.createElement("div",{className:"sonner-spinner"},DP.map((a,o)=>me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),zP=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),PP=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),IP=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),$P=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),BP=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),UP=()=>{const[e,n]=me.useState(document.hidden);return me.useEffect(()=>{const a=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e};let kh=1;class HP{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const a=this.subscribers.indexOf(n);this.subscribers.splice(a,1)}),this.publish=n=>{this.subscribers.forEach(a=>a(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var a;const{message:o,...l}=n,c=typeof(n==null?void 0:n.id)=="number"||((a=n.id)==null?void 0:a.length)>0?n.id:kh++,d=this.toasts.find(p=>p.id===c),m=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),d?this.toasts=this.toasts.map(p=>p.id===c?(this.publish({...p,...n,id:c,title:o}),{...p,...n,id:c,dismissible:m,title:o}):p):this.addToast({title:o,...l,dismissible:m,id:c}),c},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(a=>a({id:n,dismiss:!0})))):this.toasts.forEach(a=>{this.subscribers.forEach(o=>o({id:a.id,dismiss:!0}))}),n),this.message=(n,a)=>this.create({...a,message:n}),this.error=(n,a)=>this.create({...a,message:n,type:"error"}),this.success=(n,a)=>this.create({...a,type:"success",message:n}),this.info=(n,a)=>this.create({...a,type:"info",message:n}),this.warning=(n,a)=>this.create({...a,type:"warning",message:n}),this.loading=(n,a)=>this.create({...a,type:"loading",message:n}),this.promise=(n,a)=>{if(!a)return;let o;a.loading!==void 0&&(o=this.create({...a,promise:n,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));const l=Promise.resolve(n instanceof Function?n():n);let c=o!==void 0,d;const m=l.then(async h=>{if(d=["resolve",h],me.isValidElement(h))c=!1,this.create({id:o,type:"default",message:h});else if(GP(h)&&!h.ok){c=!1;const g=typeof a.error=="function"?await a.error(`HTTP error! status: ${h.status}`):a.error,y=typeof a.description=="function"?await a.description(`HTTP error! status: ${h.status}`):a.description,j=typeof g=="object"&&!me.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:y,...j})}else if(h instanceof Error){c=!1;const g=typeof a.error=="function"?await a.error(h):a.error,y=typeof a.description=="function"?await a.description(h):a.description,j=typeof g=="object"&&!me.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:y,...j})}else if(a.success!==void 0){c=!1;const g=typeof a.success=="function"?await a.success(h):a.success,y=typeof a.description=="function"?await a.description(h):a.description,j=typeof g=="object"&&!me.isValidElement(g)?g:{message:g};this.create({id:o,type:"success",description:y,...j})}}).catch(async h=>{if(d=["reject",h],a.error!==void 0){c=!1;const b=typeof a.error=="function"?await a.error(h):a.error,g=typeof a.description=="function"?await a.description(h):a.description,w=typeof b=="object"&&!me.isValidElement(b)?b:{message:b};this.create({id:o,type:"error",description:g,...w})}}).finally(()=>{c&&(this.dismiss(o),o=void 0),a.finally==null||a.finally.call(a)}),p=()=>new Promise((h,b)=>m.then(()=>d[0]==="reject"?b(d[1]):h(d[1])).catch(b));return typeof o!="string"&&typeof o!="number"?{unwrap:p}:Object.assign(o,{unwrap:p})},this.custom=(n,a)=>{const o=(a==null?void 0:a.id)||kh++;return this.create({jsx:n(o),id:o,...a}),o},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const wn=new HP,VP=(e,n)=>{const a=(n==null?void 0:n.id)||kh++;return wn.addToast({title:e,...n,id:a}),a},GP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",FP=VP,WP=()=>wn.toasts,YP=()=>wn.getActiveToasts(),Bt=Object.assign(FP,{success:wn.success,info:wn.info,warning:wn.warning,error:wn.error,custom:wn.custom,message:wn.message,promise:wn.promise,dismiss:wn.dismiss,loading:wn.loading},{getHistory:WP,getToasts:YP});_P("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function pu(e){return e.label!==void 0}const qP=3,KP="24px",XP="16px",v0=4e3,ZP=356,QP=14,JP=45,eI=200;function wr(...e){return e.filter(Boolean).join(" ")}function tI(e){const[n,a]=e.split("-"),o=[];return n&&o.push(n),a&&o.push(a),o}const nI=e=>{var n,a,o,l,c,d,m,p,h;const{invert:b,toast:g,unstyled:y,interacting:w,setHeights:j,visibleToasts:S,heights:E,index:N,toasts:k,expanded:T,removeToast:A,defaultRichColors:O,closeButton:M,style:z,cancelButtonStyle:B,actionButtonStyle:K,className:U="",descriptionClassName:q="",duration:ue,position:pe,gap:xe,expandByDefault:se,classNames:L,icons:I,closeButtonAriaLabel:H="Close toast"}=e,[Z,te]=me.useState(null),[_,D]=me.useState(null),[G,V]=me.useState(!1),[F,oe]=me.useState(!1),[ae,be]=me.useState(!1),[ve,Y]=me.useState(!1),[le,ye]=me.useState(!1),[Te,Le]=me.useState(0),[rt,ht]=me.useState(0),Mt=me.useRef(g.duration||ue||v0),Tr=me.useRef(null),_t=me.useRef(null),Ya=N===0,qa=N+1<=S,qt=g.type,dr=g.dismissible!==!1,Kt=g.className||"",ti=g.descriptionClassName||"",fr=me.useMemo(()=>E.findIndex(Me=>Me.toastId===g.id)||0,[E,g.id]),Lo=me.useMemo(()=>{var Me;return(Me=g.closeButton)!=null?Me:M},[g.closeButton,M]),Rr=me.useMemo(()=>g.duration||ue||v0,[g.duration,ue]),Xt=me.useRef(0),Qn=me.useRef(0),zo=me.useRef(0),mr=me.useRef(null),[pr,Ht]=pe.split("-"),ee=me.useMemo(()=>E.reduce((Me,Je,St)=>St>=fr?Me:Me+Je.height,0),[E,fr]),re=UP(),ke=g.invert||b,we=qt==="loading";Qn.current=me.useMemo(()=>fr*xe+ee,[fr,ee]),me.useEffect(()=>{Mt.current=Rr},[Rr]),me.useEffect(()=>{V(!0)},[]),me.useEffect(()=>{const Me=_t.current;if(Me){const Je=Me.getBoundingClientRect().height;return ht(Je),j(St=>[{toastId:g.id,height:Je,position:g.position},...St]),()=>j(St=>St.filter(kt=>kt.toastId!==g.id))}},[j,g.id]),me.useLayoutEffect(()=>{if(!G)return;const Me=_t.current,Je=Me.style.height;Me.style.height="auto";const St=Me.getBoundingClientRect().height;Me.style.height=Je,ht(St),j(kt=>kt.find(wt=>wt.toastId===g.id)?kt.map(wt=>wt.toastId===g.id?{...wt,height:St}:wt):[{toastId:g.id,height:St,position:g.position},...kt])},[G,g.title,g.description,j,g.id,g.jsx,g.action,g.cancel]);const De=me.useCallback(()=>{oe(!0),Le(Qn.current),j(Me=>Me.filter(Je=>Je.toastId!==g.id)),setTimeout(()=>{A(g)},eI)},[g,A,j,Qn]);me.useEffect(()=>{if(g.promise&&qt==="loading"||g.duration===1/0||g.type==="loading")return;let Me;return T||w||re?(()=>{if(zo.current{Mt.current!==1/0&&(Xt.current=new Date().getTime(),Me=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),De()},Mt.current))})(),()=>clearTimeout(Me)},[T,w,g,qt,re,De]),me.useEffect(()=>{g.delete&&(De(),g.onDismiss==null||g.onDismiss.call(g,g))},[De,g.delete]);function at(){var Me;if(I!=null&&I.loading){var Je;return me.createElement("div",{className:wr(L==null?void 0:L.loader,g==null||(Je=g.classNames)==null?void 0:Je.loader,"sonner-loader"),"data-visible":qt==="loading"},I.loading)}return me.createElement(LP,{className:wr(L==null?void 0:L.loader,g==null||(Me=g.classNames)==null?void 0:Me.loader),visible:qt==="loading"})}const ct=g.icon||(I==null?void 0:I[qt])||OP(qt);var mt,Zt;return me.createElement("li",{tabIndex:0,ref:_t,className:wr(U,Kt,L==null?void 0:L.toast,g==null||(n=g.classNames)==null?void 0:n.toast,L==null?void 0:L.default,L==null?void 0:L[qt],g==null||(a=g.classNames)==null?void 0:a[qt]),"data-sonner-toast":"","data-rich-colors":(mt=g.richColors)!=null?mt:O,"data-styled":!(g.jsx||g.unstyled||y),"data-mounted":G,"data-promise":!!g.promise,"data-swiped":le,"data-removed":F,"data-visible":qa,"data-y-position":pr,"data-x-position":Ht,"data-index":N,"data-front":Ya,"data-swiping":ae,"data-dismissible":dr,"data-type":qt,"data-invert":ke,"data-swipe-out":ve,"data-swipe-direction":_,"data-expanded":!!(T||se&&G),"data-testid":g.testId,style:{"--index":N,"--toasts-before":N,"--z-index":k.length-N,"--offset":`${F?Te:Qn.current}px`,"--initial-height":se?"auto":`${rt}px`,...z,...g.style},onDragEnd:()=>{be(!1),te(null),mr.current=null},onPointerDown:Me=>{Me.button!==2&&(we||!dr||(Tr.current=new Date,Le(Qn.current),Me.target.setPointerCapture(Me.pointerId),Me.target.tagName!=="BUTTON"&&(be(!0),mr.current={x:Me.clientX,y:Me.clientY})))},onPointerUp:()=>{var Me,Je,St;if(ve||!dr)return;mr.current=null;const kt=Number(((Me=_t.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Jn=Number(((Je=_t.current)==null?void 0:Je.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),wt=new Date().getTime()-((St=Tr.current)==null?void 0:St.getTime()),dn=Z==="x"?kt:Jn,Ka=Math.abs(dn)/wt;if(Math.abs(dn)>=JP||Ka>.11){Le(Qn.current),g.onDismiss==null||g.onDismiss.call(g,g),D(Z==="x"?kt>0?"right":"left":Jn>0?"down":"up"),De(),Y(!0);return}else{var fn,mn;(fn=_t.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(mn=_t.current)==null||mn.style.setProperty("--swipe-amount-y","0px")}ye(!1),be(!1),te(null)},onPointerMove:Me=>{var Je,St,kt;if(!mr.current||!dr||((Je=window.getSelection())==null?void 0:Je.toString().length)>0)return;const wt=Me.clientY-mr.current.y,dn=Me.clientX-mr.current.x;var Ka;const fn=(Ka=e.swipeDirections)!=null?Ka:tI(pe);!Z&&(Math.abs(dn)>1||Math.abs(wt)>1)&&te(Math.abs(dn)>Math.abs(wt)?"x":"y");let mn={x:0,y:0};const Po=er=>1/(1.5+Math.abs(er)/20);if(Z==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&wt<0||fn.includes("bottom")&&wt>0)mn.y=wt;else{const er=wt*Po(wt);mn.y=Math.abs(er)0)mn.x=dn;else{const er=dn*Po(dn);mn.x=Math.abs(er)0||Math.abs(mn.y)>0)&&ye(!0),(St=_t.current)==null||St.style.setProperty("--swipe-amount-x",`${mn.x}px`),(kt=_t.current)==null||kt.style.setProperty("--swipe-amount-y",`${mn.y}px`)}},Lo&&!g.jsx&&qt!=="loading"?me.createElement("button",{"aria-label":H,"data-disabled":we,"data-close-button":!0,onClick:we||!dr?()=>{}:()=>{De(),g.onDismiss==null||g.onDismiss.call(g,g)},className:wr(L==null?void 0:L.closeButton,g==null||(o=g.classNames)==null?void 0:o.closeButton)},(Zt=I==null?void 0:I.close)!=null?Zt:BP):null,(qt||g.icon||g.promise)&&g.icon!==null&&((I==null?void 0:I[qt])!==null||g.icon)?me.createElement("div",{"data-icon":"",className:wr(L==null?void 0:L.icon,g==null||(l=g.classNames)==null?void 0:l.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||at():null,g.type!=="loading"?ct:null):null,me.createElement("div",{"data-content":"",className:wr(L==null?void 0:L.content,g==null||(c=g.classNames)==null?void 0:c.content)},me.createElement("div",{"data-title":"",className:wr(L==null?void 0:L.title,g==null||(d=g.classNames)==null?void 0:d.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?me.createElement("div",{"data-description":"",className:wr(q,ti,L==null?void 0:L.description,g==null||(m=g.classNames)==null?void 0:m.description)},typeof g.description=="function"?g.description():g.description):null),me.isValidElement(g.cancel)?g.cancel:g.cancel&&pu(g.cancel)?me.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||B,onClick:Me=>{pu(g.cancel)&&dr&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,Me),De())},className:wr(L==null?void 0:L.cancelButton,g==null||(p=g.classNames)==null?void 0:p.cancelButton)},g.cancel.label):null,me.isValidElement(g.action)?g.action:g.action&&pu(g.action)?me.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||K,onClick:Me=>{pu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,Me),!Me.defaultPrevented&&De())},className:wr(L==null?void 0:L.actionButton,g==null||(h=g.classNames)==null?void 0:h.actionButton)},g.action.label):null)};function b0(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function rI(e,n){const a={};return[e,n].forEach((o,l)=>{const c=l===1,d=c?"--mobile-offset":"--offset",m=c?XP:KP;function p(h){["top","right","bottom","left"].forEach(b=>{a[`${d}-${b}`]=typeof h=="number"?`${h}px`:h})}typeof o=="number"||typeof o=="string"?p(o):typeof o=="object"?["top","right","bottom","left"].forEach(h=>{o[h]===void 0?a[`${d}-${h}`]=m:a[`${d}-${h}`]=typeof o[h]=="number"?`${o[h]}px`:o[h]}):p(m)}),a}const aI=me.forwardRef(function(n,a){const{id:o,invert:l,position:c="bottom-right",hotkey:d=["altKey","KeyT"],expand:m,closeButton:p,className:h,offset:b,mobileOffset:g,theme:y="light",richColors:w,duration:j,style:S,visibleToasts:E=qP,toastOptions:N,dir:k=b0(),gap:T=QP,icons:A,containerAriaLabel:O="Notifications"}=n,[M,z]=me.useState([]),B=me.useMemo(()=>o?M.filter(G=>G.toasterId===o):M.filter(G=>!G.toasterId),[M,o]),K=me.useMemo(()=>Array.from(new Set([c].concat(B.filter(G=>G.position).map(G=>G.position)))),[B,c]),[U,q]=me.useState([]),[ue,pe]=me.useState(!1),[xe,se]=me.useState(!1),[L,I]=me.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=me.useRef(null),Z=d.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=me.useRef(null),_=me.useRef(!1),D=me.useCallback(G=>{z(V=>{var F;return(F=V.find(oe=>oe.id===G.id))!=null&&F.delete||wn.dismiss(G.id),V.filter(({id:oe})=>oe!==G.id)})},[]);return me.useEffect(()=>wn.subscribe(G=>{if(G.dismiss){requestAnimationFrame(()=>{z(V=>V.map(F=>F.id===G.id?{...F,delete:!0}:F))});return}setTimeout(()=>{X0.flushSync(()=>{z(V=>{const F=V.findIndex(oe=>oe.id===G.id);return F!==-1?[...V.slice(0,F),{...V[F],...G},...V.slice(F+1)]:[G,...V]})})})}),[M]),me.useEffect(()=>{if(y!=="system"){I(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?I("dark"):I("light")),typeof window>"u")return;const G=window.matchMedia("(prefers-color-scheme: dark)");try{G.addEventListener("change",({matches:V})=>{I(V?"dark":"light")})}catch{G.addListener(({matches:F})=>{try{I(F?"dark":"light")}catch(oe){console.error(oe)}})}},[y]),me.useEffect(()=>{M.length<=1&&pe(!1)},[M]),me.useEffect(()=>{const G=V=>{var F;if(d.every(be=>V[be]||V.code===be)){var ae;pe(!0),(ae=H.current)==null||ae.focus()}V.code==="Escape"&&(document.activeElement===H.current||(F=H.current)!=null&&F.contains(document.activeElement))&&pe(!1)};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[d]),me.useEffect(()=>{if(H.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,_.current=!1)}},[H.current]),me.createElement("section",{ref:a,"aria-label":`${O} ${Z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((G,V)=>{var F;const[oe,ae]=G.split("-");return B.length?me.createElement("ol",{key:G,dir:k==="auto"?b0():k,tabIndex:-1,ref:H,className:h,"data-sonner-toaster":!0,"data-sonner-theme":L,"data-y-position":oe,"data-x-position":ae,style:{"--front-toast-height":`${((F=U[0])==null?void 0:F.height)||0}px`,"--width":`${ZP}px`,"--gap":`${T}px`,...S,...rI(b,g)},onBlur:be=>{_.current&&!be.currentTarget.contains(be.relatedTarget)&&(_.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:be=>{be.target instanceof HTMLElement&&be.target.dataset.dismissible==="false"||_.current||(_.current=!0,te.current=be.relatedTarget)},onMouseEnter:()=>pe(!0),onMouseMove:()=>pe(!0),onMouseLeave:()=>{xe||pe(!1)},onDragEnd:()=>pe(!1),onPointerDown:be=>{be.target instanceof HTMLElement&&be.target.dataset.dismissible==="false"||se(!0)},onPointerUp:()=>se(!1)},B.filter(be=>!be.position&&V===0||be.position===G).map((be,ve)=>{var Y,le;return me.createElement(nI,{key:be.id,icons:A,index:ve,toast:be,defaultRichColors:w,duration:(Y=N==null?void 0:N.duration)!=null?Y:j,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:l,visibleToasts:E,closeButton:(le=N==null?void 0:N.closeButton)!=null?le:p,interacting:xe,position:G,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,closeButtonAriaLabel:N==null?void 0:N.closeButtonAriaLabel,removeToast:D,toasts:B.filter(ye=>ye.position==be.position),heights:U.filter(ye=>ye.position==be.position),setHeights:q,expandByDefault:m,gap:T,expanded:ue,swipeDirections:n.swipeDirections})})):null}))});async function ku(e){const n=Bt.loading("Saving changes…");try{const a=await e();if(Bt.success("Changes saved",{id:n}),a.botRestart){const o=Bt.loading("Restarting bot…");a.botRestart.success?Bt.success("Bot started",{id:o}):Bt.error(a.botRestart.error??"Could not start bot",{id:o})}return a}catch(a){throw Bt.error(a instanceof Error?a.message:"Save failed",{id:n}),a}}function oI({filename:e}){const{canEditConfig:n}=Ut(),a=!n("supportbot"),[o,l]=f.useState(null),[c,d]=f.useState(null),[m,p]=f.useState(!0),[h,b]=f.useState(!1),[g,y]=f.useState(""),[w,j]=f.useState(""),S=f.useCallback(async()=>{p(!0),y(""),j("");try{const O=(await Ee.getAddonConfigJson(e)).data??{};l(O),d(structuredClone(O))}catch(A){y(A instanceof Error?A.message:"Failed to load config")}finally{p(!1)}},[e]);f.useEffect(()=>{S()},[S]);const E=o?MP(o):null;function N(A,O){l(M=>M&&xl(M,A,O))}async function k(){if(!(a||!o)){b(!0),y(""),j("");try{const A=await ku(()=>Ee.saveAddonConfig(e,o));j(A.message||"Saved."),await S()}catch(A){y(A instanceof Error?A.message:"Save failed")}finally{b(!1)}}}if(m)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-24 w-full rounded-xl"}),s.jsx(Be,{className:"h-48 w-full rounded-xl"})]});if(!o||!E)return s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g||"Failed to load"})});const T=c&&JSON.stringify(o)!==JSON.stringify(c);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[T?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,s.jsx(he,{variant:"outline",size:"sm",onClick:S,disabled:m||h,children:"Reload"}),a?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(he,{size:"sm",onClick:k,disabled:h||!T,children:[s.jsx(ge,{icon:nd,size:16,className:"mr-1.5"}),h?"Saving…":"Save"]})]}),g?s.jsxs(We,{variant:"destructive",children:[s.jsx(ge,{icon:Bh,size:18}),s.jsx(Ye,{children:g})]}):null,w?s.jsx(We,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(Ye,{children:w})}):null,E.map(A=>s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"pb-3",children:[s.jsx(lt,{className:"text-base",children:A.title}),A.description?s.jsx(Et,{children:A.description}):null]}),s.jsx(Ze,{className:"grid gap-4 sm:grid-cols-2",children:A.fields.map(O=>s.jsx("div",{className:O.type==="textarea"||O.type==="stringList"?"sm:col-span-2":"",children:s.jsx(Vg,{field:O,value:To(o,O.path),readOnly:a,onChange:M=>N(O.path,M)})},O.path))})]},A.title))]})}function sI(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function iI(e,n){const a=new Set(e.flatMap(d=>d.fields.map(m=>m.path))),o=Fg(n).filter(d=>!a.has(d.path));if(o.length===0)return e;const l=new Map;for(const d of o){const m=d.path.split(".")[0]??"Other",p=l.get(m)??[];p.push(d),l.set(m,p)}const c=[...l.entries()].sort(([d],[m])=>d.localeCompare(m)).map(([d,m])=>({title:sI(d),description:"These options exist in your config file but are not in the main editor sections.",fields:m.sort((p,h)=>p.path.localeCompare(h.path))}));return[...e,...c]}function y0(e,n){(n==null||n>e.length)&&(n=e.length);for(var a=0,o=Array(n);a=e.length?e.apply(this,l):function(){for(var d=arguments.length,m=new Array(d),p=0;p1&&arguments[1]!==void 0?arguments[1]:{};hu.initial(e),hu.handler(n);var a={current:e},o=Ji(MI)(a,n),l=Ji(AI)(a),c=Ji(hu.changes)(e),d=Ji(RI)(a);function m(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(b){return b};return hu.selector(h),h(a.current)}function p(h){bI(o,l,c,d)(h)}return[m,p]}function RI(e,n){return vl(n)?n(e.current):n}function AI(e,n){return e.current=j0(j0({},e.current),n),n}function MI(e,n,a){return vl(n)?n(e.current):Object.keys(a).forEach(function(o){var l;return(l=n[o])===null||l===void 0?void 0:l.call(n,e.current[o])}),a}var _I={create:TI},OI={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function DI(e){return function n(){for(var a=this,o=arguments.length,l=new Array(o),c=0;c=e.length?e.apply(this,l):function(){for(var d=arguments.length,m=new Array(d),p=0;p{o.current=!1}:e,n)}var Mn=s$;function al(){}function Rs(e,n,a,o){return i$(e,o)||l$(e,n,a,o)}function i$(e,n){return e.editor.getModel(eN(e,n))}function l$(e,n,a,o){return e.editor.createModel(n,a,o?eN(e,o):void 0)}function eN(e,n){return e.Uri.parse(n)}function c$({original:e,modified:n,language:a,originalLanguage:o,modifiedLanguage:l,originalModelPath:c,modifiedModelPath:d,keepCurrentOriginalModel:m=!1,keepCurrentModifiedModel:p=!1,theme:h="light",loading:b="Loading...",options:g={},height:y="100%",width:w="100%",className:j,wrapperProps:S={},beforeMount:E=al,onMount:N=al}){let[k,T]=f.useState(!1),[A,O]=f.useState(!0),M=f.useRef(null),z=f.useRef(null),B=f.useRef(null),K=f.useRef(N),U=f.useRef(E),q=f.useRef(!1);J5(()=>{let se=Z5.init();return se.then(L=>(z.current=L)&&O(!1)).catch(L=>(L==null?void 0:L.type)!=="cancelation"&&console.error("Monaco initialization: error:",L)),()=>M.current?xe():se.cancel()}),Mn(()=>{if(M.current&&z.current){let se=M.current.getOriginalEditor(),L=Rs(z.current,e||"",o||a||"text",c||"");L!==se.getModel()&&se.setModel(L)}},[c],k),Mn(()=>{if(M.current&&z.current){let se=M.current.getModifiedEditor(),L=Rs(z.current,n||"",l||a||"text",d||"");L!==se.getModel()&&se.setModel(L)}},[d],k),Mn(()=>{let se=M.current.getModifiedEditor();se.getOption(z.current.editor.EditorOption.readOnly)?se.setValue(n||""):n!==se.getValue()&&(se.executeEdits("",[{range:se.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),se.pushUndoStop())},[n],k),Mn(()=>{var se,L;(L=(se=M.current)==null?void 0:se.getModel())==null||L.original.setValue(e||"")},[e],k),Mn(()=>{let{original:se,modified:L}=M.current.getModel();z.current.editor.setModelLanguage(se,o||a||"text"),z.current.editor.setModelLanguage(L,l||a||"text")},[a,o,l],k),Mn(()=>{var se;(se=z.current)==null||se.editor.setTheme(h)},[h],k),Mn(()=>{var se;(se=M.current)==null||se.updateOptions(g)},[g],k);let ue=f.useCallback(()=>{var I;if(!z.current)return;U.current(z.current);let se=Rs(z.current,e||"",o||a||"text",c||""),L=Rs(z.current,n||"",l||a||"text",d||"");(I=M.current)==null||I.setModel({original:se,modified:L})},[a,n,l,e,o,c,d]),pe=f.useCallback(()=>{var se;!q.current&&B.current&&(M.current=z.current.editor.createDiffEditor(B.current,{automaticLayout:!0,...g}),ue(),(se=z.current)==null||se.editor.setTheme(h),T(!0),q.current=!0)},[g,h,ue]);f.useEffect(()=>{k&&K.current(M.current,z.current)},[k]),f.useEffect(()=>{!A&&!k&&pe()},[A,k,pe]);function xe(){var L,I,H,Z;let se=(L=M.current)==null?void 0:L.getModel();m||((I=se==null?void 0:se.original)==null||I.dispose()),p||((H=se==null?void 0:se.modified)==null||H.dispose()),(Z=M.current)==null||Z.dispose()}return me.createElement(Q5,{width:w,height:y,isEditorReady:k,loading:b,_ref:B,className:j,wrapperProps:S})}var u$=c$;f.memo(u$);function d$(e){let n=f.useRef();return f.useEffect(()=>{n.current=e},[e]),n.current}var f$=d$,gu=new Map;function m$({defaultValue:e,defaultLanguage:n,defaultPath:a,value:o,language:l,path:c,theme:d="light",line:m,loading:p="Loading...",options:h={},overrideServices:b={},saveViewState:g=!0,keepCurrentModel:y=!1,width:w="100%",height:j="100%",className:S,wrapperProps:E={},beforeMount:N=al,onMount:k=al,onChange:T,onValidate:A=al}){let[O,M]=f.useState(!1),[z,B]=f.useState(!0),K=f.useRef(null),U=f.useRef(null),q=f.useRef(null),ue=f.useRef(k),pe=f.useRef(N),xe=f.useRef(),se=f.useRef(o),L=f$(c),I=f.useRef(!1),H=f.useRef(!1);J5(()=>{let _=Z5.init();return _.then(D=>(K.current=D)&&B(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>U.current?te():_.cancel()}),Mn(()=>{var D,G,V,F;let _=Rs(K.current,e||o||"",n||l||"",c||a||"");_!==((D=U.current)==null?void 0:D.getModel())&&(g&&gu.set(L,(G=U.current)==null?void 0:G.saveViewState()),(V=U.current)==null||V.setModel(_),g&&((F=U.current)==null||F.restoreViewState(gu.get(c))))},[c],O),Mn(()=>{var _;(_=U.current)==null||_.updateOptions(h)},[h],O),Mn(()=>{!U.current||o===void 0||(U.current.getOption(K.current.editor.EditorOption.readOnly)?U.current.setValue(o):o!==U.current.getValue()&&(H.current=!0,U.current.executeEdits("",[{range:U.current.getModel().getFullModelRange(),text:o,forceMoveMarkers:!0}]),U.current.pushUndoStop(),H.current=!1))},[o],O),Mn(()=>{var D,G;let _=(D=U.current)==null?void 0:D.getModel();_&&l&&((G=K.current)==null||G.editor.setModelLanguage(_,l))},[l],O),Mn(()=>{var _;m!==void 0&&((_=U.current)==null||_.revealLine(m))},[m],O),Mn(()=>{var _;(_=K.current)==null||_.editor.setTheme(d)},[d],O);let Z=f.useCallback(()=>{var _;if(!(!q.current||!K.current)&&!I.current){pe.current(K.current);let D=c||a,G=Rs(K.current,o||e||"",n||l||"",D||"");U.current=(_=K.current)==null?void 0:_.editor.create(q.current,{model:G,automaticLayout:!0,...h},b),g&&U.current.restoreViewState(gu.get(D)),K.current.editor.setTheme(d),m!==void 0&&U.current.revealLine(m),M(!0),I.current=!0}},[e,n,a,o,l,c,h,b,g,d,m]);f.useEffect(()=>{O&&ue.current(U.current,K.current)},[O]),f.useEffect(()=>{!z&&!O&&Z()},[z,O,Z]),se.current=o,f.useEffect(()=>{var _,D;O&&T&&((_=xe.current)==null||_.dispose(),xe.current=(D=U.current)==null?void 0:D.onDidChangeModelContent(G=>{H.current||T(U.current.getValue(),G)}))},[O,T]),f.useEffect(()=>{if(O){let _=K.current.editor.onDidChangeMarkers(D=>{var V;let G=(V=U.current.getModel())==null?void 0:V.uri;if(G&&D.find(F=>F.path===G.path)){let F=K.current.editor.getModelMarkers({resource:G});A==null||A(F)}});return()=>{_==null||_.dispose()}}return()=>{}},[O,A]);function te(){var _,D;(_=xe.current)==null||_.dispose(),y?g&&gu.set(c,U.current.saveViewState()):(D=U.current.getModel())==null||D.dispose(),U.current.dispose()}return me.createElement(Q5,{width:w,height:j,isEditorReady:O,loading:p,_ref:q,className:S,wrapperProps:E})}var p$=m$,h$=f.memo(p$),g$=h$;function x$(e){return e!==null&&typeof e=="object"&&"Command"in e}function v$(e){return Object.entries(e).filter(([,n])=>x$(n)).map(([n,a])=>({key:n,...a}))}function b$({data:e,onChange:n}){const a=v$(e);function o(l,c){const d=e[l];n({...e,[l]:{...d,...c}})}return a.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No commands found in this config."}):s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.map(l=>s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"flex flex-row items-center gap-2 space-y-0 pb-2",children:[s.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-primary/15 text-primary",children:s.jsx(ge,{icon:Da,size:18})}),s.jsx(lt,{className:"text-base",children:l.key})]}),s.jsxs(Ze,{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ze,{htmlFor:`${l.key}-enabled`,children:"Enabled"}),s.jsx(At,{id:`${l.key}-enabled`,checked:l.Enabled!==!1,onCheckedChange:c=>o(l.key,{Enabled:c})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{children:"Slash command"}),s.jsx(Ie,{value:l.Command??"",onChange:c=>o(l.key,{Command:c.target.value}),className:"border-border bg-secondary/30 font-mono"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ze,{children:"Description"}),s.jsx(Ie,{value:l.Description??"",onChange:c=>o(l.key,{Description:c.target.value}),className:"border-border bg-secondary/30"})]})]})]},l.key))})}function y$(e,n){let a=structuredClone(n);if(e==="supportbot"){const o=To(a,"General.Token");o&&o!=="BOT_TOKEN"&&(a=xl(a,"General.Token","BOT_TOKEN"))}if(e==="supportbot-ai"){const o=To(a,"General.Model_API_Key");o&&o!=="MODEL_API_KEY"&&(a=xl(a,"General.Model_API_Key","MODEL_API_KEY"))}return a}function w$(e,n,a,o){const l={};for(const c of n)for(const d of c.fields){const m=To(a,d.path),p=To(o,d.path);d.type==="secret"&&(m==="BOT_TOKEN"||m==="MODEL_API_KEY"||m===""||m===void 0)||JSON.stringify(m)!==JSON.stringify(p)&&(l[`${e}:${d.path}`]=m)}return l}function C$({configFile:e}){const{canEditConfig:n}=Ut(),a=!n(e),[o,l]=f.useState(null),[c,d]=f.useState(null),[m,p]=f.useState(!0),[h,b]=f.useState(!1),[g,y]=f.useState(""),[w,j]=f.useState(""),[S,E]=f.useState("visual"),[N,k]=f.useState(""),[T,A]=f.useState(""),[O]=Ju(),[M,z]=f.useState(()=>O.get("tab")||null),B=D_(e),K=f.useMemo(()=>!B||B==="commands"||!o?B:iI(B,o),[B,o]);f.useEffect(()=>{var I;if(K&&K!=="commands"){const H=O.get("tab");if(H&&K.find(Z=>Z.title.toLowerCase()===H.toLowerCase())){const Z=K.find(te=>te.title.toLowerCase()===H.toLowerCase());Z&&Z.title!==M&&z(Z.title)}else(!M||!K.find(Z=>Z.title===M))&&z(((I=K[0])==null?void 0:I.title)||null)}},[K,M,O]);const U=f.useCallback(async()=>{p(!0),y(""),j("");try{const H=(await Ee.getConfigJson(e)).data??{},Z=y$(e,H);l(Z),d(Z);const _=(await Ee.getConfigRaw(e)).data??"",D=E8(_,e);k(D),A(D)}catch(I){y(I instanceof Error?I.message:"Failed to load config")}finally{p(!1)}},[e]);f.useEffect(()=>{U()},[U]);function q(I,H){l(Z=>Z&&xl(Z,I,H))}async function ue(){if(!(a||N===T)){b(!0),y(""),j("");try{const I=await ku(()=>Ee.saveConfigRaw(e,N));j(I.message||"Config saved."),await U()}catch(I){y(I instanceof Error?I.message:"Save failed")}finally{b(!1)}}}async function pe(){if(!(a||!o||!c)){if(S==="yaml"){await ue();return}b(!0),y(""),j("");try{if(B==="commands"){const I={};for(const Z of Object.keys(o))JSON.stringify(o[Z])!==JSON.stringify(c[Z])&&(I[`${e}:${Z}`]=o[Z]);if(Object.keys(I).length===0){j("No changes to save.");return}const H=await ku(()=>Ee.updateConfigFields(I));j(H.message||"")}else if(K&&K!=="commands"){const I=w$(e,K,o,c);if(Object.keys(I).length===0){j("No changes to save.");return}const H=await ku(()=>Ee.updateConfigFields(I));j(H.message||"")}await U()}catch(I){y(I instanceof Error?I.message:"Save failed")}finally{b(!1)}}}if(B===null)return s.jsx(We,{children:s.jsx(Ye,{children:"No visual editor available for this file."})});if(m)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-24 w-full rounded-xl"}),s.jsx(Be,{className:"h-48 w-full rounded-xl"})]});if(!o)return s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g||"Failed to load"})});const xe=c&&JSON.stringify(o)!==JSON.stringify(c),L=S==="yaml"?N!==T:xe;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsx(he,{type:"button",variant:S==="visual"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>E("visual"),children:"Visual"}),s.jsx(he,{type:"button",variant:S==="yaml"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>E("yaml"),children:"YAML"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[L?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,s.jsx(he,{variant:"outline",size:"sm",onClick:U,disabled:m||h,children:"Reload"}),a?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(he,{size:"sm",onClick:pe,disabled:h||!L,children:[s.jsx(ge,{icon:nd,size:16,className:"mr-1.5"}),h?"Saving…":"Save"]})]})]}),g?s.jsxs(We,{variant:"destructive",children:[s.jsx(ge,{icon:Bh,size:18}),s.jsx(Ye,{children:g})]}):null,w?s.jsx(We,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(Ye,{children:w})}):null,S==="yaml"?s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"pb-3",children:[s.jsx(lt,{className:"text-base",children:"Raw YAML"}),s.jsx(Et,{children:"Edit the full file. Use this for nested lists (e.g. welcome buttons) or any option not in Visual mode."})]}),s.jsx(Ze,{className:"h-[min(520px,60vh)] overflow-hidden rounded-b-xl border-t border-border p-0",children:s.jsx(g$,{height:"100%",language:"yaml",theme:"vs-dark",value:N,onChange:I=>k(I||""),options:{readOnly:a,minimap:{enabled:!1},fontSize:13,wordWrap:"on",scrollBeyondLastLine:!1,padding:{top:16},tabSize:2}})})]}):B==="commands"?s.jsx(b$,{data:o,onChange:I=>l(I)}):K&&K!=="commands"?s.jsxs("div",{className:"grid gap-6 lg:grid-cols-[200px_1fr]",children:[s.jsx("nav",{className:"flex flex-col gap-1",children:K.map(I=>s.jsx("button",{onClick:()=>z(I.title),className:fe("text-left px-3 py-2 text-sm rounded-md transition-colors",M===I.title?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:I.title},I.title))}),s.jsx("div",{className:"min-w-0",children:K.filter(I=>I.title===M).map(I=>s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"pb-3",children:[s.jsx(lt,{className:"text-base",children:I.title}),I.description?s.jsx(Et,{children:I.description}):null]}),s.jsx(Ze,{className:"grid gap-4 sm:grid-cols-2",children:I.fields.map(H=>s.jsx("div",{className:H.type==="textarea"||H.type==="stringList"?"sm:col-span-2":"",children:s.jsx(Vg,{field:H,value:To(o,H.path),readOnly:a,onChange:Z=>q(H.path,Z)})},H.path))})]},I.title))})]}):null]})}const S$=Ee.listConfigs(),j$={supportbot:"Bot config","ticket-panel":"Ticket panel",commands:"Commands",messages:"Messages","supportbot-ai":"AI assistant"};function N$(){var T,A;const{permissions:e,canViewConfig:n}=Ut(),{files:a}=f2(),[o,l]=Ju(),c=o.get("file"),d=n("supportbot"),m=f.useMemo(()=>S$.filter(O=>n(O)),[n]),p=f.useMemo(()=>d?a:[],[d,a]),h=f.useMemo(()=>[...m,...p.map(O=>el(O))],[m,p]),b=h[0]??"",[g,y]=f.useState(()=>c&&h.includes(c)?c:b);if(f.useEffect(()=>{c&&h.includes(c)?y(c):h.includes(g)||(y(b),b&&l({file:b}))},[c,h,g,b,l]),h.length===0)return s.jsx(Qr,{to:Wh(e),replace:!0});const w=O8(g),j=(w==null?void 0:w.type)==="addon",S=j?w.file:null,E=j?m2(S):j$[g]??"Configuration",N=j?!!((T=e==null?void 0:e.configs.supportbot)!=null&&T.edit):e?!!((A=e.configs[g])!=null&&A.edit):!1,k=j?S:`${g}.yml`;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:E}),s.jsx("p",{className:"text-muted-foreground",children:N?`Edit ${k} — changes apply to the running bot without restarting the dashboard.`:`Viewing ${k} — you do not have permission to save changes.`})]}),s.jsx("div",{className:"mt-6",children:j&&S?s.jsx(oI,{filename:S},S):s.jsx(C$,{configFile:g},g)})]})}const E$={oauth_not_configured:"Discord OAuth is not configured. Complete setup at /setup first.",not_allowed:"Your Discord account is not allowed. Ask an owner to add you under Users, or add your ID to OwnerUserIds in Configs/api.yml.",invalid_state:"Login session expired. Please try again.",missing_code:"Discord did not return an authorization code. Please try again.",oauth_failed:"Could not complete Discord sign-in. Check your OAuth settings.",access_denied:"You cancelled Discord sign-in."};function k$(e){return e?E$[e]||"Sign-in failed. Please try again.":""}function T$(){const{branding:e}=od(),{isAuthenticated:n,loading:a,loginWithDiscord:o}=Ut(),[l]=Ju(),c=f.useMemo(()=>k$(l.get("error")),[l]);return!a&&n?s.jsx(Qr,{to:"/",replace:!0}):s.jsx("div",{className:"relative flex min-h-svh items-center justify-center bg-[#0c0c10] p-4 overflow-hidden",children:s.jsxs(Xe,{className:"relative z-10 w-full max-w-md overflow-hidden rounded-3xl border border-white/10 bg-card/30 p-2 shadow-2xl backdrop-blur-2xl",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/5 to-transparent pointer-events-none"}),s.jsxs(it,{className:"space-y-6 pt-10 pb-4 text-center",children:[s.jsx("div",{className:"mx-auto flex size-28 items-center justify-center overflow-hidden rounded-3xl bg-white/5 p-4 shadow-inner ring-1 ring-white/10 transition-transform duration-500 hover:scale-105",children:s.jsx("img",{src:"/logo.png",alt:"SupportBot Logo",className:"h-full w-full object-contain drop-shadow-xl"})}),s.jsxs("div",{children:[s.jsx(lt,{className:"bg-gradient-to-br from-white to-white/50 bg-clip-text text-3xl font-extrabold tracking-tight text-transparent",children:e.title||"SupportBot"}),s.jsx(Et,{className:"mt-2 text-base font-medium text-white/50",children:"Sign in to your dashboard"})]})]}),s.jsxs(Ze,{className:"space-y-6 pb-10",children:[s.jsxs("div",{className:"text-center space-y-1",children:[s.jsx("p",{className:"text-sm font-medium text-white/50",children:"Securely authenticate using your Discord account."}),s.jsxs("p",{className:"text-xs text-white/30",children:["Credentials are configured in ",s.jsx("code",{className:"rounded bg-white/5 px-1 py-0.5 text-white/40",children:"Configs/api.yml"})]})]}),c?s.jsx(We,{variant:"destructive",className:"border-red-500/50 bg-red-500/10 text-red-200 backdrop-blur-md",children:s.jsx(Ye,{className:"font-medium",children:c})}):null,s.jsxs(he,{type:"button",className:"group relative w-full overflow-hidden rounded-2xl bg-primary px-8 py-6 text-base font-bold text-primary-foreground shadow-[0_0_20px_rgba(var(--primary),0.3)] transition-all duration-300 hover:scale-[1.02] hover:shadow-[0_0_30px_rgba(var(--primary),0.5)] active:scale-95",disabled:a,onClick:o,children:[s.jsx("div",{className:"absolute inset-0 translate-x-[-100%] bg-gradient-to-r from-transparent via-white/20 to-transparent transition-transform duration-1000 group-hover:translate-x-[100%]"}),s.jsxs("span",{className:"relative flex items-center justify-center gap-2",children:[s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 127.14 96.36",fill:"currentColor",children:s.jsx("path",{d:"M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1,105.25,105.25,0,0,0,32.19-16.14c2.64-27.38-4.51-51.11-19.32-72.15ZM42.68,68.22c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C52.34,63.32,48.09,68.22,42.68,68.22Zm41.76,0c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C84.44,63.32,80.19,68.22,84.44,68.22Z"})}),a?"Authenticating...":"Continue with Discord"]})]})]})]})})}const Os=[{id:"botToken",title:"Bot token",subtitle:"Connect your Discord bot",icon:Hh},{id:"secretKey",title:"Session secret",subtitle:"Secure dashboard logins",icon:y8},{id:"oauth",title:"Discord OAuth",subtitle:"Sign in with Discord",icon:oy},{id:"redirectUri",title:"Redirect URL",subtitle:"OAuth callback address",icon:rd},{id:"owners",title:"Dashboard owners",subtitle:"Who can access this panel",icon:Fp},{id:"emeraldApi",title:"Emerald API",subtitle:"One-click addons",icon:oy}];function R$(e){return e==="oauth"?"oauth":e==="owners"?"owners":e}function A$({brandingTitle:e,faviconUrl:n,faviconVersion:a,hasFavicon:o,children:l}){return s.jsx("div",{className:"min-h-svh bg-background",children:s.jsxs("div",{className:"mx-auto flex min-h-svh max-w-6xl flex-col px-4 py-6 md:px-8 md:py-10",children:[s.jsxs("header",{className:"mb-8 flex items-center gap-4",children:[o&&n?s.jsx("img",{src:`${n}${a?`?v=${a}`:""}`,alt:"",className:"size-12 rounded-2xl border border-border object-contain"}):s.jsx("div",{className:"flex size-12 items-center justify-center rounded-2xl border border-border bg-primary text-primary-foreground",children:s.jsx(ge,{icon:Hh,size:24})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"First-time setup"}),s.jsx("h1",{className:"text-2xl font-semibold tracking-tight md:text-3xl",children:e})]})]}),l]})})}function M$({currentIndex:e,validation:n}){const a=(e+1)/Os.length*100;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Step ",e+1," of ",Os.length]}),s.jsxs("span",{children:[Math.round(a),"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-secondary",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300 ease-out",style:{width:`${a}%`}})})]}),s.jsx("nav",{className:"hidden space-y-1 md:block","aria-label":"Setup steps",children:Os.map((o,l)=>{var h;const c=R$(o.id),d=(h=n[c])==null?void 0:h.ok,m=l===e,p=ls.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(ge,{icon:ed,size:14}),o.globalName||o.username,s.jsx("span",{className:"font-mono text-xs opacity-80",children:o.id})]},o.id))}):null,!e.bot&&!((a=e.users)!=null&&a.length)?s.jsx("p",{children:e.warning||"Verified successfully."}):null]})}):s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:e.error})}):null}function O$({values:e,setValues:n,validation:a,validating:o,onValidate:l}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Open the"," ",s.jsx("a",{href:"https://discord.com/developers/applications",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:"Discord Developer Portal"}),", select your application, go to ",s.jsx("strong",{children:"Bot"}),", and reset or copy the token."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"botToken",children:"Bot token"}),s.jsx(Ie,{id:"botToken",type:"password",autoComplete:"off",value:e.botToken,onChange:c=>n({...e,botToken:c.target.value}),placeholder:"MTI…",className:"h-11 font-mono text-sm"})]}),s.jsx(ei,{result:a.botToken}),s.jsx("div",{className:"mt-auto",children:s.jsx(he,{type:"button",variant:"secondary",disabled:o||!e.botToken,onClick:l,children:o?"Checking with Discord…":"Verify bot token"})})]})}function D$({values:e,setValues:n,validation:a,validating:o,onValidate:l,onGenerate:c}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:"This random string signs your login cookies. Store it like a password — do not commit it to public repos."}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"secretKey",children:"Session secret"}),s.jsx(Ie,{id:"secretKey",type:"password",autoComplete:"off",value:e.secretKey,onChange:d=>n({...e,secretKey:d.target.value}),className:"h-11 font-mono text-sm"})]}),s.jsx(ei,{result:a.secretKey}),s.jsxs("div",{className:"mt-auto flex flex-wrap gap-2",children:[s.jsx(he,{type:"button",variant:"outline",onClick:c,children:"Generate secure secret"}),s.jsx(he,{type:"button",variant:"secondary",disabled:o||!e.secretKey,onClick:l,children:o?"Checking…":"Validate"})]})]})}function L$({values:e,setValues:n,validation:a,validating:o,onValidate:l}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Use the ",s.jsx("strong",{children:"same application"})," as your bot. Under OAuth2, copy the Client ID and Client Secret."]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(ze,{htmlFor:"clientId",children:"Client ID"}),s.jsx(Ie,{id:"clientId",value:e.clientId,onChange:c=>n({...e,clientId:c.target.value}),className:"h-11 font-mono text-sm"})]}),s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(ze,{htmlFor:"clientSecret",children:"Client Secret"}),s.jsx(Ie,{id:"clientSecret",type:"password",autoComplete:"off",value:e.clientSecret,onChange:c=>n({...e,clientSecret:c.target.value}),className:"h-11 font-mono text-sm"})]})]}),s.jsx(ei,{result:a.oauth}),s.jsx("div",{className:"mt-auto",children:s.jsx(he,{type:"button",variant:"secondary",disabled:o||!e.clientId||!e.clientSecret,onClick:l,children:o?"Checking with Discord…":"Verify OAuth credentials"})})]})}function z$({values:e,setValues:n,validation:a}){async function o(){if(e.redirectUri)try{await navigator.clipboard.writeText(e.redirectUri)}catch{}}return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Add this exact URL under ",s.jsx("strong",{children:"OAuth2 → Redirects"})," in the Developer Portal. It must match character-for-character."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"redirectUri",children:"Redirect URI"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ie,{id:"redirectUri",value:e.redirectUri,onChange:l=>n({...e,redirectUri:l.target.value}),className:"h-11 flex-1 font-mono text-xs"}),s.jsx(he,{type:"button",variant:"outline",size:"icon",className:"size-11 shrink-0",onClick:()=>void o(),title:"Copy URL",children:s.jsx(ge,{icon:t2,size:18})})]})]}),a.redirectUri&&!a.redirectUri.ok?s.jsx(ei,{result:a.redirectUri}):s.jsx(We,{className:"border-border bg-secondary",children:s.jsx(Ye,{className:"text-sm text-muted-foreground",children:"We pre-filled this from your current dashboard URL. If you access the panel from a different domain later, update this and add the new URL in Discord too."})})]})}function P$({values:e,setValues:n,validation:a,validating:o,onValidate:l}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Enable ",s.jsx("strong",{children:"Developer Mode"})," in Discord (Settings → Advanced), then right-click your profile and ",s.jsx("strong",{children:"Copy User ID"}),". Add one ID per line."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"owners",children:"Owner user IDs"}),s.jsx(Ld,{id:"owners",value:e.ownerUserIds,onChange:c=>n({...e,ownerUserIds:c.target.value}),placeholder:`829112572816130058 -987654321098765432`,className:"min-h-[120px] font-mono text-sm"})]}),s.jsx(ei,{result:a.owners}),s.jsx("div",{className:"mt-auto",children:s.jsx(he,{type:"button",variant:"secondary",disabled:o||!e.ownerUserIds.trim(),onClick:l,children:o?"Checking with Discord…":"Verify owner IDs"})})]})}function I$({onContinue:e}){return s.jsx("div",{className:"mx-auto flex w-full max-w-lg flex-1 flex-col justify-center py-8",children:s.jsxs("div",{className:"rounded-2xl border border-border bg-card px-6 py-10 text-center md:px-10",children:[s.jsx("div",{className:"mx-auto mb-6 flex size-16 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:s.jsx(ge,{icon:ed,size:40})}),s.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Setup complete"}),s.jsxs("p",{className:"mx-auto mt-3 max-w-sm text-sm leading-relaxed text-muted-foreground",children:["Your configuration has been saved. Restart the server for changes to take effect — stop the running process, then start it again (for example"," ",s.jsx("code",{className:"rounded-md bg-muted px-1.5 py-0.5 font-mono text-xs",children:"npm start"}),")."]}),s.jsx(We,{className:"mt-6 text-left",children:s.jsx(Ye,{children:"After restarting, sign in with Discord to open the dashboard."})}),s.jsx(he,{type:"button",size:"lg",className:"mt-8 min-w-[220px]",onClick:e,children:"Continue to sign in"})]})})}function $$({currentIndex:e,validating:n,saving:a,onBack:o,onNext:l,onFinish:c}){const d=e===Os.length-1;return s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs(he,{type:"button",variant:"ghost",disabled:e===0||a,onClick:o,children:[s.jsx(ge,{icon:J0,size:18,className:"mr-1"}),"Back"]}),s.jsx("div",{className:"flex flex-1 justify-end gap-2",children:d?s.jsx(he,{type:"button",size:"lg",disabled:a||n,onClick:c,className:"min-w-[200px]",children:a?"Saving…":"Finish setup"}):s.jsxs(he,{type:"button",size:"lg",disabled:n||a,onClick:l,children:["Continue",s.jsx(ge,{icon:Uh,size:18,className:"ml-1"})]})})]})}function B$({values:e,setValues:n,validation:a,validating:o,onValidate:l}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["An Emerald Services API key is optional, but required to use the one-click addon installer in the dashboard. You can get yours from the"," ",s.jsx("a",{href:"https://emeraldsrv.dev",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:"Emerald Services Marketplace"}),"."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"emeraldApiKey",children:"Emerald API key (Optional)"}),s.jsx(Ie,{id:"emeraldApiKey",type:"password",autoComplete:"off",value:e.emeraldApiKey,onChange:c=>n({...e,emeraldApiKey:c.target.value}),placeholder:"em_...",className:"h-11 font-mono text-sm"})]}),s.jsx(ei,{result:a.emeraldApi}),s.jsx("div",{className:"mt-auto",children:s.jsx(he,{type:"button",variant:"secondary",disabled:o,onClick:l,children:o?"Checking…":e.emeraldApiKey?"Verify key":"Skip step"})})]})}function U$(){const e=crypto.randomUUID().replace(/-/g,""),n=crypto.randomUUID().replace(/-/g,"");return e+n}function H$(e){return e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean)}function E0(e){return e==="oauth"?"oauth":e==="owners"?"owners":e==="emeraldApi"?"emeraldApi":e}function V$(){const e=Ro(),{branding:n}=od(),{loading:a,error:o,refresh:l,status:c}=Pj(),[d,m]=f.useState(0),[p,h]=f.useState({botToken:"",secretKey:"",clientId:"",clientSecret:"",redirectUri:"",ownerUserIds:"",emeraldApiKey:""}),[b,g]=f.useState({}),[y,w]=f.useState(!1),[j,S]=f.useState(!1),[E,N]=f.useState(""),[k,T]=f.useState(!1),A=Os[d];f.useEffect(()=>{c!=null&&c.suggestedRedirectUri&&!p.redirectUri&&h(q=>({...q,redirectUri:c.suggestedRedirectUri}))},[c==null?void 0:c.suggestedRedirectUri,p.redirectUri]);const O=f.useMemo(()=>({botToken:p.botToken,secretKey:p.secretKey,clientId:p.clientId,clientSecret:p.clientSecret,redirectUri:p.redirectUri,ownerUserIds:H$(p.ownerUserIds),emeraldApiKey:p.emeraldApiKey}),[p]);async function M(){w(!0),N("");try{const q=await Ee.validateSetup(O);return g(ue=>{var pe;return{...ue,...(pe=q.data)==null?void 0:pe.results}}),q.data}catch(q){return N(q instanceof Error?q.message:"Validation failed"),null}finally{w(!1)}}async function z(){var pe,xe;const q=E0(A.id),ue=await M();return!!((xe=(pe=ue==null?void 0:ue.results)==null?void 0:pe[q])!=null&&xe.ok)}async function B(){const q=E0(A.id),ue=b[q];!(ue!=null&&ue.ok)&&!await z()||m(pe=>Math.min(pe+1,Os.length-1))}async function K(){S(!0),N("");try{const q=await M();if(!(q!=null&&q.ok)){N("Fix the steps marked with errors before finishing.");return}await Ee.completeSetup(O),T(!0)}catch(q){N(q instanceof Error?q.message:"Could not save setup")}finally{S(!1)}}function U(){const q={values:p,setValues:h,validation:b,validating:y};switch(A.id){case"botToken":return s.jsx(O$,{...q,onValidate:()=>void z()});case"secretKey":return s.jsx(D$,{...q,onGenerate:()=>h(ue=>({...ue,secretKey:U$()})),onValidate:()=>void z()});case"oauth":return s.jsx(L$,{...q,onValidate:()=>void z()});case"redirectUri":return s.jsx(z$,{values:p,setValues:h,validation:b});case"owners":return s.jsx(P$,{...q,onValidate:()=>void z()});case"emeraldApi":return s.jsx(B$,{...q,onValidate:()=>void z()})}}return a?s.jsx("div",{className:"min-h-svh bg-background px-4 py-10",children:s.jsxs("div",{className:"mx-auto max-w-6xl space-y-8",children:[s.jsx(Be,{className:"h-14 w-64"}),s.jsxs("div",{className:"grid gap-8 lg:grid-cols-[280px_1fr]",children:[s.jsx(Be,{className:"hidden h-80 lg:block"}),s.jsx(Be,{className:"h-[520px] rounded-2xl"})]})]})}):s.jsxs(A$,{brandingTitle:n.title,faviconUrl:n.faviconUrl,faviconVersion:n.updatedAt??void 0,hasFavicon:n.hasFavicon,children:[o?s.jsx(We,{variant:"destructive",className:"mb-6",children:s.jsx(Ye,{children:o})}):null,E?s.jsx(We,{variant:"destructive",className:"mb-6",children:s.jsx(Ye,{children:E})}):null,k?s.jsx(I$,{onContinue:async()=>{await l(),e("/login",{replace:!0})}}):s.jsxs("div",{className:"grid flex-1 gap-8 lg:grid-cols-[minmax(0,280px)_1fr]",children:[s.jsx(M$,{currentIndex:d,validation:b}),s.jsx(_$,{step:A,footer:s.jsx($$,{currentIndex:d,validating:y,saving:j,onBack:()=>m(q=>Math.max(0,q-1)),onNext:()=>void B(),onFinish:()=>void K()}),children:U()})]})]})}const G$={todo:"bg-rose-500/15 text-rose-400",progress:"bg-amber-500/15 text-amber-400",done:"bg-emerald-500/15 text-emerald-400"};function F$({title:e,icon:n,href:a,badge:o="Configured",status:l="done"}){return s.jsxs(Ft,{to:a,className:fe("flex items-center gap-3 rounded-2xl border border-border bg-card p-4 transition-colors","hover:border-primary hover:bg-secondary"),children:[s.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-full bg-secondary text-primary",children:s.jsx(ge,{icon:n,size:20})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate font-semibold",children:e}),s.jsx("span",{className:fe("mt-1 inline-flex rounded-md px-2 py-0.5 text-[10px] font-semibold",G$[l]),children:o})]})]})}function W$({percent:e,size:n=128,className:a,trackClassName:o="stroke-white/20",strokeClassName:l="stroke-white"}){const d=2*Math.PI*42,m=Math.min(100,Math.max(0,e)),p=d-m/100*d;return s.jsxs("div",{className:fe("relative inline-flex",a),children:[s.jsxs("svg",{width:n,height:n,viewBox:"0 0 100 100",className:"-rotate-90","aria-hidden":!0,children:[s.jsx("circle",{cx:"50",cy:"50",r:42,fill:"none",strokeWidth:"9",className:o}),s.jsx("circle",{cx:"50",cy:"50",r:42,fill:"none",strokeWidth:"9",strokeLinecap:"round",strokeDasharray:d,strokeDashoffset:p,className:l})]}),s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center",children:[s.jsxs("span",{className:"text-2xl font-bold tabular-nums leading-none",children:[Math.round(m),"%"]}),s.jsx("span",{className:"mt-0.5 text-[10px] font-medium uppercase tracking-wide opacity-80",children:"Complete"})]})]})}const Y$={todo:{dot:"bg-rose-500",badge:"bg-rose-500/15 text-rose-400",label:"Needs setup"},progress:{dot:"bg-amber-400",badge:"bg-amber-500/15 text-amber-400",label:"In progress"},done:{dot:"bg-sky-400",badge:"bg-sky-500/15 text-sky-400",label:"Active"}};function q$({title:e,subtitle:n,icon:a,href:o,status:l,meta:c="Open in dashboard"}){const d=Y$[l];return s.jsxs(Ft,{to:o,className:fe("group flex min-w-[280px] flex-1 flex-col gap-4 rounded-2xl border border-border bg-card p-4 transition-colors","hover:border-primary hover:bg-secondary","sm:min-w-[300px] lg:min-w-0"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("span",{className:fe("mt-1.5 size-2 shrink-0 rounded-full",d.dot)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:n})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold leading-snug tracking-tight",children:e}),s.jsx("span",{className:fe("mt-2 inline-flex rounded-md px-2 py-0.5 text-[11px] font-semibold",d.badge),children:d.label})]}),s.jsxs("div",{className:"mt-auto flex items-center justify-between border-t border-border pt-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-secondary text-primary",children:s.jsx(ge,{icon:a,size:16})}),s.jsx("span",{className:"text-xs text-muted-foreground",children:c})]}),s.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[s.jsx(ge,{icon:rd,size:14,className:"opacity-60"}),s.jsx(ge,{icon:vo,size:14,className:"opacity-60 group-hover:text-primary"}),s.jsx(ge,{icon:Uh,size:14,className:"text-primary opacity-0 transition-opacity group-hover:opacity-100"})]})]})]})}function K$({stats:e}){const n=[{id:"ping",label:"Gateway latency",detail:`${e.bot.ping}ms`,badge:e.bot.ping<200?"Good":"High",badgeClass:e.bot.ping<200?"bg-emerald-500/15 text-emerald-400":"bg-amber-500/15 text-amber-400"},{id:"uptime",label:"Bot uptime",detail:Fh(e.bot.uptime),badge:"Live",badgeClass:"bg-primary/20 text-primary"},{id:"ram",label:"Memory usage",detail:`${e.hosting.ram_used} / ${e.hosting.ram_total}`,badge:`${e.hosting.ram_percent}%`,badgeClass:"bg-sky-500/15 text-sky-400"}];return s.jsxs("aside",{className:"hidden w-[min(100%,320px)] shrink-0 space-y-4 xl:block",children:[s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between space-y-0 pb-3",children:[s.jsxs(lt,{className:"text-sm font-semibold",children:["Connected servers (",e.servers,")"]}),s.jsx(he,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",children:s.jsx("span",{className:"text-lg leading-none",children:"+"})})]}),s.jsxs(Ze,{className:"pt-0",children:[s.jsxs("div",{className:"flex -space-x-2",children:[Array.from({length:Math.min(6,e.servers)}).map((a,o)=>s.jsxs(Ia,{className:"size-9 border-2 border-card ring-0",children:[s.jsx(Co,{src:e.bot.avatar,alt:""}),s.jsx($a,{className:"bg-primary/25 text-[10px] text-primary",children:String(o+1)})]},o)),e.servers>6?s.jsxs("div",{className:"flex size-9 items-center justify-center rounded-full border-2 border-card bg-secondary text-xs font-medium text-muted-foreground",children:["+",e.servers-6]}):null]}),s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[e.users.toLocaleString()," members across your guilds"]})]})]}),s.jsx(Xe,{className:"overflow-hidden border-border bg-secondary",children:s.jsx(Ze,{className:"p-5",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground",children:s.jsx(ge,{icon:b8,size:22})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:"Keep SupportBot up to date"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Check for releases and install updates from settings."})]}),s.jsx(he,{asChild:!0,size:"sm",className:"w-full",children:s.jsxs(Ft,{to:"/settings",children:[s.jsx(ge,{icon:td,size:16,className:"mr-2"}),"Open settings"]})})]})})}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(lt,{className:"text-sm font-semibold",children:"System activity"}),s.jsx(he,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",children:s.jsx("span",{className:"text-base leading-none",children:"⋯"})})]}),s.jsxs(Ze,{className:"space-y-1 p-0 pb-2",children:[n.map(a=>s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-secondary/40",children:[s.jsxs(Ia,{className:"size-9",children:[s.jsx(Co,{src:e.bot.avatar,alt:e.bot.username}),s.jsx($a,{className:"bg-secondary text-xs",children:"SB"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:a.label}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.detail})]}),s.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ${a.badgeClass}`,children:a.badge})]},a.id)),s.jsx(he,{asChild:!0,variant:"ghost",className:"mx-2 mt-1 w-[calc(100%-1rem)] justify-between text-xs text-muted-foreground",children:s.jsxs(Ft,{to:"/system",children:["All system details",s.jsx(ge,{icon:Uh,size:14})]})})]})]}),s.jsx(Xe,{className:"border-border bg-card",children:s.jsxs(Ze,{className:"flex items-center gap-3 p-4",children:[s.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-secondary text-primary",children:s.jsx(ge,{icon:vo,size:18})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-sm font-medium",children:["v",e.bot.version]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["CPU ",e.hosting.cpu_load]})]})]})})]})}const tN={todo:"Needs setup",progress:"In progress",done:"Active"};function Th(e,n,a="Configure module"){const o=n==null?void 0:n[e];return o||{status:"todo",subtitle:a}}function X$(){return s.jsxs("div",{className:"flex gap-6",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-6",children:[s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-44 rounded-2xl"}),s.jsx(Be,{className:"h-44 rounded-2xl"})]}),s.jsx(Be,{className:"h-8 w-48"}),s.jsx("div",{className:"flex gap-4 overflow-hidden",children:Array.from({length:3}).map((e,n)=>s.jsx(Be,{className:"h-40 min-w-[280px] rounded-2xl"},n))}),s.jsx(Be,{className:"h-8 w-56"}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Array.from({length:4}).map((e,n)=>s.jsx(Be,{className:"h-20 rounded-2xl"},n))})]}),s.jsx(Be,{className:"hidden h-[520px] w-80 shrink-0 rounded-2xl xl:block"})]})}function Z$(){const{stats:e,loading:n,error:a}=sd(),[o,l]=f.useState("all"),c=f.useMemo(()=>{if(!e)return 0;const b=e.tickets.total||0;return b===0?100:Math.round(e.tickets.closed/b*100)},[e]),d=f.useMemo(()=>o==="open"||o==="closed"?Ts.filter(b=>b.category==="tickets"):o==="all"?Ts:Ts.filter(b=>b.category===o),[o]);if(n)return s.jsx(X$,{});if(a||!e)return s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:a||"No stats available"})});const m=e.tickets.open,p=e.tickets.closed,h=e.tickets.total;return s.jsxs("div",{className:"flex flex-col gap-6 xl:flex-row xl:items-start",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-6",children:[s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Xe,{className:"overflow-hidden border-border bg-card",children:s.jsxs(Ze,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("p",{className:"text-lg font-semibold leading-snug",children:["You have"," ",s.jsx("span",{className:"text-primary",children:m})," open ticket",m===1?"":"s"]}),s.jsx("p",{className:"max-w-xs text-sm text-muted-foreground",children:"Review transcripts or tune your ticket panel so new requests are handled smoothly."}),s.jsx(he,{asChild:!0,size:"sm",className:"rounded-lg px-5",children:s.jsx(Ft,{to:"/transcripts",children:"Review"})})]}),s.jsxs("div",{className:"relative mx-auto flex size-28 shrink-0 items-end justify-center sm:mx-0 sm:size-32","aria-hidden":!0,children:[s.jsx("div",{className:"absolute inset-0 rounded-2xl bg-secondary"}),s.jsx("span",{className:"relative text-6xl",children:"🎫"})]})]})}),s.jsx(Xe,{className:"overflow-hidden border-border bg-primary text-primary-foreground",children:s.jsxs(Ze,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm font-medium text-white/80",children:"Ticket summary"}),s.jsxs("ul",{className:"space-y-1.5 text-sm",children:[s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[h," total"]})]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[p," closed"]})]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[m," open"]})]})]})]}),s.jsx(W$,{percent:c,size:120})]})})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"Module overview"}),s.jsx(N5,{value:o,onValueChange:b=>l(b),children:s.jsxs(zg,{className:"h-auto flex-wrap rounded-xl bg-secondary/60 p-1",children:[s.jsx(xo,{value:"all",className:"rounded-lg text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"All"}),s.jsx(xo,{value:"open",className:"rounded-lg text-xs data-[state=active]:bg-background",children:"Open"}),s.jsx(xo,{value:"closed",className:"rounded-lg text-xs data-[state=active]:bg-background",children:"Closed"}),L_.filter(b=>b.id!=="all").map(b=>s.jsx(xo,{value:b.id,className:"rounded-lg text-xs data-[state=active]:bg-background",children:b.label},b.id))]})})]}),s.jsx("div",{className:"-mx-1 flex gap-4 overflow-x-auto px-1 pb-2 lg:grid lg:grid-cols-3 lg:overflow-visible",children:(o==="open"?[{id:"open-queue",title:"Open ticket queue",subtitle:`${m} waiting`,icon:ll,href:"/tickets",status:"done",meta:"View live tickets"}]:o==="closed"?[{id:"closed-archive",title:"Closed tickets",subtitle:`${p} resolved`,icon:ed,href:"/transcripts",status:"done",meta:"Browse archive"}]:d.map(b=>{const g=Th(b.id,e.modules,b.description);return{id:b.id,title:b.title,subtitle:g.subtitle,icon:b.icon,href:b.href,status:g.status,meta:g.status==="done"?"View settings":"Configure"}})).map(b=>s.jsx(q$,{title:b.title,subtitle:b.subtitle,icon:b.icon,href:b.href,status:b.status,meta:b.meta},b.id))})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"Active modules"}),s.jsx(Ft,{to:"/configs",className:"text-sm font-medium text-primary hover:underline",children:"See all"})]}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Ts.slice(0,4).map(b=>{const g=Th(b.id,e.modules);return s.jsx(F$,{title:b.title,icon:b.icon,href:b.href,badge:tN[g.status],status:g.status},b.id)})})]})]}),s.jsx(K$,{stats:e})]})}function Q$(){const{permissions:e}=Ut();return qn(e,"overview")?s.jsx(Z$,{}):s.jsx(Qr,{to:Wh(e),replace:!0})}function Kr({permission:e,children:n}){const{loading:a,isAuthenticated:o,permissions:l}=Ut();return a?s.jsx("div",{className:"flex flex-1 items-center justify-center py-16 text-sm text-muted-foreground",children:"Loading…"}):o?qn(l,e)?s.jsx(s.Fragment,{children:n}):s.jsx(Qr,{to:Wh(l),replace:!0}):s.jsx(Qr,{to:"/login",replace:!0})}function J$(){const{hasPermission:e}=Ut(),n=e("settings.update"),a=Ro(),[o,l]=f.useState([]),[c,d]=f.useState(""),[m,p]=f.useState(!0),[h,b]=f.useState(""),[g,y]=f.useState(""),[w,j]=f.useState(null),S=f.useCallback(async()=>{p(!0),b("");try{const N=await Ee.getAddonsCatalog();N.data&&(l(N.data.addons),d(N.data.repository))}catch(N){b(N instanceof Error?N.message:"Failed to load addons")}finally{p(!1)}},[]);f.useEffect(()=>{S()},[S]);async function E(N){if(n){j(N.id),y(""),b("");try{const k=await Ee.installAddon(N.id);y(k.message||`${N.name} installed.`),await S();const T=N.configFiles[0];T&&a(`/configs?file=${el(T)}`)}catch(k){b(k instanceof Error?k.message:"Install failed")}finally{j(null)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Addons"}),s.jsxs("p",{className:"text-muted-foreground",children:["Requires an API key from"," ",s.jsx("a",{href:"https://emeraldsrv.dev",target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:"emeraldsrv.dev"})," ","to browse and install addons. Configs will appear in the sidebar once installed."]})]}),s.jsxs(he,{variant:"outline",size:"sm",onClick:S,disabled:m,children:[s.jsx(ge,{icon:r2,size:16,className:fe("mr-1.5",m&&"animate-spin")}),"Refresh"]})]}),h?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:h})}):null,g?s.jsx(We,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(Ye,{children:g})}):null,s.jsxs("section",{className:"space-y-4",children:[s.jsx("h2",{className:"text-sm font-semibold uppercase tracking-widest text-muted-foreground",children:"Marketplace"}),m?s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[s.jsx(Be,{className:"h-40 rounded-xl"}),s.jsx(Be,{className:"h-40 rounded-xl"}),s.jsx(Be,{className:"h-40 rounded-xl"})]}):s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:o.map(N=>s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"pb-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs(lt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(ge,{icon:Gh,size:20,className:"text-primary"}),N.name]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(An,{variant:"outline",className:"shrink-0 uppercase tracking-widest text-[10px]",children:N.price===0||!N.price?"Free":`$${N.price}`}),N.installed?s.jsxs(An,{variant:"secondary",className:"shrink-0 gap-1",children:[s.jsx(ge,{icon:j8,size:14}),"Installed"]}):null]})]}),s.jsx(Et,{children:N.description})]}),s.jsxs(Ze,{className:"space-y-2 text-xs text-muted-foreground",children:[N.is_external?s.jsxs("p",{children:["Available on: ",s.jsx("span",{className:"font-medium text-foreground",children:N.external_store||"External Store"})]}):null,N.configFiles&&N.configFiles.length>0?s.jsxs("p",{children:["Config:"," ",N.configFiles.map((k,T)=>s.jsxs("span",{children:[T>0?", ":null,s.jsx(Ft,{to:`/configs?file=${el(k)}`,className:"font-mono text-primary hover:underline",children:k})]},k))]}):null]}),s.jsxs(Gg,{className:"flex flex-wrap gap-2",children:[N.is_external?s.jsx(he,{variant:"outline",size:"sm",asChild:!0,children:s.jsx("a",{href:N.repositoryUrl,target:"_blank",rel:"noreferrer",children:"View Store"})}):null,N.installed&&N.configFiles&&N.configFiles[0]?s.jsx(he,{size:"sm",variant:"secondary",asChild:!0,children:s.jsx(Ft,{to:`/configs?file=${el(N.configFiles[0])}`,children:"Edit config"})}):null,N.installed?s.jsx(he,{size:"sm",disabled:!0,variant:"secondary",children:"Installed"}):N.is_external?null:s.jsxs(he,{size:"sm",disabled:!n||w===N.id,onClick:()=>E(N),children:[s.jsx(ge,{icon:td,size:14,className:"mr-1"}),w===N.id?"Installing…":"Install"]})]})]},N.id))})]})]})}function eB(){const{permissions:e}=Ut(),[n,a]=f.useState(!1),[o,l]=f.useState(!1),[c,d]=f.useState(""),[m,p]=f.useState(""),[h,b]=f.useState(""),[g,y]=f.useState("Administrator"),[w,j]=f.useState(""),[S,E]=f.useState(""),[N,k]=f.useState("General"),T=i2(e,"supportbot"),A=async()=>{if(!m.match(/^[a-z0-9_-]+$/i)){Bt.error("Command name can only contain letters, numbers, underscores and dashes.");return}a(!0),l(!1);try{const O=await Ee.buildAddon({name:m.toLowerCase(),description:h||"A custom command",permission:g,embed:{title:w,description:S||"Hello from your custom command!",color:N}});l(!0),d(O.message||"Restart required."),Bt.success(`Addon ${m}.js created successfully!`)}catch(O){Bt.error(O instanceof Error?O.message:"Failed to build addon")}finally{a(!1)}};return T?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Addon Builder"}),s.jsx("p",{className:"text-muted-foreground",children:"Visually scaffold a custom slash command addon for your bot."})]}),o?s.jsxs(We,{className:"border-green-500/20 bg-green-500/10 text-green-600 dark:text-green-400",children:[s.jsx(Vy,{className:"h-4 w-4"}),s.jsxs(Ye,{className:"ml-2",children:["Successfully built ",s.jsxs("strong",{children:[m,".js"]}),"! ",c]})]}):null,s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Xe,{children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Command Details"}),s.jsx(Et,{children:"Configure how users trigger the command."})]}),s.jsxs(Ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Command Name"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"/"}),s.jsx(Ie,{placeholder:"ping",value:m,onChange:O=>p(O.target.value.replace(/[^a-z0-9_-]/gi,"").toLowerCase())})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Description"}),s.jsx(Ie,{placeholder:"Replies with a custom embed",value:h,onChange:O=>b(O.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Required Permission"}),s.jsxs(No,{value:g,onValueChange:y,children:[s.jsx(Ba,{children:s.jsx(Eo,{})}),s.jsxs(Ua,{children:[s.jsx(an,{value:"none",children:"@everyone"}),s.jsx(an,{value:"Administrator",children:"Administrator"}),s.jsx(an,{value:"ManageMessages",children:"Manage Messages"}),s.jsx(an,{value:"ManageGuild",children:"Manage Server"})]})]})]})]})]}),s.jsxs(Xe,{children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Response Embed"}),s.jsx(Et,{children:"What the bot will reply with."})]}),s.jsxs(Ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Embed Title (Optional)"}),s.jsx(Ie,{placeholder:"Hello!",value:w,onChange:O=>j(O.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Embed Description"}),s.jsx(Ld,{placeholder:"Type your message here...",className:"resize-none",rows:4,value:S,onChange:O=>E(O.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Embed Color"}),s.jsxs(No,{value:N,onValueChange:k,children:[s.jsx(Ba,{children:s.jsx(Eo,{})}),s.jsxs(Ua,{children:[s.jsx(an,{value:"General",children:"Theme General"}),s.jsx(an,{value:"Success",children:"Theme Success"}),s.jsx(an,{value:"Warning",children:"Theme Warning"}),s.jsx(an,{value:"Error",children:"Theme Error"})]})]})]})]})]})]}),s.jsx("div",{className:"space-y-6",children:s.jsxs(Xe,{className:"sticky top-6 border-primary/20",children:[s.jsx(it,{children:s.jsxs(lt,{className:"text-sm font-medium flex items-center gap-2",children:[s.jsx(ge,{icon:C8,size:16,className:"text-primary"}),"Live Preview"]})}),s.jsx(Ze,{children:s.jsx("div",{className:"rounded-md border bg-[#313338] p-4 font-sans text-sm text-[#dbdee1]",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"size-10 shrink-0 rounded-full bg-indigo-500 flex items-center justify-center font-bold text-white",children:"B"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-white",children:"SupportBot"}),s.jsxs("span",{className:"text-[10px] text-white font-medium uppercase px-1.5 py-0.5 rounded bg-[#5865F2] flex items-center gap-1",children:[s.jsx(Vy,{size:10})," BOT"]}),s.jsx("span",{className:"text-xs text-[#949ba4]",children:"Today at 12:00 PM"})]}),s.jsxs("div",{className:"mt-2 rounded bg-[#2b2d31] border-l-4 border-l-[#5865F2] px-4 py-3 max-w-[432px]",children:[w&&s.jsx("div",{className:"mb-1 font-semibold text-white",children:w}),s.jsx("div",{className:"whitespace-pre-wrap",children:S||"Hello from your custom command!"})]})]})]})})}),s.jsx(Gg,{children:s.jsxs(he,{className:"w-full gap-2",size:"lg",disabled:!m||n,onClick:A,children:[s.jsx(ge,{icon:Da,size:18}),n?"Building...":"Generate Addon"]})})]})})]})]}):s.jsx("div",{className:"flex h-[50vh] items-center justify-center text-muted-foreground",children:"You don't have permission to build addons."})}const Wg="supportbot-dashboard-accent",ol="#45b46c",tB=["--primary","--ring","--chart-1","--sidebar-primary","--sidebar-ring","--accent","--accent-foreground","--sidebar-accent","--sidebar-accent-foreground"];function nB(e){const n=jr(e,ol),a=parseInt(n.slice(1,3),16)/255,o=parseInt(n.slice(3,5),16)/255,l=parseInt(n.slice(5,7),16)/255,c=Math.max(a,o,l),d=Math.min(a,o,l),m=(c+d)/2;let p=0,h=0;if(c!==d){const b=c-d;switch(h=m>.5?b/(2-c-d):b/(c+d),c){case a:p=((o-l)/b+(o{const o=new FileReader;o.onload=()=>n(String(o.result)),o.onerror=()=>a(new Error("Could not read file")),o.readAsDataURL(e)})}function iB({canEdit:e}){const[n,a]=f.useState(!1),[o,l]=f.useState(""),[c,d]=f.useState(!1);async function m(){if(e){a(!0),l("");try{const p=await Ee.resetDashboard();l(p.message||"Dashboard reset successfully."),setTimeout(()=>{window.location.href="/setup"},1500)}catch(p){l(p instanceof Error?p.message:"Reset failed"),a(!1)}}}return e?s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Reset the dashboard to factory settings. This clears the configuration and returns you to the initial setup screen."}),s.jsxs(zl,{open:c,onOpenChange:d,children:[s.jsx(x_,{asChild:!0,children:s.jsx(he,{type:"button",variant:"destructive",children:"Reset Dashboard"})}),s.jsxs(qs,{children:[s.jsxs(Ks,{children:[s.jsx(Xs,{children:"Are you absolutely sure?"}),s.jsx(Zs,{children:"This action cannot be undone. This will reset the dashboard to setup mode. You will need to reconnect the Discord OAuth and reconfigure the dashboard owners."})]}),o&&s.jsx("p",{className:"text-sm font-medium text-destructive",children:o}),s.jsxs(Pl,{children:[s.jsx(he,{variant:"outline",onClick:()=>d(!1),disabled:n,children:"Cancel"}),s.jsx(he,{variant:"destructive",onClick:()=>void m(),disabled:n,children:n?"Resetting...":"Yes, reset dashboard"})]})]})]})]}):null}function lB({canEdit:e}){const{branding:n,setBrandingLocal:a}=od(),o=f.useRef(null),[l,c]=f.useState(n.title),[d,m]=f.useState(n.pageTitle),[p,h]=f.useState(!1),[b,g]=f.useState(!1),[y,w]=f.useState("");f.useEffect(()=>{c(n.title),m(n.pageTitle)},[n.title,n.pageTitle]);const j=n.hasFavicon&&n.faviconUrl?`${n.faviconUrl}${n.updatedAt?`?v=${n.updatedAt}`:""}`:null;async function S(){if(e){h(!0),w("");try{const T=await Ee.updateBranding({title:l,pageTitle:d});T.data&&a(T.data),w(T.message||"Branding saved.")}catch(T){w(T instanceof Error?T.message:"Save failed")}finally{h(!1)}}}async function E(T){if(!(!e||!T)){g(!0),w("");try{const A=await sB(T),O=await Ee.uploadBrandingFavicon(A);O.data&&a(O.data),w(O.message||"Favicon uploaded.")}catch(A){w(A instanceof Error?A.message:"Upload failed")}finally{g(!1),o.current&&(o.current.value="")}}}async function N(){if(e){g(!0),w("");try{const T=await Ee.removeBrandingFavicon();T.data&&a(T.data),w(T.message||"Favicon removed.")}catch(T){w(T instanceof Error?T.message:"Remove failed")}finally{g(!1)}}}const k=l.trim()!==n.title||d.trim()!==n.pageTitle;return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Branding Text"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Sidebar title and browser tab title — saved on the server for everyone using this dashboard."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"brand-title",children:"Sidebar title"}),s.jsx(Ie,{id:"brand-title",value:l,disabled:!e,maxLength:64,onChange:T=>c(T.target.value),className:"border-border bg-secondary/30",placeholder:"SupportBot"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"brand-page-title",children:"Browser tab title"}),s.jsx(Ie,{id:"brand-page-title",value:d,disabled:!e,maxLength:80,onChange:T=>m(T.target.value),className:"border-border bg-secondary/30",placeholder:"SupportBot Dashboard"})]})]}),e?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(he,{type:"button",disabled:p||!k,onClick:()=>void S(),children:p?"Saving…":"Save titles"}),y&&k?s.jsx("span",{className:"text-xs text-muted-foreground",children:y}):null]}):null]}),s.jsxs("div",{className:"space-y-4 border-t border-border pt-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Favicon"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, ICO, SVG, JPEG, or WebP — max 512 KB. Shown in the browser tab and beside the sidebar title."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsx("div",{className:"flex size-16 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary/30",children:j?s.jsx("img",{src:j,alt:"Favicon preview",className:"size-full object-contain p-2"}):s.jsx(ge,{icon:d8,size:24,className:"text-muted-foreground/50"})}),s.jsx("input",{ref:o,type:"file",accept:"image/png,image/jpeg,image/x-icon,image/vnd.microsoft.icon,image/svg+xml,image/webp,.ico",className:"hidden",disabled:!e||b,onChange:T=>{var A;return void E(((A=T.target.files)==null?void 0:A[0])??null)}}),s.jsxs("div",{className:"flex flex-col gap-2",children:[e?s.jsxs("div",{className:"flex gap-2",children:[s.jsx(he,{type:"button",variant:"secondary",disabled:b,onClick:()=>{var T;return(T=o.current)==null?void 0:T.click()},children:b?"Uploading…":"Upload Favicon"}),n.hasFavicon?s.jsx(he,{type:"button",variant:"destructive",disabled:b,onClick:()=>void N(),children:"Remove"}):null]}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}),!k&&y?s.jsx("span",{className:"text-xs text-muted-foreground",children:y}):null]})]})]})]})}function cB(){var g,y,w,j,S,E,N,k,T,A,O;const{hasPermission:e}=Ut(),n=e("settings.update"),[a,o]=f.useState(!0),[l,c]=f.useState(!1),[d,m]=f.useState(""),[p,h]=f.useState(null);f.useEffect(()=>{Ee.getConfigJson("api").then(M=>{M.data&&h(M.data)}).catch(()=>m("Failed to load API config")).finally(()=>o(!1))},[]);async function b(){var M,z,B,K,U,q,ue,pe,xe,se,L;if(!(!n||!p)){c(!0),m("");try{const I={"api:API.Port":(M=p.API)==null?void 0:M.Port,"api:API.EmeraldAPIKey":(z=p.API)==null?void 0:z.EmeraldAPIKey,"api:API.TrustProxy":(B=p.API)==null?void 0:B.TrustProxy,"api:API.OAuth.Enabled":(U=(K=p.API)==null?void 0:K.OAuth)==null?void 0:U.Enabled,"api:API.OAuth.ClientId":(ue=(q=p.API)==null?void 0:q.OAuth)==null?void 0:ue.ClientId,"api:API.OAuth.ClientSecret":(xe=(pe=p.API)==null?void 0:pe.OAuth)==null?void 0:xe.ClientSecret,"api:API.OAuth.RedirectUri":(L=(se=p.API)==null?void 0:se.OAuth)==null?void 0:L.RedirectUri};await Ee.updateConfigFields(I),m("API settings saved and backend restarted.")}catch(I){m(I instanceof Error?I.message:"Save failed")}finally{c(!1)}}}return a?s.jsx("div",{className:"animate-pulse h-32 bg-secondary/20 rounded-md"}):p?s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Core API Settings"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the internal API that powers this dashboard."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"API Port"}),s.jsx(Ie,{type:"number",value:((g=p.API)==null?void 0:g.Port)||"",disabled:!n,onChange:M=>h({...p,API:{...p.API,Port:parseInt(M.target.value)||3e3}}),className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Emerald API Key"}),s.jsx(Ie,{type:"password",value:((y=p.API)==null?void 0:y.EmeraldAPIKey)||"",disabled:!n,onChange:M=>h({...p,API:{...p.API,EmeraldAPIKey:M.target.value}}),className:"border-border bg-secondary/30"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(At,{checked:((w=p.API)==null?void 0:w.TrustProxy)||!1,disabled:!n,onCheckedChange:M=>h({...p,API:{...p.API,TrustProxy:M}})}),s.jsx(ze,{className:"text-sm",children:"Trust Proxy (Enable if using Cloudflare/Nginx)"})]})]}),s.jsxs("div",{className:"space-y-4 border-t border-border pt-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"OAuth Authentication"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Discord application credentials for dashboard login."})]}),s.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[s.jsx(At,{checked:((S=(j=p.API)==null?void 0:j.OAuth)==null?void 0:S.Enabled)||!1,disabled:!n,onCheckedChange:M=>{var z;return h({...p,API:{...p.API,OAuth:{...(z=p.API)==null?void 0:z.OAuth,Enabled:M}}})}}),s.jsx(ze,{className:"text-sm",children:"Enable OAuth"})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Client ID"}),s.jsx(Ie,{value:((N=(E=p.API)==null?void 0:E.OAuth)==null?void 0:N.ClientId)||"",disabled:!n,onChange:M=>{var z;return h({...p,API:{...p.API,OAuth:{...(z=p.API)==null?void 0:z.OAuth,ClientId:M.target.value}}})},className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Client Secret"}),s.jsx(Ie,{type:"password",value:((T=(k=p.API)==null?void 0:k.OAuth)==null?void 0:T.ClientSecret)||"",disabled:!n,onChange:M=>{var z;return h({...p,API:{...p.API,OAuth:{...(z=p.API)==null?void 0:z.OAuth,ClientSecret:M.target.value}}})},className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(ze,{children:"Redirect URI"}),s.jsx(Ie,{value:((O=(A=p.API)==null?void 0:A.OAuth)==null?void 0:O.RedirectUri)||"",disabled:!n,onChange:M=>{var z;return h({...p,API:{...p.API,OAuth:{...(z=p.API)==null?void 0:z.OAuth,RedirectUri:M.target.value}}})},className:"border-border bg-secondary/30"}),s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Must match the OAuth2 callback URL registered in the Discord Developer Portal exactly."})]})]})]}),n?s.jsxs("div",{className:"flex items-center gap-2 border-t border-border pt-6",children:[s.jsx(he,{type:"button",disabled:l,onClick:()=>void b(),children:l?"Saving…":"Save API Config"}),d?s.jsx("span",{className:"text-xs text-muted-foreground",children:d}):null]}):null]}):null}function uB(){const{hasPermission:e}=Ut(),n=e("settings.update"),[a,o]=f.useState(null),[l,c]=f.useState(!0),[d,m]=f.useState(!1),[p,h]=f.useState(""),[b,g]=f.useState(""),[y,w]=f.useState(()=>rN()??ol),[j,S]=f.useState(""),[E,N]=f.useState("appearance"),k=f.useCallback(async()=>{c(!0),h("");try{const A=await Ee.checkForUpdates();A.data&&o(A.data)}catch(A){h(A instanceof Error?A.message:"Could not check for updates")}finally{c(!1)}},[]);f.useEffect(()=>{k()},[k]);async function T(A){if(A.updateAvailable){m(!0),h(""),g("");try{const O=await Ee.runUpdate(A.id,A.latest,A.zipUrl);g(O.message||"Update installed. Restart your server (stop and run npm start again) to finish applying changes."),await k()}catch(O){h(O instanceof Error?O.message:"Update failed")}finally{m(!1)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Settings"}),s.jsx("p",{className:"text-muted-foreground",children:"Application updates and maintenance — config files are edited under each module in the sidebar."})]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-8 items-start",children:[s.jsx("aside",{className:"w-full md:w-56 shrink-0 sticky top-6",children:s.jsxs("nav",{className:"flex flex-row md:flex-col overflow-x-auto space-x-2 md:space-x-0 md:space-y-1 pb-2 md:pb-0",children:[s.jsx(he,{variant:E==="appearance"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>N("appearance"),children:"Appearance"}),s.jsx(he,{variant:E==="api"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>N("api"),children:"API Config"}),s.jsx(he,{variant:E==="updates"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>N("updates"),children:"Update Checker"}),n&&s.jsx(he,{variant:"ghost",className:`justify-start w-full text-destructive hover:bg-destructive/10 hover:text-destructive ${E==="danger"?"bg-destructive/10 border-l-2 border-destructive rounded-l-none":""}`,onClick:()=>N("danger"),children:"Danger Zone"})]})}),s.jsxs("main",{className:"flex-1 w-full max-w-4xl space-y-6",children:[E==="appearance"&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Dashboard appearance"}),s.jsx(Et,{children:"Customise branding for all users, and pick an accent colour for this browser only."})]}),s.jsxs(Ze,{className:"space-y-4",children:[s.jsx(lB,{canEdit:n}),s.jsxs("div",{className:"border-t border-border pt-4",children:[s.jsx("p",{className:"mb-1 text-sm font-medium",children:"Accent colour"}),s.jsx("p",{className:"mb-4 text-xs text-muted-foreground",children:"Buttons, links, and highlights — saved in this browser only."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Id,{value:y,onChange:A=>{w(A),k0(A),S("Accent updated.")}}),s.jsx(Ie,{id:"accent-colour",value:y,onChange:A=>w(A.target.value),onBlur:()=>{const A=jr(y,ol);w(A),k0(A),S("Accent updated.")},className:"w-32 border-border bg-secondary/30 font-mono uppercase",maxLength:7})]}),s.jsx(he,{type:"button",variant:"outline",onClick:()=>{aB(),w(ol),S("Reset to default purple.")},children:"Reset to default"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 text-sm mt-5",children:[s.jsx("span",{className:"rounded-md bg-primary px-3 py-1.5 font-medium text-primary-foreground",children:"Primary button"}),s.jsx("span",{className:"rounded-md bg-primary/15 px-3 py-1.5 text-primary",children:"Highlight"}),s.jsx("span",{className:"rounded-md bg-accent px-3 py-1.5 text-accent-foreground",children:"Accent surface"})]}),j?s.jsx("p",{className:"text-xs text-muted-foreground",children:j}):null]})]})]})}),E==="danger"&&n&&s.jsxs(Xe,{className:"border-destructive/50 bg-destructive/5",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg text-destructive",children:"Danger Zone"}),s.jsx(Et,{className:"text-destructive/80",children:"Destructive actions that reset or permanently alter your dashboard."})]}),s.jsx(Ze,{children:s.jsx(iB,{canEdit:n})})]}),E==="api"&&s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"API Configuration"}),s.jsx(Et,{children:"Configure the internal API settings, Emerald API key, and OAuth."})]}),s.jsx(Ze,{children:s.jsx(cB,{})})]}),E==="updates"&&s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Software updates"}),s.jsx(Et,{children:"Manage updates for the bot and dashboard."})]}),s.jsxs(Ze,{className:"space-y-4",children:[l?s.jsx(Be,{className:"h-24 w-full"}):a&&a.length>0?s.jsx("div",{className:"space-y-4",children:a.map(A=>s.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-secondary/20 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"font-medium text-sm",children:[s.jsx("a",{href:A.repository,target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:A.name})," ","(",A.branch," branch)"]}),s.jsxs("div",{className:"flex gap-x-4 text-sm",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Installed: "}),s.jsxs("span",{className:"font-mono font-medium",children:["v",A.current]})]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Latest: "}),s.jsxs("span",{className:"font-mono font-medium",children:["v",A.latest]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[A.updateAvailable?s.jsx("p",{className:"text-sm text-amber-500",children:"A newer version is available. Update downloads files while keeping your Configs and Data."}):s.jsx("p",{className:"text-sm text-emerald-500",children:"You are on the latest release."}),A.updateAvailable&&n?s.jsxs(he,{type:"button",size:"sm",onClick:()=>void T(A),disabled:d,children:[d?s.jsx(ge,{icon:r2,size:16,className:"mr-2 animate-spin"}):s.jsx(ge,{icon:td,size:16,className:"mr-2"}),d?"Installing…":"Update now"]}):null,A.updateAvailable&&!n?s.jsx("p",{className:"text-xs text-muted-foreground",children:"You cannot install updates with your role."}):null]})]},A.id))}):null,p?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:p})}):null,b?s.jsx(We,{children:s.jsx(Ye,{children:b})}):null,s.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:s.jsxs(he,{type:"button",variant:"outline",onClick:k,disabled:l||d,children:[s.jsx(ge,{icon:or,size:16,className:"mr-2"}),"Check again"]})})]})]})]})]})]})}function Yg(e){const[n,a]=f.useState(!1),o=f.useRef(e);return o.current=e,f.useEffect(()=>{let l=null,c=null;const d=()=>{l=new EventSource("/api/stream"),l.onopen=()=>{a(!0)},l.addEventListener("connected",()=>{a(!0)}),l.addEventListener("metrics",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onMetrics)==null||h.call(p,b)}catch{}}),l.addEventListener("log",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onLog)==null||h.call(p,b)}catch{}}),l.addEventListener("ticket_message",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onTicketMessage)==null||h.call(p,b)}catch{}}),l.addEventListener("ticket_message_deleted",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onTicketMessageDeleted)==null||h.call(p,b)}catch{}}),l.addEventListener("ticket_message_updated",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onTicketMessageUpdated)==null||h.call(p,b)}catch{}}),l.addEventListener("ticket_created",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onTicketCreated)==null||h.call(p,b)}catch{}}),l.addEventListener("ticket_closed",m=>{var p,h;try{const b=JSON.parse(m.data);(h=(p=o.current).onTicketClosed)==null||h.call(p,b)}catch{}}),l.onerror=()=>{a(!1),l==null||l.close(),c=window.setTimeout(d,4e3)}};return d(),()=>{c&&window.clearTimeout(c),l&&l.close()}},[]),{connected:n}}function Ct({label:e,value:n,mono:a=!1}){return s.jsxs("div",{className:"flex flex-col gap-1 border-b border-border py-3 last:border-0 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("dt",{className:"text-sm text-muted-foreground",children:e}),s.jsx("dd",{className:`text-sm font-medium text-foreground ${a?"font-mono text-xs sm:text-sm":""}`,children:n})]})}const dB={ok:"Healthy",missing_config:"Guild ID not set",not_in_guild:"Not in configured server",extra_guilds:"Extra servers joined",offline:"Bot offline"};function fB(e){return e==="ok"?"text-emerald-500":e==="offline"?"text-destructive":"text-amber-500"}function mB(){var E;const{stats:e,loading:n,error:a,refresh:o}=sd(),[l,c]=f.useState(null),[d,m]=f.useState(null),[p,h]=f.useState(!1),[b,g]=f.useState(null),{connected:y}=Yg({onMetrics:N=>{g(N)}}),w=f.useCallback(async()=>{const[N,k]=await Promise.all([Ee.getGuildStatus().catch(()=>null),Ee.health().catch(()=>null)]);N!=null&&N.data&&c(N.data),k!=null&&k.success&&k.data&&m({dashboard:k.data.dashboard,botReady:k.data.botReady,oauthEnabled:k.data.oauthEnabled,setupComplete:k.data.setupComplete})},[]);f.useEffect(()=>{w()},[w]);async function j(){h(!0);try{await Promise.all([o(),w()])}finally{h(!1)}}if(n&&!e)return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Be,{className:"h-10 w-64"}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-56 rounded-2xl"}),s.jsx(Be,{className:"h-56 rounded-2xl"})]})]});if(a||!e)return s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:a||"Could not load system details."})});const S=e.bot.ping<200;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(he,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-2 h-8 px-2 text-muted-foreground",children:s.jsxs(Ft,{to:"/",children:[s.jsx(ge,{icon:J0,size:16,className:"mr-1.5"}),"Back to dashboard"]})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"System details"}),s.jsx("p",{className:"text-muted-foreground",children:"Live bot, host, and dashboard status — refreshed every 30 seconds."})]})]}),s.jsxs(he,{type:"button",variant:"outline",disabled:p,onClick:()=>void j(),children:[s.jsx(ge,{icon:or,size:16,className:"mr-2"}),p?"Refreshing…":"Refresh now"]})]}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Discord bot"}),s.jsx(Et,{children:"Connection and identity"})]}),s.jsxs(Ze,{children:[s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsxs(Ia,{className:"size-12",children:[s.jsx(Co,{src:e.bot.avatar,alt:e.bot.username}),s.jsx($a,{children:"SB"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:e.bot.username}),s.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:e.bot.id})]})]}),s.jsxs("dl",{children:[s.jsx(Ct,{label:"Version",value:`v${e.bot.version}`,mono:!0}),s.jsx(Ct,{label:"Gateway latency",value:s.jsxs("span",{className:S?"text-emerald-500":"text-amber-500",children:[e.bot.ping," ms"]})}),s.jsx(Ct,{label:"Process uptime",value:Fh(e.bot.uptime)}),s.jsx(Ct,{label:"Connected servers",value:e.servers.toLocaleString()}),s.jsx(Ct,{label:"Members tracked",value:e.users.toLocaleString()}),e.bot.inviteUrl?s.jsx(Ct,{label:"Invite link",value:s.jsx("a",{href:e.bot.inviteUrl,target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:"Open in Discord"})}):null]})]})]}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(lt,{className:"text-lg",children:"Host machine"}),s.jsx(Et,{children:"Server resources running this instance"})]}),s.jsxs(An,{variant:y?"default":"outline",className:"text-xs",children:[s.jsx("span",{className:`mr-1.5 inline-block h-2 w-2 rounded-full ${y?"bg-emerald-500 animate-pulse":"bg-muted"}`}),y?"Live Stream":"Polling"]})]}),s.jsx(Ze,{children:s.jsxs("dl",{children:[s.jsx(Ct,{label:"Memory used",value:b?`${(b.ram_used_mb/1024).toFixed(2)} GB / ${(b.ram_total_mb/1024).toFixed(2)} GB`:`${e.hosting.ram_used} / ${e.hosting.ram_total}`}),s.jsx(Ct,{label:"Memory usage",value:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:(b?b.ram_percent:e.hosting.ram_percent)>85?"text-amber-500 font-bold":"text-foreground font-medium",children:[b?b.ram_percent:e.hosting.ram_percent,"%"]}),s.jsx("div",{className:"w-24 h-2 bg-secondary rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${b?b.ram_percent:e.hosting.ram_percent}%`}})})]})}),s.jsx(Ct,{label:"CPU load (1 min avg)",value:b?String(b.cpu_load):e.hosting.cpu_load,mono:!0}),s.jsx(Ct,{label:"Host uptime",value:e.hosting.uptime})]})})]}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Tickets"}),s.jsx(Et,{children:"Database snapshot"})]}),s.jsx(Ze,{children:s.jsxs("dl",{children:[s.jsx(Ct,{label:"Total tickets",value:e.tickets.total}),s.jsx(Ct,{label:"Open",value:s.jsx("span",{className:"text-primary",children:e.tickets.open})}),s.jsx(Ct,{label:"Closed",value:e.tickets.closed}),s.jsx(Ct,{label:"Transcripts",value:s.jsx(Ft,{to:"/transcripts",className:"text-primary underline-offset-4 hover:underline",children:"Browse archive"})})]})})]}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Guild health"}),s.jsx(Et,{children:"Configured server and membership"})]}),s.jsx(Ze,{children:l?s.jsxs("dl",{children:[s.jsx(Ct,{label:"Status",value:s.jsx("span",{className:fB(l.status),children:dB[l.status]})}),s.jsx(Ct,{label:"Configured guild ID",value:l.configuredGuildId||"Not set",mono:!0}),l.configuredGuild?s.jsx(Ct,{label:"Configured server",value:`${l.configuredGuild.name} (${((E=l.configuredGuild.memberCount)==null?void 0:E.toLocaleString())??"?"} members)`}):null,l.message?s.jsx("div",{className:"mt-3 rounded-lg border border-border bg-secondary/30 px-3 py-2 text-sm text-muted-foreground",children:l.message}):null,l.extraGuilds.length>0?s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Extra servers"}),s.jsx("ul",{className:"space-y-1 text-sm",children:l.extraGuilds.map(N=>s.jsxs("li",{className:"font-mono text-xs",children:[N.name," · ",N.id]},N.id))})]}):null]}):s.jsx(Be,{className:"h-24 w-full"})})]})]}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Dashboard services"}),s.jsx(Et,{children:"API and authentication"})]}),s.jsx(Ze,{children:d?s.jsxs("dl",{className:"max-w-xl",children:[s.jsx(Ct,{label:"Dashboard UI",value:d.dashboard?"Available":"Missing build"}),s.jsx(Ct,{label:"Bot connection",value:d.botReady?"Online":"Starting or offline"}),s.jsx(Ct,{label:"Discord OAuth",value:d.oauthEnabled?"Configured":"Not configured"}),s.jsx(Ct,{label:"Initial setup",value:d.setupComplete?"Complete":"Incomplete"}),s.jsx(Ct,{label:"Software updates",value:s.jsx(Ft,{to:"/settings",className:"text-primary underline-offset-4 hover:underline",children:"Open settings"})}),s.jsx(Ct,{label:"Logs",value:s.jsx(Ft,{to:"/logs",className:"text-primary underline-offset-4 hover:underline",children:"View log files"})})]}):s.jsx(Be,{className:"h-32 w-full max-w-xl"})})]}),e.modules?s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-lg",children:"Module setup status"}),s.jsx(Et,{children:"Which features are configured and active"})]}),s.jsx(Ze,{children:s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Ts.map(N=>{const k=Th(N.id,e.modules);return s.jsxs(Ft,{to:N.href,className:"flex items-start justify-between gap-3 rounded-xl border border-border bg-secondary/20 px-4 py-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium",children:N.title}),s.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:k.subtitle})]}),s.jsx("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:tN[k.status]})]},N.id)})})})]}):null]})}function pB(e){if(!e)return"—";const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}const hB=[{id:"all",label:"All"},{id:"Output",label:"Output"},{id:"Warn",label:"Warn"},{id:"Error",label:"Error"}],gB=["Output","Warn","Error"],xB={Output:"text-foreground/90",Warn:"text-amber-400",Error:"text-rose-400"},vB={Output:"bg-muted text-muted-foreground",Warn:"bg-amber-500/15 text-amber-400",Error:"bg-rose-500/15 text-rose-400"},qu=2e3,bB=2e3;function Rh(e,n){return`${e.type}-${e.timestamp??"na"}-${n}-${e.message.slice(0,32)}`}function yB(e,n,a){const o=a?[]:e,l=new Set(o.map((m,p)=>Rh(m,p))),c=[];for(let m=0;mqu?d.slice(d.length-qu):d}function wB(){const[e,n]=f.useState([]),[a,o]=f.useState(!0),[l,c]=f.useState(""),[d,m]=f.useState(!1),[p,h]=f.useState(!0),[b,g]=f.useState("all"),[y,w]=f.useState(""),[j,S]=f.useState(!0),[E,N]=f.useState(""),k=f.useRef(null),T=f.useRef(null),A=f.useRef(d);A.current=d;const O=f.useMemo(()=>b==="all"?gB:[b],[b]),M=f.useCallback(U=>{A.current||b!=="all"&&U.type!==b||(n(q=>{const ue=[...q,U];return ue.length>qu?ue.slice(ue.length-qu):ue}),S(!0))},[b]);Yg({onLog:M});const z=f.useCallback(async U=>{var pe,xe;const q=await Ee.getLogs({types:O,cursor:U?void 0:k.current??void 0,tail:U?500:0}),ue=((pe=q.data)==null?void 0:pe.entries)??[];return k.current=((xe=q.data)==null?void 0:xe.cursor)??{},n(se=>yB(se,ue,U)),ue.length},[O]),B=f.useCallback(async()=>{var U;o(!0),c(""),k.current=null;try{const pe=(((U=(await Ee.getLogsMeta()).data)==null?void 0:U.files)??[]).filter(xe=>xe.file).map(xe=>`${xe.type}: ${xe.file}`).join(" · ");N(pe||"No log files yet — output appears when the bot runs."),await z(!0),S(!0)}catch(q){c(q instanceof Error?q.message:"Failed to load logs"),S(!1)}finally{o(!1)}},[z]);f.useEffect(()=>{B()},[B]),f.useEffect(()=>{if(d||a)return;const U=window.setInterval(async()=>{if(!A.current)try{await z(!1),S(!0),c("")}catch(q){S(!1),c(q instanceof Error?q.message:"Live update failed")}},bB);return()=>window.clearInterval(U)},[d,a,z]),f.useEffect(()=>{if(!p||d)return;const U=T.current;U&&(U.scrollTop=U.scrollHeight)},[e,p,d]);const K=f.useMemo(()=>e.filter(U=>{var ue;if(b!=="all"&&U.type!==b)return!1;if(!y.trim())return!0;const q=y.toLowerCase();return U.message.toLowerCase().includes(q)||(((ue=U.timestamp)==null?void 0:ue.toLowerCase().includes(q))??!1)}),[e,b,y]);return s.jsxs("div",{className:"flex h-[calc(100svh-8rem)] min-h-[480px] flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Logs"}),s.jsx("p",{className:"text-muted-foreground",children:"Live bot output — updates every 2 seconds"}),E?s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:E}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:fe("size-2 rounded-full",j&&!d?"animate-pulse bg-emerald-500":"bg-muted-foreground")}),s.jsx("span",{className:"text-xs text-muted-foreground",children:d?"Paused":j?"Live":"Disconnected"})]})]}),l?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:l})}):null,s.jsxs(Xe,{className:"flex min-h-0 flex-1 flex-col border-border bg-card",children:[s.jsxs(it,{className:"shrink-0 space-y-4 border-b border-border pb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs(lt,{className:"text-base font-medium",children:["Console",a?null:s.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[K.length," line",K.length===1?"":"s"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border px-2 py-1",children:[s.jsx(At,{id:"auto-scroll",checked:p,onCheckedChange:h}),s.jsx(ze,{htmlFor:"auto-scroll",className:"text-xs font-normal",children:"Auto-scroll"})]}),s.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>m(U=>!U),children:[s.jsx(ge,{icon:d?v8:x8,size:16,className:"mr-1.5"}),d?"Resume":"Pause"]}),s.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>{n([]),B()},disabled:a,children:[s.jsx(ge,{icon:or,size:16,className:"mr-1.5"}),"Refresh"]})]})]}),s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[s.jsx("div",{className:"flex flex-wrap gap-1 rounded-xl bg-secondary/50 p-1",children:hB.map(U=>s.jsx(he,{type:"button",variant:b===U.id?"secondary":"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>g(U.id),children:U.label},U.id))}),s.jsxs("div",{className:"relative flex-1 sm:max-w-xs",children:[s.jsx(ge,{icon:ad,size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(Ie,{placeholder:"Filter lines…",value:y,onChange:U=>w(U.target.value),className:"h-9 pl-9"})]})]})]}),s.jsx(Ze,{className:"min-h-0 flex-1 p-0",children:a?s.jsx("div",{className:"space-y-2 p-4",children:Array.from({length:8}).map((U,q)=>s.jsx(Be,{className:"h-4 w-full"},q))}):s.jsx("div",{ref:T,className:"h-full max-h-[calc(100svh-18rem)] overflow-y-auto bg-[#0d0d12] p-4 font-mono text-[13px] leading-relaxed",children:K.length===0?s.jsx("p",{className:"text-muted-foreground",children:"No log lines yet. Start the bot and activity will appear here (also written to the Logs folder on disk)."}):s.jsx("ul",{className:"space-y-1",children:K.map((U,q)=>s.jsxs("li",{className:"flex gap-2 rounded px-1 py-0.5 hover:bg-white/[0.03]",children:[s.jsx("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:pB(U.timestamp)}),s.jsx("span",{className:fe("shrink-0 rounded px-1.5 py-0 text-[10px] font-semibold uppercase",vB[U.type]),children:U.type}),s.jsx("span",{className:fe("min-w-0 flex-1 whitespace-pre-wrap break-words",xB[U.type]),children:U.message||" "})]},Rh(U,q)))})})})]})]})}const CB=[{title:"Colors",description:"Theme colors used across the transcript page.",fields:[{path:"Theme.Background",label:"Page background",type:"color"},{path:"Theme.Panel",label:"Panel background",type:"color"},{path:"Theme.PanelSecondary",label:"Secondary panel",type:"color"},{path:"Theme.Border",label:"Borders",type:"color"},{path:"Theme.Text",label:"Main text",type:"color"},{path:"Theme.Muted",label:"Muted text",type:"color"},{path:"Theme.Accent",label:"Accent",type:"color"},{path:"Theme.Link",label:"Links",type:"color"},{path:"Theme.AttachmentLink",label:"Attachment links",type:"color"},{path:"Theme.CodeBackground",label:"Code blocks",type:"color"}]},{title:"Typography",fields:[{path:"Typography.FontFamily",label:"Font family",type:"googleFont",description:"Google Fonts are loaded automatically in saved transcripts."}]},{title:"Header",fields:[{path:"Header.Title",label:"Title",type:"text"},{path:"Header.Subtitle",label:"Subtitle",type:"textarea",description:"Placeholders: {{ticketName}} {{ticketId}} {{messageCount}} {{reason}}. Use **text** for bold."},{path:"Header.Badge",label:"Badge label",type:"text"},{path:"Header.ShowMetaCards",label:"Show info cards",type:"boolean"}]},{title:"Info card labels",fields:[{path:"Meta.ChannelLabel",label:"Channel label",type:"text"},{path:"Meta.TicketIdLabel",label:"Ticket ID label",type:"text"},{path:"Meta.MessageCountLabel",label:"Message count label",type:"text"},{path:"Meta.CloseReasonLabel",label:"Close reason label",type:"text"},{path:"Meta.DefaultCloseReason",label:"Default close reason",type:"text"}]},{title:"Messages section",fields:[{path:"Messages.SectionTitle",label:"Section heading",type:"text"},{path:"Messages.EmptyState",label:"Empty state text",type:"text"}]},{title:"Advanced CSS",description:"Optional extra CSS appended to the transcript stylesheet.",fields:[{path:"Advanced.CustomCss",label:"Custom CSS",type:"textarea",description:"Example: .badge { font-size: 1rem; }"}]}],SB=450;function jB(e,n){return n&&e!=="viewer"}function NB(){const{user:e,hasPermission:n}=Ut(),a=!jB(e==null?void 0:e.role,n("transcripts")),[o,l]=f.useState(null),[c,d]=f.useState(null),[m,p]=f.useState(!0),[h,b]=f.useState(!1),[g,y]=f.useState(""),[w,j]=f.useState(""),[S,E]=f.useState(""),[N,k]=f.useState(!1),T=f.useRef(null),A=f.useCallback(async()=>{var K;p(!0),y(""),j("");try{const q=(await Ee.getTranscriptTemplate()).data??null;if(q){const ue={...q,Typography:{...q.Typography,FontFamily:d5((K=q.Typography)==null?void 0:K.FontFamily)}};l(ue),d(structuredClone(ue))}}catch(U){y(U instanceof Error?U.message:"Failed to load template")}finally{p(!1)}},[]);f.useEffect(()=>{A()},[A]);const O=f.useCallback(async K=>{k(!0);try{const U=await Ee.previewTranscriptTemplate(K);E(U)}catch{E("

Preview failed to load.

")}finally{k(!1)}},[]);f.useEffect(()=>{if(o)return T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{O(o)},SB),()=>{T.current&&clearTimeout(T.current)}},[o,O]);function M(K,U){l(q=>q&&xl(q,K,U))}async function z(){if(!(a||!o)){b(!0),y(""),j("");try{const K=await Ee.saveTranscriptTemplate(o);j(K.message||"Saved."),d(structuredClone(o))}catch(K){y(K instanceof Error?K.message:"Save failed")}finally{b(!1)}}}const B=o&&c&&JSON.stringify(o)!==JSON.stringify(c);return m?s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-96 rounded-xl"}),s.jsx(Be,{className:"h-96 rounded-xl"})]}):o?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize how new ticket transcripts look. Existing saved transcripts are not changed."}),s.jsxs("div",{className:"flex items-center gap-2",children:[B?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,a?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(he,{size:"sm",onClick:z,disabled:h||!B,children:[s.jsx(ge,{icon:nd,size:16,className:"mr-1.5"}),h?"Saving…":"Save appearance"]})]})]}),g?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g})}):null,w?s.jsx(We,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(Ye,{children:w})}):null,s.jsxs("div",{className:"grid min-h-0 gap-4 xl:grid-cols-[minmax(320px,420px)_1fr]",children:[s.jsx(EB,{data:o,readOnly:a,onPatch:M}),s.jsxs(Xe,{className:"flex min-h-[520px] flex-col overflow-hidden border-border bg-card",children:[s.jsxs(it,{className:"pb-2",children:[s.jsx(lt,{className:"text-base",children:"Live preview"}),s.jsxs(Et,{children:["Sample ticket with your current settings",N?" · updating…":""]})]}),s.jsx(Ze,{className:"min-h-0 flex-1 p-4 pt-0",children:s.jsx("iframe",{title:"Transcript template preview",srcDoc:S,className:fe("h-[min(640px,calc(100svh-14rem))] w-full rounded-lg border border-border bg-background",N&&"opacity-60"),sandbox:"allow-same-origin"})})]})]})]}):s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g||"Failed to load template"})})}function EB({data:e,readOnly:n,onPatch:a}){return s.jsx("div",{className:"max-h-[min(720px,calc(100svh-12rem))] space-y-4 overflow-y-auto pr-1",children:CB.map(o=>s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{className:"pb-3",children:[s.jsx(lt,{className:"text-base",children:o.title}),o.description?s.jsx(Et,{children:o.description}):null]}),s.jsx(Ze,{className:"grid gap-4 sm:grid-cols-2",children:o.fields.map(l=>s.jsx("div",{className:l.type==="textarea"?"sm:col-span-2":"",children:s.jsx(Vg,{field:l,value:To(e,l.path),readOnly:n,onChange:c=>a(l.path,c)})},l.path))})]},o.title))})}function kB(e,n){return n&&e!=="viewer"}function TB(){const{user:e,hasPermission:n}=Ut(),a=!kB(e==null?void 0:e.role,n("transcripts")),[o,l]=f.useState(null),[c,d]=f.useState(!0),[m,p]=f.useState(!1),[h,b]=f.useState(!1),[g,y]=f.useState(""),[w,j]=f.useState(""),S=f.useCallback(async()=>{var k,T,A;d(!0),y(""),j("");try{const M=(await Ee.getTranscriptSettings()).data;M&&l({autoDelete:{enabled:!!((k=M.autoDelete)!=null&&k.enabled),afterDays:((T=M.autoDelete)==null?void 0:T.afterDays)??30},publicAccess:{enabled:!!((A=M.publicAccess)!=null&&A.enabled)}})}catch(O){y(O instanceof Error?O.message:"Failed to load settings")}finally{d(!1)}},[]);f.useEffect(()=>{S()},[S]);async function E(){if(!(!o||a)){p(!0),y(""),j("");try{const k=await Ee.updateTranscriptSettings(o);k.data&&l({autoDelete:{enabled:k.data.autoDelete.enabled,afterDays:k.data.autoDelete.afterDays},publicAccess:{enabled:k.data.publicAccess.enabled}}),j(k.message??"Settings saved.")}catch(k){y(k instanceof Error?k.message:"Failed to save settings")}finally{p(!1)}}}async function N(){var k,T;if(!a){b(!0),y(""),j("");try{const A=await Ee.purgeTranscripts();j(A.message??((k=A.data)!=null&&k.skipped?"Auto-delete is disabled.":`Removed ${((T=A.data)==null?void 0:T.deleted)??0} transcript(s).`))}catch(A){y(A instanceof Error?A.message:"Purge failed")}finally{b(!1)}}}return c?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-40 w-full rounded-xl"}),s.jsx(Be,{className:"h-40 w-full rounded-xl"})]}):o?s.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[a?s.jsx(We,{children:s.jsx(Ye,{children:"You have view-only access. An admin or editor can change these settings."})}):null,g?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g})}):null,w?s.jsx(We,{children:s.jsx(Ye,{children:w})}):null,s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-base",children:"Auto-delete"}),s.jsx(Et,{children:"Remove transcript files automatically after they reach a certain age. The server checks hourly and whenever you open the library."})]}),s.jsxs(Ze,{className:"space-y-4",children:[s.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 size-4 rounded border-border accent-primary",checked:o.autoDelete.enabled,disabled:a,onChange:k=>l(T=>T&&{...T,autoDelete:{...T.autoDelete,enabled:k.target.checked}})}),s.jsxs("span",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Enable auto-delete"}),s.jsx("span",{className:"mt-0.5 block text-muted-foreground",children:"Deletes HTML files in Data/Transcripts based on last modified time."})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",htmlFor:"transcript-after-days",children:"Delete after (days)"}),s.jsx(Ie,{id:"transcript-after-days",type:"number",min:1,max:3650,disabled:a||!o.autoDelete.enabled,value:o.autoDelete.afterDays,onChange:k=>l(T=>T&&{...T,autoDelete:{...T.autoDelete,afterDays:Math.min(3650,Math.max(1,parseInt(k.target.value,10)||1))}}),className:"max-w-[8rem]"})]}),s.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:a||h,onClick:()=>void N(),children:[s.jsx(ge,{icon:or,size:16,className:fe(h&&"animate-spin")}),"Run cleanup now"]})]})]}),s.jsxs(Xe,{className:"border-border bg-card",children:[s.jsxs(it,{children:[s.jsx(lt,{className:"text-base",children:"Public transcripts"}),s.jsxs(Et,{children:["When enabled, anyone with the link can view a transcript at"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:typeof window<"u"?`${window.location.origin}/transcripts/:id`:"/transcripts/:id"})," ","without signing in. Channel IDs are numeric but not secret—only enable if you are comfortable sharing links."]})]}),s.jsx(Ze,{children:s.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 size-4 rounded border-border accent-primary",checked:o.publicAccess.enabled,disabled:a,onChange:k=>l(T=>T&&{...T,publicAccess:{enabled:k.target.checked}})}),s.jsxs("span",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Allow public transcript URLs"}),s.jsx("span",{className:"mt-0.5 block text-muted-foreground",children:"Dashboard preview and download still require login."})]})]})})]}),a?null:s.jsxs(he,{type:"button",disabled:m,onClick:()=>void E(),children:[s.jsx(ge,{icon:nd,size:16}),m?"Saving…":"Save settings"]})]}):s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:"Could not load transcript settings."})})}function RB(e,n){return n&&e!=="viewer"}function T0(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function R0(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function AB(){var G;const{user:e,hasPermission:n}=Ut(),a=RB(e==null?void 0:e.role,n("transcripts")),[o,l]=f.useState("browse"),[c,d]=f.useState([]),[m,p]=f.useState(null),[h,b]=f.useState(!0),[g,y]=f.useState(""),[w,j]=f.useState(""),[S,E]=f.useState(""),[N,k]=f.useState(0),[T,A]=f.useState(!1),[O,M]=f.useState(!1),[z,B]=f.useState(!1),[K,U]=f.useState(!1),q=f.useCallback(async()=>{b(!0),j("");try{const F=(await Ee.listTranscripts()).data??[];d(F),p(oe=>{var ae;return oe&&F.some(be=>be.id===oe)?oe:((ae=F[0])==null?void 0:ae.id)??null})}catch(V){j(V instanceof Error?V.message:"Failed to load transcripts")}finally{b(!1)}},[]);f.useEffect(()=>{q()},[q]),f.useEffect(()=>{o==="browse"&&Ee.getTranscriptSettings().then(V=>{var F,oe;B(!!((oe=(F=V.data)==null?void 0:F.publicAccess)!=null&&oe.enabled))}).catch(()=>B(!1))},[o]);const ue=f.useMemo(()=>{if(!S.trim())return c;const V=S.toLowerCase();return c.filter(F=>F.id.includes(V)||F.filename.toLowerCase().includes(V)||F.ticketName&&F.ticketName.toLowerCase().includes(V))},[c,S]),pe=f.useMemo(()=>c.find(V=>V.id===m)??null,[c,m]),xe=m?`/api/system/transcripts/${encodeURIComponent(m)}/view`:null,se=m?`/api/system/transcripts/${encodeURIComponent(m)}/download`:null,L=m&&z?`${window.location.origin}/transcripts/${encodeURIComponent(m)}`:null;function I(V){y(""),p(V),k(F=>F+1)}function H(){xe&&window.open(xe,"_blank","noopener,noreferrer")}function Z(){L&&window.open(L,"_blank","noopener,noreferrer")}async function te(){if(L)try{await navigator.clipboard.writeText(L),U(!0),window.setTimeout(()=>U(!1),2e3)}catch{y("Could not copy link to clipboard.")}}async function _(){var F;if(!m||!a)return;const V=((F=pe==null?void 0:pe.ticketName)==null?void 0:F.trim())||`channel ${m}`;if(window.confirm(`Delete the transcript for ${V}? This cannot be undone.`)){M(!0),y("");try{await Ee.deleteTranscript(m),await q()}catch(oe){y(oe instanceof Error?oe.message:"Failed to delete transcript")}finally{M(!1)}}}async function D(){if(!(!se||!pe)){A(!0),y("");try{const V=await fetch(se,{credentials:"include"});if(!V.ok){const be=await V.json().catch(()=>({}));throw new Error(be.error||`Download failed (${V.status})`)}const F=await V.blob(),oe=URL.createObjectURL(F),ae=document.createElement("a");ae.href=oe,ae.download=pe.filename,ae.click(),URL.revokeObjectURL(oe)}catch(V){y(V instanceof Error?V.message:"Failed to download transcript")}finally{A(!1)}}}return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Transcripts"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse saved transcripts or customize how new ones look when tickets close."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsx(he,{type:"button",variant:o==="browse"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>l("browse"),children:"Library"}),s.jsx(he,{type:"button",variant:o==="appearance"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>l("appearance"),children:"Appearance"}),s.jsx(he,{type:"button",variant:o==="settings"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>l("settings"),children:"Settings"})]}),o==="browse"?s.jsxs(he,{variant:"outline",size:"sm",onClick:()=>q(),disabled:h,children:[s.jsx(ge,{icon:or,size:16,className:fe(h&&"animate-spin")}),"Refresh"]}):null]})]}),o==="appearance"?s.jsx(NB,{}):o==="settings"?s.jsx(TB,{}):s.jsxs(s.Fragment,{children:[w?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:w})}):null,s.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(240px,320px)_1fr]",children:[s.jsxs(Xe,{className:"flex min-h-[420px] flex-col border-border bg-card",children:[s.jsxs(it,{className:"space-y-3 pb-3",children:[s.jsxs(lt,{className:"text-base font-medium",children:["Saved transcripts",!h&&c.length>0?s.jsxs("span",{className:"ml-2 font-normal text-muted-foreground",children:["(",c.length,")"]}):null]}),s.jsxs("div",{className:"relative",children:[s.jsx(ge,{icon:ad,size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(Ie,{placeholder:"Search by ticket name or channel ID…",value:S,onChange:V=>E(V.target.value),className:"pl-9"})]})]}),s.jsx(Ze,{className:"min-h-0 flex-1 p-0 pb-4",children:s.jsx($l,{className:"h-[min(520px,calc(100svh-16rem))] px-4",children:h?s.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((V,F)=>s.jsx(Be,{className:"h-16 w-full rounded-lg"},F))}):ue.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-sm text-muted-foreground",children:[s.jsx(ge,{icon:il,size:32,className:"opacity-40"}),s.jsx("p",{children:c.length===0?"No transcripts yet. They appear when tickets are closed.":"No transcripts match your search."})]}):s.jsx("ul",{className:"space-y-1.5",children:ue.map(V=>{var ae;const F=V.id===m,oe=((ae=V.ticketName)==null?void 0:ae.trim())||`Channel ${V.id}`;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>I(V.id),className:fe("w-full rounded-lg border px-3 py-2.5 text-left transition-colors",F?"border-primary/50 bg-primary/10":"border-transparent bg-secondary/30 hover:bg-secondary/50"),children:[s.jsx("p",{className:"truncate text-sm font-medium",children:oe}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[R0(V.createdAt),V.size!=null?` · ${T0(V.size)}`:""]})]})},V.id)})})})})]}),s.jsxs(Xe,{className:"flex min-h-[420px] flex-col overflow-hidden border-border bg-card",children:[s.jsxs(it,{className:"flex flex-row flex-wrap items-center justify-between gap-2 space-y-0 pb-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(lt,{className:"truncate text-base font-medium",children:pe?((G=pe.ticketName)==null?void 0:G.trim())||`Channel ${pe.id}`:"Preview"}),pe?s.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[R0(pe.createdAt),pe.size!=null?` · ${T0(pe.size)}`:""]}):null]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[L?s.jsxs(s.Fragment,{children:[s.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void te(),children:[s.jsx(ge,{icon:t2,size:16}),K?"Copied":"Copy link"]}),s.jsxs(he,{variant:"outline",size:"sm",onClick:Z,children:[s.jsx(ge,{icon:rd,size:16}),"Public page"]})]}):null,s.jsxs(he,{variant:"outline",size:"sm",disabled:!xe,onClick:H,children:[s.jsx(ge,{icon:s8,size:16}),"Open tab"]}),s.jsxs(he,{variant:"outline",size:"sm",disabled:!se||T,onClick:()=>void D(),children:[s.jsx(ge,{icon:td,size:16}),T?"Saving…":"Download"]}),a?s.jsxs(he,{variant:"outline",size:"sm",disabled:!m||O,className:"text-destructive hover:text-destructive",onClick:()=>void _(),children:[s.jsx(ge,{icon:wl,size:16}),O?"Deleting…":"Delete"]}):null]})]}),s.jsxs(Ze,{className:"flex min-h-0 flex-1 flex-col gap-2 p-4 pt-0",children:[g?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:g})}):null,pe&&xe?s.jsx("iframe",{title:`Transcript ${pe.id}`,src:xe,className:"min-h-[min(560px,calc(100svh-18rem))] w-full flex-1 rounded-lg border border-border bg-background",sandbox:"allow-same-origin"},N):s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border py-16 text-center text-sm text-muted-foreground",children:[s.jsx(ge,{icon:il,size:40,className:"opacity-30"}),s.jsx("p",{children:"Select a transcript from the list to preview it here."})]})]})]})]})]})]})}function MB(){const[e,n]=f.useState([]),[a,o]=f.useState(""),[l,c]=f.useState(!0),[d,m]=f.useState(""),[p,h]=f.useState(null),[b,g]=f.useState(!1),[y,w]=f.useState(!1),[j,S]=f.useState([]),[E,N]=f.useState(!1),[k,T]=f.useState(""),[A,O]=f.useState([]),[M,z]=f.useState(!1),[B,K]=f.useState(null),[U,q]=f.useState(!1),[ue,pe]=f.useState(""),[xe,se]=f.useState(null),[L,I]=f.useState(""),[H,Z]=f.useState(!1),[te,_]=f.useState(null),[D,G]=f.useState(""),[V,F]=f.useState(null),oe=ee=>{_(ee),G("Closed via Web Dashboard"),Z(!0)},ae=async()=>{if(!te)return;const ee=te.ticket_id;F(ee);try{await Ee.closeTicket(ee,D||"Closed via Web Dashboard"),Bt.success("Ticket closed and transcript saved."),n(re=>re.filter(ke=>ke.ticket_id!==ee)),(p==null?void 0:p.ticket_id)===ee&&(g(!1),w(!1),h(null)),Z(!1),_(null)}catch(re){Bt.error(re instanceof Error?re.message:"Failed to close ticket.")}finally{F(null)}},be=f.useRef(null),ve=f.useRef(null),Y=()=>{var ee;(ee=be.current)==null||ee.scrollIntoView({behavior:"smooth"})},le=f.useCallback(async()=>{c(!0),m("");try{const ee=await Ee.listOpenTickets();ee.data&&(o(ee.data.guildId),n(ee.data.tickets.sort((re,ke)=>ke.created_at-re.created_at)))}catch(ee){m(ee instanceof Error?ee.message:"Failed to load open tickets")}finally{c(!1)}},[]);f.useEffect(()=>{le()},[le]),f.useEffect(()=>{Ee.getGuildResources().then(ee=>{ee.data&&K(ee.data)}).catch(()=>{})},[]);const ye=f.useCallback(ee=>{p&&ee.ticketId===p.ticket_id&&(S(re=>re.some(ke=>ke.id===ee.message.id)?re:[...re,ee.message]),setTimeout(Y,100))},[p]),Te=f.useCallback(ee=>{p&&ee.ticketId===p.ticket_id&&S(re=>re.filter(ke=>ke.id!==ee.messageId))},[p]),Le=f.useCallback(ee=>{p&&ee.ticketId===p.ticket_id&&S(re=>re.map(ke=>ke.id===ee.messageId?{...ke,content:ee.content}:ke))},[p]),rt=f.useCallback(ee=>{n(re=>re.some(ke=>ke.ticket_id===ee.ticket_id)?re:[ee,...re]),Bt.info("New Ticket Created",{description:`#${ee.ticket_id} - ${ee.subject||"No Subject"}`})},[]),ht=f.useCallback(ee=>{n(re=>re.filter(ke=>ke.ticket_id!==ee.ticket_id)),(p==null?void 0:p.ticket_id)===ee.ticket_id&&Bt.warning("Active ticket was closed in Discord.")},[p]);Yg({onTicketMessage:ye,onTicketMessageDeleted:Te,onTicketMessageUpdated:Le,onTicketCreated:rt,onTicketClosed:ht});const Mt=async ee=>{var re;h(ee),g(!0),N(!0),S([]),O([]),se(null);try{const ke=await Ee.getTicketMessages(ee.ticket_id);(re=ke.data)!=null&&re.messages&&(S(ke.data.messages),setTimeout(Y,150))}catch(ke){Bt.error(ke instanceof Error?ke.message:"Failed to fetch messages")}finally{N(!1)}},Tr=ee=>{const re=Array.from(ee.target.files||[]);re.length&&(re.forEach(ke=>{const we=new FileReader;we.onload=De=>{var ct;const at=(ct=De.target)==null?void 0:ct.result;O(mt=>[...mt,{filename:ke.name,data:at,previewUrl:ke.type.startsWith("image/")?at:void 0,sizeMb:(ke.size/1024/1024).toFixed(2)}])},we.readAsDataURL(ke)}),ve.current&&(ve.current.value=""))},_t=ee=>{O(re=>re.filter((ke,we)=>we!==ee))},Ya=async ee=>{var we;if(ee.preventDefault(),!k.trim()&&!A.length||!p||M)return;const re=k.trim(),ke=[...A];z(!0),T(""),O([]),q(!1);try{const De=await Ee.me().catch(()=>null),at=((we=De==null?void 0:De.data)==null?void 0:we.username)||"Staff",ct=await Ee.sendTicketReply(p.ticket_id,re,at,ke.map(mt=>({filename:mt.filename,data:mt.data})));ct.data&&(S(mt=>mt.some(Zt=>Zt.id===ct.data.id)?mt:[...mt,{id:ct.data.id,author:ct.data.author,content:ct.data.content,attachments:ct.data.attachments||[],createdAt:ct.data.createdAt}]),setTimeout(Y,100))}catch(De){Bt.error(De instanceof Error?De.message:"Failed to send reply to Discord."),T(re),O(ke)}finally{z(!1)}},qa=async ee=>{if(p)try{await Ee.deleteTicketMessage(p.ticket_id,ee),S(re=>re.filter(ke=>ke.id!==ee)),Bt.success("Message deleted in Discord.")}catch(re){Bt.error(re instanceof Error?re.message:"Failed to delete message.")}},qt=ee=>{se(ee.id),I(ee.content)},dr=()=>{se(null),I("")},Kt=async ee=>{if(!(!p||!L.trim()))try{await Ee.editTicketMessage(p.ticket_id,ee,L.trim()),S(re=>re.map(ke=>ke.id===ee?{...ke,content:L.trim()}:ke)),se(null),Bt.success("Message updated in Discord.")}catch(re){Bt.error(re instanceof Error?re.message:"Failed to edit message.")}},ti=ee=>{const re=ee.target.value;T(re);const ke=ee.target.selectionStart||re.length,we=re.slice(0,ke),De=we.lastIndexOf("@");if(De!==-1&&!we.slice(De).includes(" ")){const at=we.slice(De+1).toLowerCase();pe(at),q(!0)}else q(!1)},fr=(ee,re,ke)=>{const we=k.lastIndexOf("@"),De=k.slice(0,we),at=ke?`<@&${re}>`:`<@${re}>`;T(`${De}${at} `),q(!1)},Lo=ee=>{const re=Math.floor((Date.now()-ee)/1e3);return Fh(re)},Rr=ee=>new Date(ee).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),Xt=ee=>{if(!ee)return null;const re=/(```[\s\S]*?```|`[^`]+`|\*\*\*[\s\S]+?\*\*\*|\*\*[\s\S]+?\*\*|__[\s\S]+?__|~~[\s\S]+?~~|\|\|[\s\S]+?\|\||<@!?&?\d+>|^###\s[^\n]+|^##\s[^\n]+|^-#\s[^\n]+|\[[^\]]+\]\(https?:\/\/[^\s)]+\)|https?:\/\/[^\s]+)/gm;return ee.split(re).map((we,De)=>{var Zt;if(!we)return null;if(we.startsWith("-# "))return s.jsx("span",{className:"text-xs text-muted-foreground font-medium block my-0.5 opacity-80",children:Xt(we.slice(3))},De);if(we.startsWith("## "))return s.jsx("span",{className:"text-base font-bold text-foreground block my-1 tracking-tight",children:Xt(we.slice(3))},De);if(we.startsWith("### "))return s.jsx("span",{className:"text-sm font-bold text-foreground block my-0.5",children:Xt(we.slice(4))},De);if(we.startsWith("```")&&we.endsWith("```")&&we.length>=6){const Me=we.slice(3,-3).replace(/^[a-z0-9_-]+\n/i,"");return s.jsx("pre",{className:"bg-black/60 p-2.5 rounded-lg text-xs font-mono my-1.5 border border-border overflow-x-auto text-emerald-400 font-mono",children:s.jsx("code",{children:Me})},De)}if(we.startsWith("`")&&we.endsWith("`")&&we.length>2)return s.jsx("code",{className:"bg-black/50 px-1.5 py-0.5 rounded text-xs font-mono text-emerald-300 border border-border/40",children:we.slice(1,-1)},De);if(we.startsWith("***")&&we.endsWith("***")&&we.length>6)return s.jsx("strong",{className:"font-bold italic",children:Xt(we.slice(3,-3))},De);if(we.startsWith("**")&&we.endsWith("**")&&we.length>4)return s.jsx("strong",{className:"font-bold",children:Xt(we.slice(2,-2))},De);if(we.startsWith("__")&&we.endsWith("__")&&we.length>4)return s.jsx("span",{className:"underline underline-offset-2",children:Xt(we.slice(2,-2))},De);if(we.startsWith("~~")&&we.endsWith("~~")&&we.length>4)return s.jsx("span",{className:"line-through opacity-80",children:Xt(we.slice(2,-2))},De);if(we.startsWith("||")&&we.endsWith("||")&&we.length>4)return s.jsx("span",{className:"bg-secondary text-transparent hover:text-foreground hover:bg-secondary/50 px-1.5 py-0.5 rounded transition-all cursor-pointer select-none border border-border/30",title:"Click to reveal spoiler",children:we.slice(2,-2)},De);const at=we.match(/^<@!?(\d+)>$/);if(at){const Me=at[1],Je=new Map;p&&Je.set(p.user_id,"Ticket Author"),j.forEach(kt=>{var Jn;(Jn=kt.author)!=null&&Jn.id&&Je.set(kt.author.id,kt.author.globalName||kt.author.username)});const St=Je.get(Me);return s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded font-semibold text-xs bg-primary/20 text-primary mx-0.5",title:`User ID: ${Me}`,children:["@",St||"User"]},De)}const ct=we.match(/^<@&(\d+)>$/);if(ct){const Me=ct[1],Je=(Zt=B==null?void 0:B.roles)==null?void 0:Zt.find(St=>St.id===Me);return s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded font-semibold text-xs bg-amber-500/20 text-amber-400 mx-0.5",children:["@",Je?Je.name:`Role (${Me})`]},De)}const mt=we.match(/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/);if(mt){const Me=mt[1],Je=mt[2];return s.jsx("a",{href:Je,target:"_blank",rel:"noreferrer",className:"text-primary underline hover:opacity-80 break-all",children:Me},De)}return/^https?:\/\/[^\s]+$/i.test(we)?/\.(gif|jpe?g|png|webp)(\?[^\s]*)?$/i.test(we)||/cdn\.discordapp\.com\/(emojis|attachments)\//i.test(we)||/images\.discordapp\.net\//i.test(we)||/media\d*\.giphy\.com\//i.test(we)?s.jsx("span",{className:"block my-1",children:s.jsx("img",{src:we,alt:"GIF/Image",className:"max-h-64 rounded-lg border border-border object-contain hover:opacity-95 transition-opacity",loading:"lazy"})},De):s.jsx("a",{href:we,target:"_blank",rel:"noreferrer",className:"text-primary underline hover:opacity-80 break-all",children:we},De):we})},Qn=ee=>!ee||ee.length===0?null:s.jsx("div",{className:"space-y-2 mt-1",children:ee.map(re=>{var at,ct,mt;const ke=((at=re.contentType)==null?void 0:at.startsWith("image/"))||/\.(png|jpe?g|gif|webp|svg)$/i.test(re.name),we=((ct=re.contentType)==null?void 0:ct.startsWith("video/"))||/\.(mp4|webm|mov|mkv)$/i.test(re.name),De=((mt=re.contentType)==null?void 0:mt.startsWith("audio/"))||/\.(mp3|wav|ogg|m4a)$/i.test(re.name);return ke?s.jsx("div",{className:"rounded-lg overflow-hidden border border-border bg-black/40",children:s.jsx("a",{href:re.url,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:re.url,alt:re.name,className:"max-h-80 max-w-full object-contain hover:opacity-95 transition-opacity",loading:"lazy"})})},re.id):we?s.jsx("div",{className:"rounded-lg overflow-hidden border border-border bg-black",children:s.jsx("video",{src:re.url,controls:!0,className:"max-h-80 max-w-full"})},re.id):De?s.jsx("div",{className:"p-2 border border-border rounded-lg bg-secondary/20",children:s.jsx("audio",{src:re.url,controls:!0,className:"w-full h-8"})},re.id):s.jsxs("div",{className:"p-2.5 rounded-lg border border-border bg-secondary/20 flex items-center justify-between text-xs gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 truncate",children:[s.jsx(ge,{icon:ay,size:16,className:"text-primary shrink-0"}),s.jsx("span",{className:"truncate font-medium",children:re.name})]}),s.jsx(he,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 px-2 text-xs",children:s.jsx("a",{href:re.url,target:"_blank",rel:"noreferrer",download:!0,children:"Download"})})]},re.id)})}),zo=ee=>!ee||ee.length===0?null:s.jsx("div",{className:"space-y-3 mt-1.5 w-full",children:ee.map((re,ke)=>{var we,De,at,ct;return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-secondary/30 p-3.5 text-xs space-y-2 border-l-4 shadow-sm relative overflow-hidden max-w-xl",style:{borderLeftColor:re.color||"#5865F2"},children:[re.author&&s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-foreground",children:[re.author.iconURL&&s.jsx("img",{src:re.author.iconURL,alt:"",className:"h-4 w-4 rounded-full"}),s.jsx("span",{children:re.author.name})]}),((we=re.thumbnail)==null?void 0:we.url)&&s.jsx("img",{src:re.thumbnail.url,alt:"",className:"h-12 w-12 rounded object-cover absolute top-3 right-3 border border-border"}),re.title&&s.jsx("h4",{className:"font-bold text-sm text-foreground tracking-tight pr-12",children:Xt(re.title)}),re.description&&s.jsx("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed pr-12",children:Xt(re.description)}),re.fields&&re.fields.length>0&&s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2.5 pt-2 border-t border-border/30",children:re.fields.map((mt,Zt)=>s.jsxs("div",{className:`space-y-0.5 ${mt.inline?"":"sm:col-span-2"}`,children:[s.jsx("p",{className:"font-semibold text-foreground text-[11px] uppercase tracking-wider",children:mt.name}),s.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:Xt(mt.value)})]},Zt))}),((De=re.image)==null?void 0:De.url)&&s.jsx("div",{className:"rounded-md overflow-hidden border border-border mt-2",children:s.jsx("img",{src:re.image.url,alt:"",className:"max-h-64 w-full object-cover"})}),(re.footer||re.timestamp)&&s.jsxs("div",{className:"flex items-center gap-2 pt-1 border-t border-border/20 text-[10px] text-muted-foreground",children:[((at=re.footer)==null?void 0:at.iconURL)&&s.jsx("img",{src:re.footer.iconURL,alt:"",className:"h-3.5 w-3.5 rounded-full"}),((ct=re.footer)==null?void 0:ct.text)&&s.jsx("span",{children:re.footer.text}),re.timestamp&&s.jsxs("span",{children:[new Date(re.timestamp).toLocaleDateString()," ",new Date(re.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})]},ke)})}),mr=ee=>{if(!ee||ee.length===0)return null;const re=ee.map(ke=>({...ke,components:(ke.components||[]).filter(we=>we.customId||we.url||we.type===2||we.type===3||we.type==="BUTTON"||we.type==="STRING_SELECT")})).filter(ke=>ke.components&&ke.components.length>0);return re.length===0?null:s.jsx("div",{className:"space-y-2 mt-2.5 w-full",children:re.map((ke,we)=>{var De;return s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:(De=ke.components)==null?void 0:De.map((at,ct)=>s.jsxs("div",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-secondary/80 text-secondary-foreground text-xs font-semibold border border-border/80 shadow-sm hover:bg-secondary transition-colors cursor-pointer",children:[at.emoji&&s.jsx("span",{children:at.emoji}),s.jsx("span",{children:at.label||at.customId||"Button"})]},ct))},we)})})},pr=()=>s.jsx($l,{className:"flex-1 p-4 sm:p-6",children:s.jsxs("div",{className:"max-w-4xl mx-auto w-full space-y-4",children:[E?s.jsxs("div",{className:"space-y-4 p-4",children:[s.jsx(Be,{className:"h-10 w-3/4"}),s.jsx(Be,{className:"h-10 w-1/2 ml-auto"}),s.jsx(Be,{className:"h-10 w-2/3"})]}):j.length===0?s.jsx("div",{className:"p-12 text-center text-muted-foreground text-sm",children:"No recent messages in this ticket channel."}):j.map(ee=>{var re;return s.jsxs("div",{className:`group flex items-start gap-3 ${ee.author.isDashboard?"flex-row-reverse":""}`,children:[s.jsxs(Ia,{className:"h-8 w-8 shrink-0",children:[s.jsx(Co,{src:ee.author.avatar,alt:ee.author.username}),s.jsx($a,{children:s.jsx(ge,{icon:N8,size:16})})]}),s.jsxs("div",{className:`flex flex-col space-y-1 max-w-[80%] ${ee.author.isDashboard?"items-end":"items-start"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-semibold text-foreground",children:ee.author.globalName||ee.author.username}),ee.author.bot&&s.jsx(An,{variant:"secondary",className:"px-1 py-0 text-[10px]",children:"BOT"}),ee.author.isDashboard&&s.jsx(An,{variant:"default",className:"px-1 py-0 text-[10px]",children:"STAFF"}),s.jsx("span",{children:Rr(ee.createdAt)}),s.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-1",children:[s.jsx(he,{variant:"ghost",size:"icon",className:"h-5 w-5 text-muted-foreground hover:text-foreground",onClick:()=>qt(ee),title:"Edit Message",children:s.jsx(ge,{icon:a2,size:12})}),s.jsx(he,{variant:"ghost",size:"icon",className:"h-5 w-5 text-muted-foreground hover:text-destructive",onClick:()=>qa(ee.id),title:"Delete Message",children:s.jsx(ge,{icon:wl,size:12})})]})]}),xe===ee.id?s.jsxs("div",{className:"flex items-center gap-2 w-full mt-1",children:[s.jsx(Ie,{value:L,onChange:ke=>I(ke.target.value),className:"h-8 text-sm",autoFocus:!0}),s.jsx(he,{size:"sm",className:"h-8 px-2 bg-primary",onClick:()=>Kt(ee.id),children:s.jsx(ge,{icon:S8,size:14})}),s.jsx(he,{size:"sm",variant:"ghost",className:"h-8 px-2",onClick:dr,children:s.jsx(ge,{icon:Zr,size:14})})]}):ee.content?s.jsx("div",{className:`rounded-lg px-3.5 py-2.5 text-sm whitespace-pre-wrap ${ee.author.isDashboard?"bg-primary text-primary-foreground":"bg-secondary/40 text-secondary-foreground border border-border/50"}`,style:ee.containerColor||ee.author.bot&&!((re=ee.embeds)!=null&&re.length)?{borderLeftWidth:"4px",borderLeftColor:ee.containerColor||"#5865F2"}:void 0,children:Xt(ee.content)}):null,Qn(ee.attachments),zo(ee.embeds),mr(ee.components)]})]},ee.id)}),s.jsx("div",{ref:be})]})}),Ht=()=>{var ee;return s.jsxs("div",{className:"p-4 border-t border-border bg-secondary/10 flex flex-col gap-2 relative",children:[A.length>0&&s.jsx("div",{className:"max-w-4xl mx-auto w-full flex items-center gap-2 flex-wrap mb-1",children:A.map((re,ke)=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 px-3 rounded-lg border border-border bg-secondary text-xs",children:[re.previewUrl?s.jsx("img",{src:re.previewUrl,alt:"",className:"h-6 w-6 rounded object-cover"}):s.jsx(ge,{icon:ay,size:14,className:"text-primary"}),s.jsx("span",{className:"font-medium max-w-[120px] truncate",children:re.filename}),s.jsxs("span",{className:"text-muted-foreground text-[10px]",children:[re.sizeMb,"MB"]}),s.jsx("button",{type:"button",onClick:()=>_t(ke),className:"text-muted-foreground hover:text-destructive ml-1",children:s.jsx(ge,{icon:Zr,size:12})})]},ke))}),U&&s.jsxs("div",{className:"max-w-4xl mx-auto w-full absolute bottom-full mb-2 z-50 bg-popover text-popover-foreground border border-border rounded-xl shadow-xl overflow-hidden max-h-48 overflow-y-auto",children:[s.jsx("div",{className:"p-2 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider border-b",children:"Mentions (@)"}),p&&s.jsxs("button",{type:"button",onClick:()=>fr("Ticket Author",p.user_id,!1),className:"w-full text-left p-2 hover:bg-secondary flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ia,{className:"h-5 w-5",children:s.jsx($a,{children:"U"})}),s.jsx("span",{className:"font-medium",children:"Ticket Author"})]}),s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["@",p.user_id]})]}),(ee=B==null?void 0:B.roles)==null?void 0:ee.filter(re=>re.name.toLowerCase().includes(ue)).slice(0,5).map(re=>s.jsxs("button",{type:"button",onClick:()=>fr(re.name,re.id,!0),className:"w-full text-left p-2 hover:bg-secondary flex items-center justify-between text-xs",children:[s.jsxs("span",{className:"font-medium text-amber-400",children:["@",re.name]}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"Role"})]},re.id))]}),s.jsxs("form",{onSubmit:Ya,className:"max-w-4xl mx-auto w-full flex items-center gap-2",children:[s.jsx("input",{type:"file",ref:ve,multiple:!0,onChange:Tr,className:"hidden",accept:"image/*,video/*,audio/*,.pdf,.zip,.txt,.json"}),s.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>{var re;return(re=ve.current)==null?void 0:re.click()},title:"Attach files or media",className:"h-9 px-2.5",children:s.jsx(ge,{icon:u8,size:16})}),s.jsx(Ie,{value:k,onChange:ti,placeholder:"Type a reply... Use @ to tag roles or users",disabled:M||E,className:"flex-1"}),s.jsx(he,{type:"submit",size:"sm",disabled:M||!k.trim()&&!A.length||E,children:M?s.jsx(ge,{icon:or,size:16,className:"animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(ge,{icon:w8,size:16,className:"mr-1.5"}),"Send"]})})]})]})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Open Tickets"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage open support tickets & reply live to Discord channels from the web dashboard."})]}),s.jsxs(he,{onClick:()=>void le(),disabled:l,variant:"outline",size:"sm",children:[s.jsx(ge,{icon:or,size:16,className:l?"animate-spin mr-2":"mr-2"}),"Refresh"]})]}),s.jsx(Xe,{className:"border-border bg-card",children:s.jsx(Ze,{className:"p-0",children:l?s.jsxs("div",{className:"space-y-4 p-6",children:[s.jsx(Be,{className:"h-12 w-full"}),s.jsx(Be,{className:"h-12 w-full"}),s.jsx(Be,{className:"h-12 w-full"})]}):d?s.jsx("div",{className:"p-6",children:s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:d})})}):e.length===0?s.jsx("div",{className:"p-12 text-center text-muted-foreground",children:"No open tickets at the moment!"}):s.jsx("div",{className:"divide-y divide-border",children:e.map(ee=>s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between p-4 hover:bg-secondary/10 transition-colors gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"font-medium text-primary",children:ee.subject||"Untitled Ticket"}),s.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",ee.ticket_id]}),s.jsx(An,{variant:"outline",className:"text-xs capitalize",children:ee.department}),s.jsxs(An,{variant:ee.priority==="high"?"destructive":ee.priority==="medium"?"secondary":"outline",className:"text-xs capitalize",children:[ee.priority," priority"]})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["User ID: ",s.jsx("span",{className:"font-mono",children:ee.user_id}),ee.description&&` • ${ee.description}`]})]}),s.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto justify-end",children:[s.jsxs("div",{className:"text-sm text-muted-foreground flex items-center whitespace-nowrap mr-2",children:[s.jsx(ge,{icon:i8,size:14,className:"mr-1.5"}),Lo(ee.created_at)]}),s.jsxs(he,{variant:"default",size:"sm",onClick:()=>Mt(ee),className:"bg-primary text-primary-foreground hover:bg-primary/90",children:[s.jsx(ge,{icon:l8,size:16,className:"mr-2"}),"Live Chat"]}),s.jsxs(he,{variant:"destructive",size:"sm",onClick:()=>oe(ee),disabled:V===ee.ticket_id,children:[V===ee.ticket_id?s.jsx(ge,{icon:or,size:14,className:"animate-spin mr-1.5"}):s.jsx(ge,{icon:Zr,size:14,className:"mr-1.5"}),"Close"]}),a&&s.jsx(he,{variant:"secondary",size:"sm",asChild:!0,children:s.jsx("a",{href:`https://discord.com/channels/${a}/${ee.ticket_id}`,target:"_blank",rel:"noreferrer",children:s.jsx(ge,{icon:rd,size:16})})})]})]},ee.ticket_id))})})}),b&&y&&s.jsx("div",{className:"fixed inset-0 z-50 bg-black/65 backdrop-blur-sm flex items-center justify-center p-4 sm:p-6 lg:p-8 animate-in fade-in-0",onClick:ee=>{ee.target===ee.currentTarget&&w(!1)},children:s.jsxs("div",{className:"bg-card text-card-foreground border border-border rounded-2xl shadow-2xl flex flex-col w-full max-w-5xl h-[88vh] overflow-hidden animate-in zoom-in-95",children:[s.jsxs("div",{className:"p-4 border-b border-border bg-secondary/20 flex flex-col space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[s.jsx("h2",{className:"text-lg font-bold tracking-tight truncate",children:(p==null?void 0:p.subject)||"Ticket Live Chat"}),s.jsxs(An,{variant:"outline",className:"font-mono text-xs shrink-0",children:["#",p==null?void 0:p.ticket_id]}),(p==null?void 0:p.department)&&s.jsx(An,{variant:"secondary",className:"text-xs capitalize shrink-0",children:p.department})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[p&&s.jsxs(he,{variant:"destructive",size:"sm",onClick:()=>oe(p),disabled:V===p.ticket_id,className:"h-8 px-2.5 text-xs",children:[V===p.ticket_id?s.jsx(ge,{icon:or,size:14,className:"animate-spin mr-1.5"}):s.jsx(ge,{icon:Zr,size:14,className:"mr-1.5"}),"Close Ticket"]}),s.jsxs(he,{variant:"outline",size:"sm",onClick:()=>w(!1),className:"h-8 px-3 text-xs flex items-center gap-1.5",children:[s.jsx(ge,{icon:h8,size:14}),s.jsx("span",{children:"Collapse"})]}),s.jsx(he,{variant:"ghost",size:"icon",onClick:()=>{g(!1),w(!1)},className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:s.jsx(ge,{icon:Zr,size:18})})]})]}),(p==null?void 0:p.description)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p.description})]}),pr(),Ht()]})}),b&&!y&&s.jsx(UC,{open:b,onOpenChange:g,children:s.jsxs(bg,{side:"right",className:"w-full sm:max-w-xl p-0 flex flex-col h-full bg-card",children:[s.jsxs(yg,{className:"p-4 border-b border-border space-y-1 bg-secondary/20",children:[s.jsxs("div",{className:"flex items-center justify-between pr-8",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[s.jsx(wg,{className:"text-base font-bold truncate",children:(p==null?void 0:p.subject)||"Ticket Live Chat"}),s.jsxs(An,{variant:"outline",className:"font-mono text-xs shrink-0",children:["#",p==null?void 0:p.ticket_id]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p&&s.jsxs(he,{variant:"destructive",size:"sm",onClick:()=>oe(p),disabled:V===p.ticket_id,className:"h-7 px-2 text-xs",children:[V===p.ticket_id?s.jsx(ge,{icon:or,size:13,className:"animate-spin mr-1"}):s.jsx(ge,{icon:Zr,size:13,className:"mr-1"}),"Close"]}),s.jsxs(he,{variant:"outline",size:"sm",onClick:()=>w(!0),className:"h-7 px-2 text-xs flex items-center gap-1",title:"Open in Full View",children:[s.jsx(ge,{icon:p8,size:13}),s.jsx("span",{children:"Full View"})]})]})]}),(p==null?void 0:p.description)&&s.jsx(Cg,{className:"text-xs text-muted-foreground truncate",children:p.description})]}),pr(),Ht()]})}),s.jsx(zl,{open:H,onOpenChange:Z,children:s.jsxs(qs,{className:"sm:max-w-md bg-card border-border rounded-xl",children:[s.jsxs(Ks,{children:[s.jsxs(Xs,{className:"text-lg font-bold flex items-center gap-2",children:[s.jsx(ge,{icon:Zr,className:"text-destructive",size:20}),"Close Ticket #",te==null?void 0:te.ticket_id]}),s.jsx(Zs,{className:"text-xs text-muted-foreground pt-1",children:"Are you sure you want to close this ticket? A transcript will be created and the channel will be deleted in Discord."})]}),s.jsxs("div",{className:"space-y-2 py-2",children:[s.jsx("label",{className:"text-xs font-semibold text-foreground",children:"Reason for closing (Optional)"}),s.jsx(Ie,{value:D,onChange:ee=>G(ee.target.value),placeholder:"e.g. Issue resolved by support team",className:"text-sm"})]}),s.jsxs(Pl,{className:"gap-2 sm:gap-0 mt-2",children:[s.jsx(he,{variant:"outline",size:"sm",onClick:()=>Z(!1),disabled:!!V,children:"Cancel"}),s.jsxs(he,{variant:"destructive",size:"sm",onClick:ae,disabled:!!V,children:[V?s.jsx(ge,{icon:or,size:14,className:"animate-spin mr-1.5"}):s.jsx(ge,{icon:Zr,size:14,className:"mr-1.5"}),"Confirm Close"]})]})]})})]})}const _B=["admin","moderator","editor","viewer","custom"];function OB(){return{mode:"add",id:"",username:"",globalName:"",role:"viewer",enabled:!0,permissions:_a("viewer"),yamlOwner:!1}}function DB({permissions:e,onChange:n,disabled:a}){const o=d=>n({...e,...d}),l=[{key:"overview",title:"Dashboard Overview",description:"Access to system metrics, bot health status, and main dashboard stats."},{key:"tickets",title:"Tickets",description:"View open support tickets, live web chat, send staff replies, and close tickets."},{key:"transcripts",title:"Transcripts",description:"Access saved ticket HTML transcripts and configure public transcript options."},{key:"logs",title:"Console Logs",description:"View real-time bot terminal output, system logs, and runtime error traces."}],c=[["supportbot","Bot config","Main bot token, prefix, channels, categories, and core settings."],["ticket-panel","Ticket panel","Ticket home embed, button labels, dropdown options, and panel styling."],["commands","Commands","Enable/disable slash commands, descriptions, and custom names."],["messages","Messages","Custom bot response messages, welcome embeds, and embed colors."],["supportbot-ai","AI assistant","Configure AI support rules, model API keys, and auto-response channels."]];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"General Capabilities"}),s.jsxs("div",{className:"grid gap-2.5",children:[l.map(({key:d,title:m,description:p})=>s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsx(At,{checked:e[d]??(d==="tickets"?e.overview:!1),disabled:a,onCheckedChange:h=>o({[d]:h}),className:"shrink-0"})]},d)),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View system branding, OAuth configurations, and system health details."})]}),s.jsx(At,{checked:e.settings.view,disabled:a,onCheckedChange:d=>o({settings:{...e.settings,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (Install Updates)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Perform 1-click bot system updates and trigger bot server restarts."})]}),s.jsx(At,{checked:e.settings.update,disabled:a,onCheckedChange:d=>o({settings:{...e.settings,update:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View dashboard staff accounts and permission group listings."})]}),s.jsx(At,{checked:e.users.view,disabled:a,onCheckedChange:d=>o({users:{...e.users,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (Manage)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Create, edit, assign, and delete staff accounts and permission groups."})]}),s.jsx(At,{checked:e.users.manage,disabled:a,onCheckedChange:d=>o({users:{...e.users,manage:d}}),className:"shrink-0"})]})]})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Configuration Files Access"}),s.jsx("div",{className:"grid gap-2.5",children:c.map(([d,m,p])=>{var b;const h=((b=e.configs)==null?void 0:b[d])??{view:!1,edit:!1};return s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsxs("div",{className:"flex items-center gap-4 shrink-0",children:[s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"View"}),s.jsx(At,{checked:h.view,disabled:a,onCheckedChange:g=>o({configs:{...e.configs,[d]:{...h,view:g}}})})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Edit"}),s.jsx(At,{checked:h.edit,disabled:a,onCheckedChange:g=>o({configs:{...e.configs,[d]:{...h,edit:g,view:g?!0:h.view}}})})]})]})]},d)})})]})]})}function LB(e){return e.permissions.users.manage?"Full + user management":e.permissions.settings.update?"Configs + settings updates":Object.values(e.permissions.configs).some(n=>n.edit)?"Can edit configs":"View only"}function zB(){const{user:e,hasPermission:n}=Ut(),a=n("users.manage"),[o,l]=f.useState([]),[c,d]=f.useState([]),[m,p]=f.useState(!0),[h,b]=f.useState(""),[g,y]=f.useState(null),[w,j]=f.useState(!1),S=f.useCallback(async()=>{p(!0),b("");try{const[M,z]=await Promise.all([Ee.listDashboardUsers(),Ee.listGroups().catch(()=>({data:{groups:[]}}))]);M.data&&l(M.data.users),z.data&&d(z.data.groups)}catch(M){b(M instanceof Error?M.message:"Failed to load users")}finally{p(!1)}},[]);f.useEffect(()=>{S()},[S]);const E=f.useMemo(()=>[...o].sort((M,z)=>M.yamlOwner!==z.yamlOwner?M.yamlOwner?-1:1:(M.username||M.id).localeCompare(z.username||z.id)),[o]);function N(){y(OB())}function k(M){y({mode:"edit",id:M.id,username:M.username||"",globalName:M.globalName||"",role:M.yamlOwner?"owner":M.role,enabled:M.enabled,permissions:M.role==="custom"?M.permissions:_a(M.role),yamlOwner:M.yamlOwner})}function T(M){g&&y({...g,role:M,permissions:_a(M,g.permissions)})}async function A(){if(!(!g||!a)){j(!0),b("");try{g.mode==="add"?await Ee.addDashboardUser({id:g.id.trim(),role:g.role,username:g.username||void 0,globalName:g.globalName||void 0,enabled:g.enabled,permissions:g.role==="custom"?g.permissions:void 0}):await Ee.updateDashboardUser(g.id,{role:g.yamlOwner?void 0:g.role,enabled:g.enabled,username:g.username||void 0,globalName:g.globalName||void 0,permissions:g.role==="custom"?g.permissions:void 0}),y(null),await S()}catch(M){b(M instanceof Error?M.message:"Could not save user")}finally{j(!1)}}}async function O(M){if(a&&window.confirm("Remove this user from the dashboard?")){b("");try{await Ee.removeDashboardUser(M),await S()}catch(z){b(z instanceof Error?z.message:"Could not remove user")}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Users"}),s.jsxs("p",{className:"text-muted-foreground",children:["Control who can sign in and what they can view or edit. Owners in"," ",s.jsx("code",{className:"rounded bg-primary/10 px-1 text-xs text-primary",children:"api.yml"})," ","always have full access."]})]}),a?s.jsxs(he,{onClick:N,children:[s.jsx(ge,{icon:Z0,size:16,className:"mr-2"}),"Add user"]}):null]}),h?s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:h})}):null,s.jsx(Xe,{className:"border-border bg-card overflow-hidden",children:s.jsx(Ze,{className:"p-0",children:m?s.jsxs("div",{className:"p-4 space-y-2",children:[s.jsx(Be,{className:"h-8 w-full rounded-md"}),s.jsx(Be,{className:"h-8 w-full rounded-md"})]}):E.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-muted-foreground",children:"No users found."}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/80 bg-secondary/30 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-2.5",children:"User"}),s.jsx("th",{className:"px-4 py-2.5",children:"Group"}),s.jsx("th",{className:"px-4 py-2.5",children:"Access Summary"}),s.jsx("th",{className:"px-4 py-2.5",children:"Status"}),a&&s.jsx("th",{className:"px-4 py-2.5 text-right",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-border/40",children:E.map(M=>{const z=c.find(U=>U.id===M.groupId||U.id===M.role),B=(z==null?void 0:z.color)||"#10B981",K=(z==null?void 0:z.name)||sy[M.yamlOwner?"owner":M.role]||M.role;return s.jsxs("tr",{className:"transition-colors hover:bg-secondary/25",children:[s.jsx("td",{className:"px-4 py-2.5 font-medium whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsxs(Ia,{className:"size-7",children:[s.jsx(Co,{src:M.avatar,alt:M.username}),s.jsx($a,{className:"text-[10px]",children:(M.username||M.id).slice(0,2).toUpperCase()})]}),s.jsxs("div",{className:"min-w-0 leading-tight",children:[s.jsxs("p",{className:"truncate font-semibold text-foreground text-xs",children:[l2(M),M.id===(e==null?void 0:e.id)?s.jsx("span",{className:"text-[11px] text-primary font-normal ml-1",children:"(you)"}):""]}),s.jsx("p",{className:"truncate text-[10px] text-muted-foreground font-mono",children:M.id})]})]})}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full shrink-0 shadow-sm",style:{backgroundColor:B}}),s.jsx("span",{className:"font-medium text-xs text-foreground",children:K}),M.yamlOwner&&s.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20",children:"Config Owner"})]})}),s.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground max-w-xs truncate",children:LB(M)}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:M.enabled?s.jsx(An,{className:"text-[10px] px-2 py-0.5 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/15 border-emerald-500/20",children:"Active"}):s.jsx(An,{variant:"outline",className:"text-[10px] px-2 py-0.5",children:"Disabled"})}),a&&s.jsx("td",{className:"px-4 py-2.5 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsxs(he,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-foreground",onClick:()=>k(M),children:[s.jsx(ge,{icon:c8,size:13}),"Edit"]}),!M.yamlOwner&&s.jsxs(he,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-destructive",onClick:()=>O(M.id),children:[s.jsx(ge,{icon:wl,size:13}),"Remove"]})]})})]},M.id)})})]})})})}),s.jsx(zl,{open:!!g,onOpenChange:M=>!M&&y(null),children:s.jsxs(qs,{className:"max-h-[90vh] max-w-lg overflow-y-auto",children:[s.jsxs(Ks,{children:[s.jsx(Xs,{children:(g==null?void 0:g.mode)==="add"?"Add dashboard user":"Edit user"}),s.jsx(Zs,{children:g!=null&&g.yamlOwner?"This user is an owner in api.yml. Role and removal are managed in the config file.":k8[(g==null?void 0:g.role)??"viewer"]})]}),g?s.jsxs("div",{className:"space-y-4",children:[g.mode==="add"?s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"discord-id",children:"Discord user ID"}),s.jsx(Ie,{id:"discord-id",value:g.id,onChange:M=>y({...g,id:M.target.value}),placeholder:"829112572816130058"})]}):null,s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Display name (optional)"}),s.jsx(Ie,{value:g.globalName,onChange:M=>y({...g,globalName:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Username (optional)"}),s.jsx(Ie,{value:g.username,onChange:M=>y({...g,username:M.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{children:"Permission Group"}),s.jsxs(No,{value:g.role,disabled:g.yamlOwner,onValueChange:M=>{const z=c.find(B=>B.id===M);z?y({...g,role:M,permissions:z.permissions}):T(M)},children:[s.jsx(Ba,{children:s.jsx(Eo,{})}),s.jsx(Ua,{children:g.yamlOwner?s.jsx(an,{value:"owner",children:"Owner"}):c.length>0?c.map(M=>s.jsx(an,{value:M.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-2.5 rounded-full shrink-0",style:{backgroundColor:M.color||"#10B981"}}),s.jsx("span",{children:M.name})]})},M.id)):_B.map(M=>s.jsx(an,{value:M,children:sy[M]},M))})]})]}),s.jsxs("label",{className:"flex items-center justify-between rounded-lg border border-border px-3 py-2",children:[s.jsx("span",{className:"text-sm",children:"Account enabled"}),s.jsx(At,{checked:g.enabled,disabled:g.yamlOwner,onCheckedChange:M=>y({...g,enabled:M})})]}),g.role==="custom"&&!g.yamlOwner?s.jsx(DB,{permissions:g.permissions,onChange:M=>y({...g,permissions:M})}):null]}):null,s.jsxs(Pl,{children:[s.jsx(he,{variant:"outline",onClick:()=>y(null),children:"Cancel"}),s.jsx(he,{disabled:w||!a||(g==null?void 0:g.mode)==="add"&&!/^\d{17,20}$/.test(g.id.trim()),onClick:()=>void A(),children:w?"Saving…":"Save"})]})]})})]})}const PB=[{name:"Emerald",hex:"#10B981"},{name:"Blue",hex:"#3B82F6"},{name:"Purple",hex:"#8B5CF6"},{name:"Amber",hex:"#F59E0B"},{name:"Red",hex:"#EF4444"},{name:"Cyan",hex:"#06B6D4"},{name:"Gray",hex:"#6B7280"}];function IB({permissions:e,onChange:n,disabled:a}){const o=d=>n({...e,...d}),l=[{key:"overview",title:"Dashboard Overview",description:"Access to system metrics, bot health status, and main dashboard stats."},{key:"tickets",title:"Tickets",description:"View open support tickets, live web chat, send staff replies, and close tickets."},{key:"transcripts",title:"Transcripts",description:"Access saved ticket HTML transcripts and configure public transcript options."},{key:"logs",title:"Console Logs",description:"View real-time bot terminal output, system logs, and runtime error traces."}],c=[["supportbot","Bot config","Main bot token, prefix, channels, categories, and core settings."],["ticket-panel","Ticket panel","Ticket home embed, button labels, dropdown options, and panel styling."],["commands","Commands","Enable/disable slash commands, descriptions, and custom names."],["messages","Messages","Custom bot response messages, welcome embeds, and embed colors."],["supportbot-ai","AI assistant","Configure AI support rules, model API keys, and auto-response channels."]];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"General Capabilities"}),s.jsxs("div",{className:"grid gap-2.5",children:[l.map(({key:d,title:m,description:p})=>s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsx(At,{checked:e[d]??(d==="tickets"?e.overview:!1),disabled:a,onCheckedChange:h=>o({[d]:h}),className:"shrink-0"})]},d)),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View system branding, OAuth configurations, and system health details."})]}),s.jsx(At,{checked:e.settings.view,disabled:a,onCheckedChange:d=>o({settings:{...e.settings,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (Install Updates)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Perform 1-click bot system updates and trigger bot server restarts."})]}),s.jsx(At,{checked:e.settings.update,disabled:a,onCheckedChange:d=>o({settings:{...e.settings,update:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View dashboard staff accounts and permission group listings."})]}),s.jsx(At,{checked:e.users.view,disabled:a,onCheckedChange:d=>o({users:{...e.users,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (Manage)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Create, edit, assign, and delete staff accounts and permission groups."})]}),s.jsx(At,{checked:e.users.manage,disabled:a,onCheckedChange:d=>o({users:{...e.users,manage:d}}),className:"shrink-0"})]})]})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Configuration Files Access"}),s.jsx("div",{className:"grid gap-2.5",children:c.map(([d,m,p])=>{var b;const h=((b=e.configs)==null?void 0:b[d])??{view:!1,edit:!1};return s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsxs("div",{className:"flex items-center gap-4 shrink-0",children:[s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"View"}),s.jsx(At,{checked:h.view,disabled:a,onCheckedChange:g=>o({configs:{...e.configs,[d]:{...h,view:g}}})})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Edit"}),s.jsx(At,{checked:h.edit,disabled:a,onCheckedChange:g=>o({configs:{...e.configs,[d]:{...h,edit:g,view:g?!0:h.view}}})})]})]})]},d)})})]})]})}function $B(){const{impersonateGroup:e,impersonatedGroup:n,stopImpersonation:a}=Ut(),[o,l]=f.useState([]),[c,d]=f.useState(!0),[m,p]=f.useState(null),[h,b]=f.useState(null),[g,y]=f.useState(!1),[w,j]=f.useState("add"),[S,E]=f.useState(!1),[N,k]=f.useState(""),[T,A]=f.useState(""),[O,M]=f.useState(""),[z,B]=f.useState("#10B981"),[K,U]=f.useState(""),[q,ue]=f.useState(_a("viewer")),pe=async()=>{var H;d(!0),p(null);try{const Z=await Ee.listGroups();l(((H=Z.data)==null?void 0:H.groups)||[])}catch(Z){p(Z instanceof Error?Z.message:"Failed to load groups")}finally{d(!1)}};f.useEffect(()=>{pe()},[]);const xe=()=>{j("add"),k(""),A(""),M(""),B("#10B981"),U(""),ue(_a("viewer")),y(!0)},se=H=>{j("edit"),k(H.id),A(H.name),M(H.description||""),B(H.color||"#10B981"),U(H.discordRoleId||""),ue(H.permissions||_a("viewer")),y(!0)},L=async()=>{if(!T.trim()){p("Group name is required");return}E(!0),p(null);try{w==="add"?(await Ee.createGroup({name:T.trim(),description:O.trim(),color:z,discordRoleId:K.trim()||null,permissions:q}),b(`Group "${T}" created successfully.`)):(await Ee.updateGroup(N,{name:T.trim(),description:O.trim(),color:z,discordRoleId:K.trim()||null,permissions:q}),b(`Group "${T}" updated successfully.`)),y(!1),await pe()}catch(H){p(H instanceof Error?H.message:"Failed to save group")}finally{E(!1)}},I=async H=>{if(!H.isSystem&&confirm(`Are you sure you want to delete the group "${H.name}"?`))try{await Ee.deleteGroup(H.id),b(`Group "${H.name}" deleted.`),await pe()}catch(Z){p(Z instanceof Error?Z.message:"Failed to delete group")}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Permission Groups"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Create custom permission groups, assign staff members, and optionally sync with Discord Role IDs."})]}),s.jsxs(he,{onClick:xe,className:"shrink-0 gap-2 bg-primary",children:[s.jsx(ge,{icon:Z0,size:18}),"Create Group"]})]}),m&&s.jsx(We,{variant:"destructive",children:s.jsx(Ye,{children:m})}),h&&s.jsx(We,{className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",children:s.jsxs(Ye,{className:"flex items-center justify-between",children:[s.jsx("span",{children:h}),s.jsx(he,{size:"sm",variant:"ghost",className:"h-6 px-2 text-xs",onClick:()=>b(null),children:"Dismiss"})]})}),s.jsx(Xe,{className:"border-border bg-card overflow-hidden",children:s.jsx(Ze,{className:"p-0",children:c?s.jsxs("div",{className:"p-4 space-y-2",children:[s.jsx(Be,{className:"h-8 w-full rounded-md"}),s.jsx(Be,{className:"h-8 w-full rounded-md"})]}):o.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-muted-foreground",children:'No permission groups found. Click "Create Group" to add one.'}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/80 bg-secondary/30 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-2.5",children:"Group"}),s.jsx("th",{className:"px-4 py-2.5",children:"Description"}),s.jsx("th",{className:"px-4 py-2.5",children:"Discord Role ID"}),s.jsx("th",{className:"px-4 py-2.5",children:"Enabled Permissions"}),s.jsx("th",{className:"px-4 py-2.5 text-right",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-border/40",children:o.map(H=>{var Z,te,_,D,G,V,F;return s.jsxs("tr",{className:"transition-colors hover:bg-secondary/25",children:[s.jsx("td",{className:"px-4 py-2.5 font-medium whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-2.5 rounded-full shrink-0 shadow-sm",style:{backgroundColor:H.color||"#10B981"}}),s.jsx("span",{className:"text-foreground font-semibold text-xs",children:H.name}),H.isSystem&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold px-1.5 py-0.5 rounded-full bg-secondary text-secondary-foreground border border-border/80",children:[s.jsx(ge,{icon:bu,size:10}),"System"]})]})}),s.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground max-w-xs truncate",children:H.description||"—"}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:H.discordRoleId?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground font-mono bg-secondary/50 px-2 py-0.5 rounded border border-border/50",children:[s.jsx(ge,{icon:bu,size:12,className:"text-primary"}),H.discordRoleId]}):s.jsx("span",{className:"text-xs text-muted-foreground/60",children:"—"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsxs("div",{className:"flex flex-wrap gap-1 max-w-md",children:[((Z=H.permissions)==null?void 0:Z.overview)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20",children:"Overview"}),(((te=H.permissions)==null?void 0:te.tickets)??((_=H.permissions)==null?void 0:_.overview))&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"Tickets"}),((D=H.permissions)==null?void 0:D.transcripts)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20",children:"Transcripts"}),((G=H.permissions)==null?void 0:G.logs)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400 border border-blue-500/20",children:"Logs"}),((F=(V=H.permissions)==null?void 0:V.users)==null?void 0:F.manage)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20",children:"User Mgmt"})]})}),s.jsx("td",{className:"px-4 py-2.5 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsxs(he,{size:"sm",variant:"ghost",className:`h-7 px-2 text-xs gap-1 ${(n==null?void 0:n.id)===H.id?"text-amber-400 font-bold bg-amber-500/15 border border-amber-500/30":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,onClick:()=>(n==null?void 0:n.id)===H.id?a():e(H.id),children:[s.jsx(ge,{icon:bu,size:13}),(n==null?void 0:n.id)===H.id?"Active Preview":"View as Group"]}),!H.isSystem&&s.jsxs(s.Fragment,{children:[s.jsxs(he,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-foreground",onClick:()=>se(H),children:[s.jsx(ge,{icon:a2,size:13}),"Edit"]}),s.jsxs(he,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-destructive",onClick:()=>I(H),children:[s.jsx(ge,{icon:wl,size:13}),"Delete"]})]})]})})]},H.id)})})]})})})}),s.jsx(zl,{open:g,onOpenChange:y,children:s.jsxs(qs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Ks,{children:[s.jsx(Xs,{children:w==="add"?"Create Permission Group":`Edit Group: ${T}`}),s.jsx(Zs,{children:"Configure group metadata, custom color badge, Discord role sync, and permission rules."})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"group-name",children:"Group Name"}),s.jsx(Ie,{id:"group-name",placeholder:"e.g. Support Staff",value:T,onChange:H=>A(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"group-color",children:"Color Badge"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Id,{value:z,onChange:B}),s.jsx(Ie,{value:z,onChange:H=>B(H.target.value),placeholder:"#10B981",className:"w-28 font-mono text-sm uppercase"}),s.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:PB.map(H=>s.jsx("button",{type:"button",className:"size-6 rounded-full border border-white/20 transition-transform hover:scale-110",style:{backgroundColor:H.hex},onClick:()=>B(H.hex),title:H.name},H.hex))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"group-desc",children:"Description"}),s.jsx(Ie,{id:"group-desc",placeholder:"Brief description of what members in this group can access...",value:O,onChange:H=>M(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ze,{htmlFor:"discord-role-id",children:"Discord Role ID (Optional Auto-Sync)"}),s.jsx(Ie,{id:"discord-role-id",placeholder:"e.g. 123456789012345678",value:K,onChange:H=>U(H.target.value)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"If provided, Discord users with this Role ID will automatically inherit this group upon login."})]}),s.jsxs("div",{className:"pt-2",children:[s.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Group Permission Matrix"}),s.jsx(IB,{permissions:q,onChange:ue})]})]}),s.jsxs(Pl,{className:"gap-2 sm:gap-0",children:[s.jsx(he,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),s.jsx(he,{onClick:L,disabled:S,className:"bg-primary",children:S?"Saving...":w==="add"?"Create Group":"Save Changes"})]})]})})]})}function BB({children:e}){const{isAuthenticated:n,loading:a}=Ut();return a?s.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading…"}):n?s.jsx(s.Fragment,{children:e}):s.jsx(Qr,{to:"/login",replace:!0})}function UB(){const{complete:e,loading:n}=Pj(),a=Ln();return n?s.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading…"}):e?a.pathname==="/setup"?s.jsx(Qr,{to:"/login",replace:!0}):s.jsxs(ny,{children:[s.jsx(rn,{path:"/login",element:s.jsx(T$,{})}),s.jsxs(rn,{element:s.jsx(BB,{children:s.jsx(ND,{})}),children:[s.jsx(rn,{index:!0,element:s.jsx(Q$,{})}),s.jsx(rn,{path:"system",element:s.jsx(Kr,{permission:"overview",children:s.jsx(mB,{})})}),s.jsx(rn,{path:"settings",element:s.jsx(Kr,{permission:"settings.view",children:s.jsx(uB,{})})}),s.jsx(rn,{path:"configs",element:s.jsx(N$,{})}),s.jsx(rn,{path:"logs",element:s.jsx(Kr,{permission:"logs",children:s.jsx(wB,{})})}),s.jsx(rn,{path:"tickets",element:s.jsx(Kr,{permission:"transcripts",children:s.jsx(MB,{})})}),s.jsx(rn,{path:"transcripts",element:s.jsx(Kr,{permission:"transcripts",children:s.jsx(AB,{})})}),s.jsx(rn,{path:"users",element:s.jsx(Kr,{permission:"users.view",children:s.jsx(zB,{})})}),s.jsx(rn,{path:"groups",element:s.jsx(Kr,{permission:"users.view",children:s.jsx($B,{})})}),s.jsx(rn,{path:"addons",element:s.jsx(Kr,{permission:"settings.view",children:s.jsx(J$,{})})}),s.jsx(rn,{path:"addons/builder",element:s.jsx(Kr,{permission:"settings.update",children:s.jsx(eB,{})})})]}),s.jsx(rn,{path:"*",element:s.jsx(Qr,{to:"/",replace:!0})})]}):s.jsxs(ny,{children:[s.jsx(rn,{path:"/setup",element:s.jsx(V$,{})}),s.jsx(rn,{path:"*",element:s.jsx(Qr,{to:"/setup",replace:!0})})]})}function HB({...e}){return s.jsx(aI,{theme:"dark",position:"bottom-right",richColors:!0,closeButton:!0,style:{fontFamily:'"Poppins", system-ui, sans-serif'},toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground"}},...e})}oB();E3.createRoot(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(ZE,{children:s.jsx(tS,{children:s.jsx(M8,{children:s.jsx(ED,{children:s.jsxs(A8,{children:[s.jsx(UB,{}),s.jsx(HB,{})]})})})})})})); diff --git a/public/dashboard/assets/index-DW3eyGbF.css b/public/dashboard/assets/index-DW3eyGbF.css deleted file mode 100644 index 881d423..0000000 --- a/public/dashboard/assets/index-DW3eyGbF.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Poppins,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 240 10% 4%;--foreground: 0 0% 98%;--card: 240 7% 11%;--card-foreground: 0 0% 98%;--popover: 240 8% 10%;--popover-foreground: 0 0% 98%;--primary: 141 45% 49%;--primary-foreground: 0 0% 100%;--secondary: 240 6% 14%;--secondary-foreground: 0 0% 90%;--muted: 240 6% 14%;--muted-foreground: 240 5% 55%;--accent: 141 29% 18%;--accent-foreground: 141 52% 78%;--destructive: 0 72% 55%;--destructive-foreground: 0 0% 100%;--border: 240 6% 18%;--input: 240 6% 14%;--ring: 141 45% 49%;--radius: .75rem;--chart-1: 141 45% 49%;--chart-2: 199 89% 48%;--chart-3: 38 92% 50%;--chart-4: 280 65% 60%;--chart-5: 0 72% 55%;--sidebar-background: 240 10% 5%;--sidebar-foreground: 240 5% 90%;--sidebar-primary: 141 45% 49%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 141 26% 14%;--sidebar-accent-foreground: 141 48% 82%;--sidebar-border: 240 6% 14%;--sidebar-ring: 141 45% 49%;--scrollbar-size: 6px;--scrollbar-thumb: 240 4% 32%;--scrollbar-thumb-hover: 240 4% 44%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:Poppins,system-ui,sans-serif;color:hsl(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html{color-scheme:dark}html,body,*{scrollbar-width:thin;scrollbar-color:hsl(var(--scrollbar-thumb)) transparent}*::-webkit-scrollbar{width:var(--scrollbar-size);height:var(--scrollbar-size)}*::-webkit-scrollbar-button{display:none;width:0;height:0}*::-webkit-scrollbar-track{background:transparent}*::-webkit-scrollbar-thumb{background-color:hsl(var(--scrollbar-thumb));border-radius:9999px;border:2px solid transparent;background-clip:content-box}*::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--scrollbar-thumb-hover))}*::-webkit-scrollbar-thumb:active{background-color:hsl(var(--scrollbar-thumb-hover))}*::-webkit-scrollbar-corner{background:transparent}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-0\.5{right:-.125rem}.-top-0\.5{top:-.125rem}.bottom-0{bottom:0}.bottom-full{bottom:100%}.left-0{left:0}.left-2{left:.5rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3{top:.75rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-6{top:1.5rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.m-0{margin:0}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.-ml-1{margin-left:-.25rem}.-ml-2{margin-left:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.size-1\.5{width:.375rem;height:.375rem}.size-10{width:2.5rem;height:2.5rem}.size-11{width:2.75rem;height:2.75rem}.size-12{width:3rem;height:3rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-28{width:7rem;height:7rem}.size-36{width:9rem;height:9rem}.size-4{width:1rem;height:1rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-24{height:6rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-44{height:11rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[50vh\]{height:50vh}.h-\[520px\]{height:520px}.h-\[88vh\]{height:88vh}.h-\[calc\(100svh-8rem\)\]{height:calc(100svh - 8rem)}.h-\[min\(50vh\,320px\)\]{height:min(50vh,320px)}.h-\[min\(520px\,60vh\)\]{height:min(520px,60vh)}.h-\[min\(520px\,calc\(100svh-16rem\)\)\]{height:min(520px,calc(100svh - 16rem))}.h-\[min\(640px\,calc\(100svh-14rem\)\)\]{height:min(640px,calc(100svh - 14rem))}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100svh-18rem\)\]{max-height:calc(100svh - 18rem)}.max-h-\[min\(320px\,50vh\)\]{max-height:min(320px,50vh)}.max-h-\[min\(360px\,50vh\)\]{max-height:min(360px,50vh)}.max-h-\[min\(720px\,calc\(100svh-12rem\)\)\]{max-height:min(720px,calc(100svh - 12rem))}.max-h-\[min\(90vh\,720px\)\]{max-height:min(90vh,720px)}.max-h-\[var\(--radix-dropdown-menu-content-available-height\)\]{max-height:var(--radix-dropdown-menu-content-available-height)}.min-h-0{min-height:0px}.min-h-\[120px\]{min-height:120px}.min-h-\[420px\]{min-height:420px}.min-h-\[480px\]{min-height:480px}.min-h-\[520px\]{min-height:520px}.min-h-\[60px\]{min-height:60px}.min-h-\[88px\]{min-height:88px}.min-h-\[min\(520px\,70vh\)\]{min-height:min(520px,70vh)}.min-h-\[min\(560px\,calc\(100svh-18rem\)\)\]{min-height:min(560px,calc(100svh - 18rem))}.min-h-svh{min-height:100svh}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-2{width:.5rem}.w-2\/3{width:66.666667%}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--radix-dropdown-menu-trigger-width\]{width:var(--radix-dropdown-menu-trigger-width)}.w-\[--sidebar-width\]{width:var(--sidebar-width)}.w-\[160px\]{width:160px}.w-\[1px\]{width:1px}.w-\[calc\(100\%-1rem\)\]{width:calc(100% - 1rem)}.w-\[min\(100\%\,320px\)\]{width:min(100%,320px)}.w-auto{width:auto}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.min-w-5{min-width:1.25rem}.min-w-\[200px\]{min-width:200px}.min-w-\[220px\]{min-width:220px}.min-w-\[280px\]{min-width:280px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[--skeleton-width\]{max-width:var(--skeleton-width)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[432px\]{max-width:432px}.max-w-\[80\%\]{max-width:80%}.max-w-\[8rem\]{max-width:8rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-\[--radix-dropdown-menu-content-transform-origin\]{transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-100\%\]{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-.5rem * var(--tw-space-x-reverse));margin-left:calc(-.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){border-color:hsl(var(--border))}.divide-border\/40>:not([hidden])~:not([hidden]){border-color:hsl(var(--border) / .4)}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-xl{border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-blue-500\/20{border-color:#3b82f633}.border-border{border-color:hsl(var(--border))}.border-border\/20{border-color:hsl(var(--border) / .2)}.border-border\/30{border-color:hsl(var(--border) / .3)}.border-border\/40{border-color:hsl(var(--border) / .4)}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-border\/60{border-color:hsl(var(--border) / .6)}.border-border\/80{border-color:hsl(var(--border) / .8)}.border-card{border-color:hsl(var(--card))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/40{border-color:hsl(var(--destructive) / .4)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-green-500\/20{border-color:#22c55e33}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500\/20{border-color:#a855f733}.border-red-500\/50{border-color:#ef444480}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-sky-500\/40{border-color:#0ea5e966}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-l-\[\#5865F2\]{--tw-border-opacity: 1;border-left-color:rgb(88 101 242 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#0c0c10\]{--tw-bg-opacity: 1;background-color:rgb(12 12 16 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d12\]{--tw-bg-opacity: 1;background-color:rgb(13 13 18 / var(--tw-bg-opacity, 1))}.bg-\[\#2b2d31\]{--tw-bg-opacity: 1;background-color:rgb(43 45 49 / var(--tw-bg-opacity, 1))}.bg-\[\#313338\]{--tw-bg-opacity: 1;background-color:rgb(49 51 56 / var(--tw-bg-opacity, 1))}.bg-\[\#5865F2\]{--tw-bg-opacity: 1;background-color:rgb(88 101 242 / var(--tw-bg-opacity, 1))}.bg-\[hsl\(240_4\%_32\%\)\]{--tw-bg-opacity: 1;background-color:hsl(240 4% 32% / var(--tw-bg-opacity, 1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-background{background-color:hsl(var(--background))}.bg-background\/40{background-color:hsl(var(--background) / .4)}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/65{background-color:#000000a6}.bg-black\/80{background-color:#000c}.bg-blue-500\/10{background-color:#3b82f61a}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/30{background-color:hsl(var(--card) / .3)}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/5{background-color:hsl(var(--destructive) / .05)}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-green-500\/10{background-color:#22c55e1a}.bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground{background-color:hsl(var(--muted-foreground))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/25{background-color:hsl(var(--primary) / .25)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500\/10{background-color:#a855f71a}.bg-red-500\/10{background-color:#ef44441a}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/15{background-color:#f43f5e26}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/10{background-color:hsl(var(--secondary) / .1)}.bg-secondary\/20{background-color:hsl(var(--secondary) / .2)}.bg-secondary\/30{background-color:hsl(var(--secondary) / .3)}.bg-secondary\/40{background-color:hsl(var(--secondary) / .4)}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-secondary\/60{background-color:hsl(var(--secondary) / .6)}.bg-secondary\/80{background-color:hsl(var(--secondary) / .8)}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-accent{background-color:hsl(var(--sidebar-accent))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-500\/10{background-color:#0ea5e91a}.bg-sky-500\/15{background-color:#0ea5e926}.bg-transparent{background-color:transparent}.bg-white\/5{background-color:#ffffff0d}.bg-white\/70{background-color:#ffffffb3}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-500\/10{--tw-gradient-from: rgb(245 158 11 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white\/5{--tw-gradient-from: rgb(255 255 255 / .05) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-amber-500\/15{--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(245 158 11 / .15) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-amber-500\/10{--tw-gradient-to: rgb(245 158 11 / .1) var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-white\/50{--tw-gradient-to: rgb(255 255 255 / .5) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.stroke-white{stroke:#fff}.stroke-white\/20{stroke:#fff3}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-px{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-10{padding-bottom:2.5rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:Poppins,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-6xl{font-size:3.75rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#949ba4\]{--tw-text-opacity: 1;color:rgb(148 155 164 / var(--tw-text-opacity, 1))}.text-\[\#dbdee1\]{--tw-text-opacity: 1;color:rgb(219 222 225 / var(--tw-text-opacity, 1))}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-destructive\/80{color:hsl(var(--destructive) / .8)}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-600\/80{color:#059669cc}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-muted-foreground\/80{color:hsl(var(--muted-foreground) / .8)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-100{--tw-text-opacity: 1;color:rgb(224 242 254 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/30{color:#ffffff4d}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-white\/80{color:#fffc}.text-white\/90{color:#ffffffe6}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_20px_rgba\(var\(--primary\)\,0\.3\)\]{--tw-shadow: 0 0 20px rgba(var(--primary),.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/20{--tw-shadow-color: rgb(0 0 0 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary\/30{--tw-ring-color: hsl(var(--primary) / .3)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-white\/10{--tw-ring-color: rgb(255 255 255 / .1)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-xl{--tw-drop-shadow: drop-shadow(0 20px 13px rgb(0 0 0 / .03)) drop-shadow(0 8px 5px rgb(0 0 0 / .08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-2xl{--tw-backdrop-blur: blur(40px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.color-picker-swatch.react-colorful{width:220px;height:140px}.color-picker-swatch .react-colorful__saturation{border-radius:calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0}.color-picker-swatch .react-colorful__hue{height:12px;border-radius:0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);margin-top:10px}.color-picker-swatch .react-colorful__pointer{width:16px;height:16px}.unicode-emoji-panel-host emoji-picker.unicode-emoji-picker-el{width:100%;height:min(50vh,380px);--background: hsl(var(--card));--border-color: hsl(var(--border));--button-active-background: hsl(var(--primary) / .25);--button-hover-background: hsl(var(--accent));--input-border-color: hsl(var(--border));--input-font-color: hsl(var(--foreground));--input-placeholder-color: hsl(var(--muted-foreground));--outline-color: hsl(var(--ring));--category-font-color: hsl(var(--muted-foreground));--indicator-color: hsl(var(--primary))}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);top:-.5rem;right:-.5rem;bottom:-.5rem;left:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.last\:border-0:last-child{border-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary:hover{border-color:hsl(var(--primary))}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary) / .3)}.hover\:bg-\[hsl\(240_4\%_44\%\)\]:hover{--tw-bg-opacity: 1;background-color:hsl(240 4% 44% / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500\/15:hover{background-color:#10b98126}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/10:hover{background-color:hsl(var(--secondary) / .1)}.hover\:bg-secondary\/25:hover{background-color:hsl(var(--secondary) / .25)}.hover\:bg-secondary\/40:hover{background-color:hsl(var(--secondary) / .4)}.hover\:bg-secondary\/50:hover{background-color:hsl(var(--secondary) / .5)}.hover\:bg-secondary\/60:hover{background-color:hsl(var(--secondary) / .6)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-95:hover{opacity:.95}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(var\(--primary\)\,0\.5\)\]:hover{--tw-shadow: 0 0 30px rgba(var(--primary),.5);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-amber-500\/40:focus{--tw-ring-color: rgb(245 158 11 / .4)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:translate-x-\[100\%\]{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:text-primary{color:hsl(var(--primary))}.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toaster .group-\[\.toaster\]\:bg-card{background-color:hsl(var(--card))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\[data-variant\=inset\]\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.group\/menu-item:has([data-sidebar=menu-action]) .group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8{padding-right:2rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[--sidebar-width-icon\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)\)\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)_\+2px\)\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:text-emerald-400:is(.dark *){--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.dark\:text-emerald-400\/80:is(.dark *){color:#34d399cc}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:inline-flex{display:inline-flex}.sm\:size-32{width:8rem;height:8rem}.sm\:w-auto{width:auto}.sm\:min-w-\[300px\]{min-width:300px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:max-w-xs{max-width:20rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-end{align-items:flex-end}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-56{width:14rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.md\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:px-10{padding-left:2.5rem;padding-right:2.5rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-10{padding-top:2.5rem;padding-bottom:2.5rem}.md\:pb-0{padding-bottom:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.after\:md\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:block{display:block}.lg\:grid{display:grid}.lg\:min-w-0{min-width:0px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[200px_1fr\]{grid-template-columns:200px 1fr}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:grid-cols-\[minmax\(0\,280px\)_1fr\]{grid-template-columns:minmax(0,280px) 1fr}.lg\:grid-cols-\[minmax\(240px\,320px\)_1fr\]{grid-template-columns:minmax(240px,320px) 1fr}.lg\:overflow-visible{overflow:visible}.lg\:p-8{padding:2rem}}@media(min-width:1280px){.xl\:block{display:block}.xl\:grid-cols-\[minmax\(320px\,420px\)_1fr\]{grid-template-columns:minmax(320px,420px) 1fr}.xl\:flex-row{flex-direction:row}.xl\:items-start{align-items:flex-start}}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize} diff --git a/public/dashboard/assets/index-Dx-VdUAO.css b/public/dashboard/assets/index-Dx-VdUAO.css new file mode 100644 index 0000000..39f4acd --- /dev/null +++ b/public/dashboard/assets/index-Dx-VdUAO.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Poppins,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 240 10% 4%;--foreground: 0 0% 98%;--card: 240 7% 11%;--card-foreground: 0 0% 98%;--popover: 240 8% 10%;--popover-foreground: 0 0% 98%;--primary: 141 45% 49%;--primary-foreground: 0 0% 100%;--secondary: 240 6% 14%;--secondary-foreground: 0 0% 90%;--muted: 240 6% 14%;--muted-foreground: 240 5% 55%;--accent: 141 29% 18%;--accent-foreground: 141 52% 78%;--destructive: 0 72% 55%;--destructive-foreground: 0 0% 100%;--border: 240 6% 18%;--input: 240 6% 14%;--ring: 141 45% 49%;--radius: .75rem;--chart-1: 141 45% 49%;--chart-2: 199 89% 48%;--chart-3: 38 92% 50%;--chart-4: 280 65% 60%;--chart-5: 0 72% 55%;--sidebar-background: 240 10% 5%;--sidebar-foreground: 240 5% 90%;--sidebar-primary: 141 45% 49%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 141 26% 14%;--sidebar-accent-foreground: 141 48% 82%;--sidebar-border: 240 6% 14%;--sidebar-ring: 141 45% 49%;--scrollbar-size: 6px;--scrollbar-thumb: 240 4% 32%;--scrollbar-thumb-hover: 240 4% 44%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:Poppins,system-ui,sans-serif;color:hsl(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html{color-scheme:dark}html,body,*{scrollbar-width:thin;scrollbar-color:hsl(var(--scrollbar-thumb)) transparent}*::-webkit-scrollbar{width:var(--scrollbar-size);height:var(--scrollbar-size)}*::-webkit-scrollbar-button{display:none;width:0;height:0}*::-webkit-scrollbar-track{background:transparent}*::-webkit-scrollbar-thumb{background-color:hsl(var(--scrollbar-thumb));border-radius:9999px;border:2px solid transparent;background-clip:content-box}*::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--scrollbar-thumb-hover))}*::-webkit-scrollbar-thumb:active{background-color:hsl(var(--scrollbar-thumb-hover))}*::-webkit-scrollbar-corner{background:transparent}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-0\.5{right:-.125rem}.-top-0\.5{top:-.125rem}.bottom-0{bottom:0}.bottom-full{bottom:100%}.left-0{left:0}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3{top:.75rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-6{top:1.5rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.m-0{margin:0}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.-ml-1{margin-left:-.25rem}.-ml-2{margin-left:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.size-1\.5{width:.375rem;height:.375rem}.size-10{width:2.5rem;height:2.5rem}.size-11{width:2.75rem;height:2.75rem}.size-12{width:3rem;height:3rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-28{width:7rem;height:7rem}.size-36{width:9rem;height:9rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-24{height:6rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-44{height:11rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[50vh\]{height:50vh}.h-\[520px\]{height:520px}.h-\[88vh\]{height:88vh}.h-\[calc\(100svh-8rem\)\]{height:calc(100svh - 8rem)}.h-\[min\(50vh\,320px\)\]{height:min(50vh,320px)}.h-\[min\(520px\,60vh\)\]{height:min(520px,60vh)}.h-\[min\(520px\,calc\(100svh-16rem\)\)\]{height:min(520px,calc(100svh - 16rem))}.h-\[min\(640px\,calc\(100svh-14rem\)\)\]{height:min(640px,calc(100svh - 14rem))}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-48{max-height:12rem}.max-h-56{max-height:14rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100svh-18rem\)\]{max-height:calc(100svh - 18rem)}.max-h-\[min\(320px\,50vh\)\]{max-height:min(320px,50vh)}.max-h-\[min\(360px\,50vh\)\]{max-height:min(360px,50vh)}.max-h-\[min\(720px\,calc\(100svh-12rem\)\)\]{max-height:min(720px,calc(100svh - 12rem))}.max-h-\[min\(90vh\,720px\)\]{max-height:min(90vh,720px)}.max-h-\[var\(--radix-dropdown-menu-content-available-height\)\]{max-height:var(--radix-dropdown-menu-content-available-height)}.min-h-0{min-height:0px}.min-h-\[120px\]{min-height:120px}.min-h-\[420px\]{min-height:420px}.min-h-\[480px\]{min-height:480px}.min-h-\[520px\]{min-height:520px}.min-h-\[60px\]{min-height:60px}.min-h-\[88px\]{min-height:88px}.min-h-\[min\(520px\,70vh\)\]{min-height:min(520px,70vh)}.min-h-\[min\(560px\,calc\(100svh-18rem\)\)\]{min-height:min(560px,calc(100svh - 18rem))}.min-h-svh{min-height:100svh}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-2{width:.5rem}.w-2\/3{width:66.666667%}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--radix-dropdown-menu-trigger-width\]{width:var(--radix-dropdown-menu-trigger-width)}.w-\[--sidebar-width\]{width:var(--sidebar-width)}.w-\[140px\]{width:140px}.w-\[160px\]{width:160px}.w-\[1px\]{width:1px}.w-\[calc\(100\%-1rem\)\]{width:calc(100% - 1rem)}.w-\[min\(100\%\,320px\)\]{width:min(100%,320px)}.w-\[var\(--radix-popover-trigger-width\)\]{width:var(--radix-popover-trigger-width)}.w-auto{width:auto}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.min-w-5{min-width:1.25rem}.min-w-\[200px\]{min-width:200px}.min-w-\[220px\]{min-width:220px}.min-w-\[280px\]{min-width:280px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-\[--skeleton-width\]{max-width:var(--skeleton-width)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[432px\]{max-width:432px}.max-w-\[80\%\]{max-width:80%}.max-w-\[8rem\]{max-width:8rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-\[--radix-dropdown-menu-content-transform-origin\]{transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-100\%\]{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-.5rem * var(--tw-space-x-reverse));margin-left:calc(-.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){border-color:hsl(var(--border))}.divide-border\/40>:not([hidden])~:not([hidden]){border-color:hsl(var(--border) / .4)}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-xl{border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-blue-500\/20{border-color:#3b82f633}.border-border{border-color:hsl(var(--border))}.border-border\/20{border-color:hsl(var(--border) / .2)}.border-border\/30{border-color:hsl(var(--border) / .3)}.border-border\/40{border-color:hsl(var(--border) / .4)}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-border\/60{border-color:hsl(var(--border) / .6)}.border-border\/80{border-color:hsl(var(--border) / .8)}.border-card{border-color:hsl(var(--card))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/40{border-color:hsl(var(--destructive) / .4)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-green-500\/20{border-color:#22c55e33}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500\/20{border-color:#a855f733}.border-red-500\/50{border-color:#ef444480}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-sky-500\/40{border-color:#0ea5e966}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-l-\[\#5865F2\]{--tw-border-opacity: 1;border-left-color:rgb(88 101 242 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#0c0c10\]{--tw-bg-opacity: 1;background-color:rgb(12 12 16 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d12\]{--tw-bg-opacity: 1;background-color:rgb(13 13 18 / var(--tw-bg-opacity, 1))}.bg-\[\#2b2d31\]{--tw-bg-opacity: 1;background-color:rgb(43 45 49 / var(--tw-bg-opacity, 1))}.bg-\[\#313338\]{--tw-bg-opacity: 1;background-color:rgb(49 51 56 / var(--tw-bg-opacity, 1))}.bg-\[\#5865F2\]{--tw-bg-opacity: 1;background-color:rgb(88 101 242 / var(--tw-bg-opacity, 1))}.bg-\[hsl\(240_4\%_32\%\)\]{--tw-bg-opacity: 1;background-color:hsl(240 4% 32% / var(--tw-bg-opacity, 1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-background{background-color:hsl(var(--background))}.bg-background\/40{background-color:hsl(var(--background) / .4)}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/65{background-color:#000000a6}.bg-black\/80{background-color:#000c}.bg-blue-500\/10{background-color:#3b82f61a}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/30{background-color:hsl(var(--card) / .3)}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/60{background-color:hsl(var(--card) / .6)}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/5{background-color:hsl(var(--destructive) / .05)}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-green-500\/10{background-color:#22c55e1a}.bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground{background-color:hsl(var(--muted-foreground))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/25{background-color:hsl(var(--primary) / .25)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500\/10{background-color:#a855f71a}.bg-red-500\/10{background-color:#ef44441a}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/15{background-color:#f43f5e26}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/10{background-color:hsl(var(--secondary) / .1)}.bg-secondary\/20{background-color:hsl(var(--secondary) / .2)}.bg-secondary\/30{background-color:hsl(var(--secondary) / .3)}.bg-secondary\/40{background-color:hsl(var(--secondary) / .4)}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-secondary\/60{background-color:hsl(var(--secondary) / .6)}.bg-secondary\/80{background-color:hsl(var(--secondary) / .8)}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-accent{background-color:hsl(var(--sidebar-accent))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-500\/10{background-color:#0ea5e91a}.bg-sky-500\/15{background-color:#0ea5e926}.bg-transparent{background-color:transparent}.bg-white\/5{background-color:#ffffff0d}.bg-white\/70{background-color:#ffffffb3}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-500\/10{--tw-gradient-from: rgb(245 158 11 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white\/5{--tw-gradient-from: rgb(255 255 255 / .05) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-amber-500\/15{--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(245 158 11 / .15) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-amber-500\/10{--tw-gradient-to: rgb(245 158 11 / .1) var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-white\/50{--tw-gradient-to: rgb(255 255 255 / .5) var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.stroke-white{stroke:#fff}.stroke-white\/20{stroke:#fff3}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-px{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-10{padding-bottom:2.5rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:Poppins,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-6xl{font-size:3.75rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#949ba4\]{--tw-text-opacity: 1;color:rgb(148 155 164 / var(--tw-text-opacity, 1))}.text-\[\#dbdee1\]{--tw-text-opacity: 1;color:rgb(219 222 225 / var(--tw-text-opacity, 1))}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-destructive\/80{color:hsl(var(--destructive) / .8)}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-600\/80{color:#059669cc}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-muted-foreground\/80{color:hsl(var(--muted-foreground) / .8)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-100{--tw-text-opacity: 1;color:rgb(224 242 254 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/30{color:#ffffff4d}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-white\/80{color:#fffc}.text-white\/90{color:#ffffffe6}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_20px_rgba\(var\(--primary\)\,0\.3\)\]{--tw-shadow: 0 0 20px rgba(var(--primary),.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/20{--tw-shadow-color: rgb(0 0 0 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-primary\/30{--tw-ring-color: hsl(var(--primary) / .3)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-white\/10{--tw-ring-color: rgb(255 255 255 / .1)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-xl{--tw-drop-shadow: drop-shadow(0 20px 13px rgb(0 0 0 / .03)) drop-shadow(0 8px 5px rgb(0 0 0 / .08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-2xl{--tw-backdrop-blur: blur(40px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.color-picker-swatch.react-colorful{width:220px;height:140px}.color-picker-swatch .react-colorful__saturation{border-radius:calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0}.color-picker-swatch .react-colorful__hue{height:12px;border-radius:0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);margin-top:10px}.color-picker-swatch .react-colorful__pointer{width:16px;height:16px}.unicode-emoji-panel-host emoji-picker.unicode-emoji-picker-el{width:100%;height:min(50vh,380px);--background: hsl(var(--card));--border-color: hsl(var(--border));--button-active-background: hsl(var(--primary) / .25);--button-hover-background: hsl(var(--accent));--input-border-color: hsl(var(--border));--input-font-color: hsl(var(--foreground));--input-placeholder-color: hsl(var(--muted-foreground));--outline-color: hsl(var(--ring));--category-font-color: hsl(var(--muted-foreground));--indicator-color: hsl(var(--primary))}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);top:-.5rem;right:-.5rem;bottom:-.5rem;left:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.last\:border-0:last-child{border-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary:hover{border-color:hsl(var(--primary))}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary) / .3)}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary) / .4)}.hover\:bg-\[hsl\(240_4\%_44\%\)\]:hover{--tw-bg-opacity: 1;background-color:hsl(240 4% 44% / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500\/15:hover{background-color:#10b98126}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/10:hover{background-color:hsl(var(--secondary) / .1)}.hover\:bg-secondary\/25:hover{background-color:hsl(var(--secondary) / .25)}.hover\:bg-secondary\/40:hover{background-color:hsl(var(--secondary) / .4)}.hover\:bg-secondary\/50:hover{background-color:hsl(var(--secondary) / .5)}.hover\:bg-secondary\/60:hover{background-color:hsl(var(--secondary) / .6)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-95:hover{opacity:.95}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[0_0_30px_rgba\(var\(--primary\)\,0\.5\)\]:hover{--tw-shadow: 0 0 30px rgba(var(--primary),.5);--tw-shadow-colored: 0 0 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-amber-500\/40:focus{--tw-ring-color: rgb(245 158 11 / .4)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:translate-x-\[100\%\]{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:text-primary{color:hsl(var(--primary))}.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toaster .group-\[\.toaster\]\:bg-card{background-color:hsl(var(--card))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\[data-variant\=inset\]\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.group\/menu-item:has([data-sidebar=menu-action]) .group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8{padding-right:2rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[--sidebar-width-icon\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)\)\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)_\+2px\)\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:text-emerald-400:is(.dark *){--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.dark\:text-emerald-400\/80:is(.dark *){color:#34d399cc}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:inline-flex{display:inline-flex}.sm\:size-32{width:8rem;height:8rem}.sm\:w-auto{width:auto}.sm\:min-w-\[300px\]{min-width:300px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:max-w-\[450px\]{max-width:450px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:max-w-xs{max-width:20rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-end{align-items:flex-end}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-56{width:14rem}.md\:w-80{width:20rem}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.md\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:px-10{padding-left:2.5rem;padding-right:2.5rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-10{padding-top:2.5rem;padding-bottom:2.5rem}.md\:pb-0{padding-bottom:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.after\:md\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:block{display:block}.lg\:grid{display:grid}.lg\:min-w-0{min-width:0px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[200px_1fr\]{grid-template-columns:200px 1fr}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:grid-cols-\[minmax\(0\,280px\)_1fr\]{grid-template-columns:minmax(0,280px) 1fr}.lg\:grid-cols-\[minmax\(240px\,320px\)_1fr\]{grid-template-columns:minmax(240px,320px) 1fr}.lg\:overflow-visible{overflow:visible}.lg\:p-8{padding:2rem}}@media(min-width:1280px){.xl\:block{display:block}.xl\:grid-cols-\[minmax\(320px\,420px\)_1fr\]{grid-template-columns:minmax(320px,420px) 1fr}.xl\:flex-row{flex-direction:row}.xl\:items-start{align-items:flex-start}}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize} diff --git a/public/dashboard/assets/index-xYh1zX07.js b/public/dashboard/assets/index-xYh1zX07.js new file mode 100644 index 0000000..88ecbca --- /dev/null +++ b/public/dashboard/assets/index-xYh1zX07.js @@ -0,0 +1,180 @@ +var w3=Object.defineProperty;var xy=t=>{throw TypeError(t)};var j3=(t,n,a)=>n in t?w3(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var vy=(t,n,a)=>j3(t,typeof n!="symbol"?n+"":n,a),by=(t,n,a)=>n.has(t)||xy("Cannot "+a);var pn=(t,n,a)=>(by(t,n,"read from private field"),a?a.call(t):n.get(t)),yy=(t,n,a)=>n.has(t)?xy("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,a),dp=(t,n,a,o)=>(by(t,n,"write to private field"),o?o.call(t,a):n.set(t,a),a);function C3(t,n){for(var a=0;ao[c]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const l of c)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function a(c){const l={};return c.integrity&&(l.integrity=c.integrity),c.referrerPolicy&&(l.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?l.credentials="include":c.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function o(c){if(c.ep)return;c.ep=!0;const l=a(c);fetch(c.href,l)}})();function s2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fp={exports:{}},Sl={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var wy;function S3(){if(wy)return Sl;wy=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(o,c,l){var d=null;if(l!==void 0&&(d=""+l),c.key!==void 0&&(d=""+c.key),"key"in c){l={};for(var m in c)m!=="key"&&(l[m]=c[m])}else l=c;return c=l.ref,{$$typeof:t,type:o,key:d,ref:c!==void 0?c:null,props:l}}return Sl.Fragment=n,Sl.jsx=a,Sl.jsxs=a,Sl}var jy;function N3(){return jy||(jy=1,fp.exports=S3()),fp.exports}var s=N3(),mp={exports:{}},Pe={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cy;function E3(){if(Cy)return Pe;Cy=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),w=Symbol.iterator;function y(O){return O===null||typeof O!="object"?null:(O=w&&O[w]||O["@@iterator"],typeof O=="function"?O:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function k(O,D,$){this.props=O,this.context=D,this.refs=E,this.updater=$||C}k.prototype.isReactComponent={},k.prototype.setState=function(O,D){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,D,"setState")},k.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function N(){}N.prototype=k.prototype;function T(O,D,$){this.props=O,this.context=D,this.refs=E,this.updater=$||C}var M=T.prototype=new N;M.constructor=T,S(M,k.prototype),M.isPureReactComponent=!0;var _=Array.isArray;function R(){}var L={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function K(O,D,$){var H=$.ref;return{$$typeof:t,type:O,key:D,ref:H!==void 0?H:null,props:$}}function I(O,D){return K(O.type,D,O.props)}function G(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Y(O){var D={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function($){return D[$]})}var ce=/\/+/g;function fe(O,D){return typeof O=="object"&&O!==null&&O.key!=null?Y(""+O.key):D.toString(36)}function se(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(R,R):(O.status="pending",O.then(function(D){O.status==="pending"&&(O.status="fulfilled",O.value=D)},function(D){O.status==="pending"&&(O.status="rejected",O.reason=D)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function P(O,D,$,H,X){var xe=typeof O;(xe==="undefined"||xe==="boolean")&&(O=null);var q=!1;if(O===null)q=!0;else switch(xe){case"bigint":case"string":case"number":q=!0;break;case"object":switch(O.$$typeof){case t:case n:q=!0;break;case v:return q=O._init,P(q(O._payload),D,$,H,X)}}if(q)return X=X(O),q=H===""?"."+fe(O,0):H,_(X)?($="",q!=null&&($=q.replace(ce,"$&/")+"/"),P(X,D,$,"",function(B){return B})):X!=null&&(G(X)&&(X=I(X,$+(X.key==null||O&&O.key===X.key?"":(""+X.key).replace(ce,"$&/")+"/")+q)),D.push(X)),1;q=0;var ge=H===""?".":H+":";if(_(O))for(var me=0;me>>1,V=P[re];if(0>>1;rec($,ae))Hc(X,$)?(P[re]=X,P[H]=ae,re=H):(P[re]=$,P[D]=ae,re=D);else if(Hc(X,ae))P[re]=X,P[H]=ae,re=H;else break e}}return Z}function c(P,Z){var ae=P.sortIndex-Z.sortIndex;return ae!==0?ae:P.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var d=Date,m=d.now();t.unstable_now=function(){return d.now()-m}}var p=[],g=[],v=1,b=null,w=3,y=!1,C=!1,S=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function M(P){for(var Z=a(g);Z!==null;){if(Z.callback===null)o(g);else if(Z.startTime<=P)o(g),Z.sortIndex=Z.expirationTime,n(p,Z);else break;Z=a(g)}}function _(P){if(S=!1,M(P),!C)if(a(p)!==null)C=!0,R||(R=!0,Y());else{var Z=a(g);Z!==null&&se(_,Z.startTime-P)}}var R=!1,L=-1,te=5,K=-1;function I(){return E?!0:!(t.unstable_now()-KP&&I());){var re=b.callback;if(typeof re=="function"){b.callback=null,w=b.priorityLevel;var V=re(b.expirationTime<=P);if(P=t.unstable_now(),typeof V=="function"){b.callback=V,M(P),Z=!0;break t}b===a(p)&&o(p),M(P)}else o(p);b=a(p)}if(b!==null)Z=!0;else{var O=a(g);O!==null&&se(_,O.startTime-P),Z=!1}}break e}finally{b=null,w=ae,y=!1}Z=void 0}}finally{Z?Y():R=!1}}}var Y;if(typeof T=="function")Y=function(){T(G)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,fe=ce.port2;ce.port1.onmessage=G,Y=function(){fe.postMessage(null)}}else Y=function(){k(G,0)};function se(P,Z){L=k(function(){P(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125re?(P.sortIndex=ae,n(g,P),a(p)===null&&P===a(g)&&(S?(N(L),L=-1):S=!0,se(_,ae-re))):(P.sortIndex=V,n(p,P),C||y||(C=!0,R||(R=!0,Y()))),P},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(P){var Z=w;return function(){var ae=w;w=Z;try{return P.apply(this,arguments)}finally{w=ae}}}})(gp)),gp}var Ey;function T3(){return Ey||(Ey=1,hp.exports=k3()),hp.exports}var xp={exports:{}},hn={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ky;function M3(){if(ky)return hn;ky=1;var t=Xh();function n(p){var g="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),xp.exports=M3(),xp.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var My;function R3(){if(My)return Nl;My=1;var t=T3(),n=Xh(),a=o2();function o(e){var r="https://react.dev/errors/"+e;if(1V||(e.current=re[V],re[V]=null,V--)}function $(e,r){V++,re[V]=e.current,e.current=r}var H=O(null),X=O(null),xe=O(null),q=O(null);function ge(e,r){switch($(xe,r),$(X,e),$(H,null),r.nodeType){case 9:case 11:e=(e=r.documentElement)&&(e=e.namespaceURI)?Bb(e):0;break;default:if(e=r.tagName,r=r.namespaceURI)r=Bb(r),e=$b(r,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}D(H),$(H,e)}function me(){D(H),D(X),D(xe)}function B(e){e.memoizedState!==null&&$(q,e);var r=H.current,i=$b(r,e.type);r!==i&&($(X,e),$(H,i))}function ie(e){X.current===e&&(D(H),D(X)),q.current===e&&(D(q),yl._currentValue=ae)}var we,Ce;function ze(e){if(we===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);we=r&&r[1]||"",Ce=-1)":-1h||z[u]!==J[h]){var le=` +`+z[u].replace(" at new "," at ");return e.displayName&&le.includes("")&&(le=le.replace("",e.displayName)),le}while(1<=u&&0<=h);break}}}finally{Ke=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ze(i):""}function Pt(e,r){switch(e.tag){case 26:case 27:case 5:return ze(e.type);case 16:return ze("Lazy");case 13:return e.child!==r&&r!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return ft(e.type,!1);case 11:return ft(e.type.render,!1);case 1:return ft(e.type,!0);case 31:return ze("Activity");default:return""}}function gn(e){try{var r="",i=null;do r+=Pt(e,i),i=e,e=e.return;while(e);return r}catch(u){return` +Error generating stack: `+u.message+` +`+u.stack}}var Yr=Object.prototype.hasOwnProperty,_n=t.unstable_scheduleCallback,wn=t.unstable_cancelCallback,Xn=t.unstable_shouldYield,Zn=t.unstable_requestPaint,It=t.unstable_now,po=t.unstable_getCurrentPriorityLevel,nn=t.unstable_ImmediatePriority,Dn=t.unstable_UserBlockingPriority,Da=t.unstable_NormalPriority,ho=t.unstable_LowPriority,Qn=t.unstable_IdlePriority,Es=t.log,qr=t.unstable_setDisableYieldValue,gr=null,Tt=null;function On(e){if(typeof Es=="function"&&qr(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(gr,e)}catch{}}var Mt=Math.clz32?Math.clz32:go,Oi=Math.log,Li=Math.LN2;function go(e){return e>>>=0,e===0?32:31-(Oi(e)/Li|0)|0}var Kr=256,Oa=262144,Mr=4194304;function Kt(e){var r=e&42;if(r!==0)return r;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function La(e,r,i){var u=e.pendingLanes;if(u===0)return 0;var h=0,x=e.suspendedLanes,j=e.pingedLanes;e=e.warmLanes;var A=u&134217727;return A!==0?(u=A&~x,u!==0?h=Kt(u):(j&=A,j!==0?h=Kt(j):i||(i=A&~e,i!==0&&(h=Kt(i))))):(A=u&~x,A!==0?h=Kt(A):j!==0?h=Kt(j):i||(i=u&~e,i!==0&&(h=Kt(i)))),h===0?0:r!==0&&r!==h&&(r&x)===0&&(x=h&-h,i=r&-r,x>=i||x===32&&(i&4194048)!==0)?r:h}function Oe(e,r){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&r)===0}function tt(e,r){switch(e){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function it(){var e=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),e}function rn(e){for(var r=[],i=0;31>i;i++)r.push(e);return r}function Ft(e,r){e.pendingLanes|=r,r!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Rt(e,r,i,u,h,x){var j=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var A=e.entanglements,z=e.expirationTimes,J=e.hiddenUpdates;for(i=j&~i;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var h5=/[\n"\\]/g;function tr(e){return e.replace(h5,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function af(e,r,i,u,h,x,j,A){e.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.type=j:e.removeAttribute("type"),r!=null?j==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+er(r)):e.value!==""+er(r)&&(e.value=""+er(r)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),r!=null?sf(e,j,er(r)):i!=null?sf(e,j,er(i)):u!=null&&e.removeAttribute("value"),h==null&&x!=null&&(e.defaultChecked=!!x),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+er(A):e.removeAttribute("name")}function Ox(e,r,i,u,h,x,j,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),r!=null||i!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){rf(e);return}i=i!=null?""+er(i):"",r=r!=null?""+er(r):i,A||r===e.value||(e.value=r),e.defaultValue=r}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,e.checked=A?e.checked:!!u,e.defaultChecked=!!u,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),rf(e)}function sf(e,r,i){r==="number"&&xc(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function wo(e,r,i,u){if(e=e.options,r){r={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),df=!1;if(Jr)try{var Ii={};Object.defineProperty(Ii,"passive",{get:function(){df=!0}}),window.addEventListener("test",Ii,Ii),window.removeEventListener("test",Ii,Ii)}catch{df=!1}var za=null,ff=null,bc=null;function $x(){if(bc)return bc;var e,r=ff,i=r.length,u,h="value"in za?za.value:za.textContent,x=h.length;for(e=0;e=$i),qx=" ",Kx=!1;function Wx(e,r){switch(e){case"keyup":return G5.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var No=!1;function F5(e,r){switch(e){case"compositionend":return Xx(r);case"keypress":return r.which!==32?null:(Kx=!0,qx);case"textInput":return e=r.data,e===qx&&Kx?null:e;default:return null}}function Y5(e,r){if(No)return e==="compositionend"||!xf&&Wx(e,r)?(e=$x(),bc=ff=za=null,No=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:i,offset:r-e};e=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=a1(i)}}function o1(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?o1(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function i1(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var r=xc(e.document);r instanceof e.HTMLIFrameElement;){try{var i=typeof r.contentWindow.location.href=="string"}catch{i=!1}if(i)e=r.contentWindow;else break;r=xc(e.document)}return r}function yf(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}var e4=Jr&&"documentMode"in document&&11>=document.documentMode,Eo=null,wf=null,Fi=null,jf=!1;function l1(e,r,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;jf||Eo==null||Eo!==xc(u)||(u=Eo,"selectionStart"in u&&yf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Fi&&Vi(Fi,u)||(Fi=u,u=fu(wf,"onSelect"),0>=j,h-=j,Ar=1<<32-Mt(r)+h|i<$e?(Xe=ke,ke=null):Xe=ke.sibling;var at=ee(F,ke,Q[$e],de);if(at===null){ke===null&&(ke=Xe);break}e&&ke&&at.alternate===null&&r(F,ke),U=x(at,U,$e),rt===null?Ae=at:rt.sibling=at,rt=at,ke=Xe}if($e===Q.length)return i(F,ke),Je&&ta(F,$e),Ae;if(ke===null){for(;$e$e?(Xe=ke,ke=null):Xe=ke.sibling;var as=ee(F,ke,at.value,de);if(as===null){ke===null&&(ke=Xe);break}e&&ke&&as.alternate===null&&r(F,ke),U=x(as,U,$e),rt===null?Ae=as:rt.sibling=as,rt=as,ke=Xe}if(at.done)return i(F,ke),Je&&ta(F,$e),Ae;if(ke===null){for(;!at.done;$e++,at=Q.next())at=he(F,at.value,de),at!==null&&(U=x(at,U,$e),rt===null?Ae=at:rt.sibling=at,rt=at);return Je&&ta(F,$e),Ae}for(ke=u(ke);!at.done;$e++,at=Q.next())at=ne(ke,F,$e,at.value,de),at!==null&&(e&&at.alternate!==null&&ke.delete(at.key===null?$e:at.key),U=x(at,U,$e),rt===null?Ae=at:rt.sibling=at,rt=at);return e&&ke.forEach(function(y3){return r(F,y3)}),Je&&ta(F,$e),Ae}function gt(F,U,Q,de){if(typeof Q=="object"&&Q!==null&&Q.type===S&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Ae=Q.key;U!==null;){if(U.key===Ae){if(Ae=Q.type,Ae===S){if(U.tag===7){i(F,U.sibling),de=h(U,Q.props.children),de.return=F,F=de;break e}}else if(U.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===te&&Ps(Ae)===U.type){i(F,U.sibling),de=h(U,Q.props),Zi(de,Q),de.return=F,F=de;break e}i(F,U);break}else r(F,U);U=U.sibling}Q.type===S?(de=_s(Q.props.children,F.mode,de,Q.key),de.return=F,F=de):(de=Mc(Q.type,Q.key,Q.props,null,F.mode,de),Zi(de,Q),de.return=F,F=de)}return j(F);case C:e:{for(Ae=Q.key;U!==null;){if(U.key===Ae)if(U.tag===4&&U.stateNode.containerInfo===Q.containerInfo&&U.stateNode.implementation===Q.implementation){i(F,U.sibling),de=h(U,Q.children||[]),de.return=F,F=de;break e}else{i(F,U);break}else r(F,U);U=U.sibling}de=Mf(Q,F.mode,de),de.return=F,F=de}return j(F);case te:return Q=Ps(Q),gt(F,U,Q,de)}if(se(Q))return Ee(F,U,Q,de);if(Y(Q)){if(Ae=Y(Q),typeof Ae!="function")throw Error(o(150));return Q=Ae.call(Q),Le(F,U,Q,de)}if(typeof Q.then=="function")return gt(F,U,zc(Q),de);if(Q.$$typeof===T)return gt(F,U,_c(F,Q),de);Pc(F,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,U!==null&&U.tag===6?(i(F,U.sibling),de=h(U,Q),de.return=F,F=de):(i(F,U),de=Tf(Q,F.mode,de),de.return=F,F=de),j(F)):i(F,U)}return function(F,U,Q,de){try{Xi=0;var Ae=gt(F,U,Q,de);return Po=null,Ae}catch(ke){if(ke===zo||ke===Oc)throw ke;var rt=Pn(29,ke,null,F.mode);return rt.lanes=de,rt.return=F,rt}finally{}}}var Us=A1(!0),_1=A1(!1),$a=!1;function $f(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hf(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,r,i){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,(ot&2)!==0){var h=u.pending;return h===null?r.next=r:(r.next=h.next,h.next=r),u.pending=r,r=Tc(e),h1(e,null,i),r}return kc(e,u,r,i),Tc(e)}function Qi(e,r,i){if(r=r.updateQueue,r!==null&&(r=r.shared,(i&4194048)!==0)){var u=r.lanes;u&=e.pendingLanes,i|=u,r.lanes=i,fn(e,i)}}function Gf(e,r){var i=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var h=null,x=null;if(i=i.firstBaseUpdate,i!==null){do{var j={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};x===null?h=x=j:x=x.next=j,i=i.next}while(i!==null);x===null?h=x=r:x=x.next=r}else h=x=r;i={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=r:e.next=r,i.lastBaseUpdate=r}var Vf=!1;function Ji(){if(Vf){var e=Lo;if(e!==null)throw e}}function el(e,r,i,u){Vf=!1;var h=e.updateQueue;$a=!1;var x=h.firstBaseUpdate,j=h.lastBaseUpdate,A=h.shared.pending;if(A!==null){h.shared.pending=null;var z=A,J=z.next;z.next=null,j===null?x=J:j.next=J,j=z;var le=e.alternate;le!==null&&(le=le.updateQueue,A=le.lastBaseUpdate,A!==j&&(A===null?le.firstBaseUpdate=J:A.next=J,le.lastBaseUpdate=z))}if(x!==null){var he=h.baseState;j=0,le=J=z=null,A=x;do{var ee=A.lane&-536870913,ne=ee!==A.lane;if(ne?(We&ee)===ee:(u&ee)===ee){ee!==0&&ee===Oo&&(Vf=!0),le!==null&&(le=le.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ee=e,Le=A;ee=r;var gt=i;switch(Le.tag){case 1:if(Ee=Le.payload,typeof Ee=="function"){he=Ee.call(gt,he,ee);break e}he=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Le.payload,ee=typeof Ee=="function"?Ee.call(gt,he,ee):Ee,ee==null)break e;he=b({},he,ee);break e;case 2:$a=!0}}ee=A.callback,ee!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=h.callbacks,ne===null?h.callbacks=[ee]:ne.push(ee))}else ne={lane:ee,tag:A.tag,payload:A.payload,callback:A.callback,next:null},le===null?(J=le=ne,z=he):le=le.next=ne,j|=ee;if(A=A.next,A===null){if(A=h.shared.pending,A===null)break;ne=A,A=ne.next,ne.next=null,h.lastBaseUpdate=ne,h.shared.pending=null}}while(!0);le===null&&(z=he),h.baseState=z,h.firstBaseUpdate=J,h.lastBaseUpdate=le,x===null&&(h.shared.lanes=0),Ka|=j,e.lanes=j,e.memoizedState=he}}function D1(e,r){if(typeof e!="function")throw Error(o(191,e));e.call(r)}function O1(e,r){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;ex?x:8;var j=P.T,A={};P.T=A,cm(e,!1,r,i);try{var z=h(),J=P.S;if(J!==null&&J(A,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var le=c4(z,u);rl(e,r,le,Hn(e))}else rl(e,r,u,Hn(e))}catch(he){rl(e,r,{then:function(){},status:"rejected",reason:he},Hn())}finally{Z.p=x,j!==null&&A.types!==null&&(j.types=A.types),P.T=j}}function h4(){}function im(e,r,i,u){if(e.tag!==5)throw Error(o(476));var h=fv(e).queue;dv(e,h,r,ae,i===null?h4:function(){return mv(e),i(u)})}function fv(e){var r=e.memoizedState;if(r!==null)return r;r={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:ae},next:null};var i={};return r.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:i},next:null},e.memoizedState=r,e=e.alternate,e!==null&&(e.memoizedState=r),r}function mv(e){var r=fv(e);r.next===null&&(r=e.alternate.memoizedState),rl(e,r.next.queue,{},Hn())}function lm(){return sn(yl)}function pv(){return zt().memoizedState}function hv(){return zt().memoizedState}function g4(e){for(var r=e.return;r!==null;){switch(r.tag){case 24:case 3:var i=Hn();e=Ha(i);var u=Ga(r,e,i);u!==null&&(kn(u,r,i),Qi(u,r,i)),r={cache:Pf()},e.payload=r;return}r=r.return}}function x4(e,r,i){var u=Hn();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},qc(e)?xv(r,i):(i=Ef(e,r,i,u),i!==null&&(kn(i,e,u),vv(i,r,u)))}function gv(e,r,i){var u=Hn();rl(e,r,i,u)}function rl(e,r,i,u){var h={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(qc(e))xv(r,h);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var j=r.lastRenderedState,A=x(j,i);if(h.hasEagerState=!0,h.eagerState=A,zn(A,j))return kc(e,r,h,0),xt===null&&Ec(),!1}catch{}finally{}if(i=Ef(e,r,h,u),i!==null)return kn(i,e,u),vv(i,r,u),!0}return!1}function cm(e,r,i,u){if(u={lane:2,revertLane:$m(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},qc(e)){if(r)throw Error(o(479))}else r=Ef(e,i,u,2),r!==null&&kn(r,e,2)}function qc(e){var r=e.alternate;return e===Ue||r!==null&&r===Ue}function xv(e,r){Uo=Bc=!0;var i=e.pending;i===null?r.next=r:(r.next=i.next,i.next=r),e.pending=r}function vv(e,r,i){if((i&4194048)!==0){var u=r.lanes;u&=e.pendingLanes,i|=u,r.lanes=i,fn(e,i)}}var al={readContext:sn,use:Gc,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};al.useEffectEvent=At;var bv={readContext:sn,use:Gc,useCallback:function(e,r){return vn().memoizedState=[e,r===void 0?null:r],e},useContext:sn,useEffect:nv,useImperativeHandle:function(e,r,i){i=i!=null?i.concat([e]):null,Fc(4194308,4,ov.bind(null,r,e),i)},useLayoutEffect:function(e,r){return Fc(4194308,4,e,r)},useInsertionEffect:function(e,r){Fc(4,2,e,r)},useMemo:function(e,r){var i=vn();r=r===void 0?null:r;var u=e();if(Bs){On(!0);try{e()}finally{On(!1)}}return i.memoizedState=[u,r],u},useReducer:function(e,r,i){var u=vn();if(i!==void 0){var h=i(r);if(Bs){On(!0);try{i(r)}finally{On(!1)}}}else h=r;return u.memoizedState=u.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},u.queue=e,e=e.dispatch=x4.bind(null,Ue,e),[u.memoizedState,e]},useRef:function(e){var r=vn();return e={current:e},r.memoizedState=e},useState:function(e){e=nm(e);var r=e.queue,i=gv.bind(null,Ue,r);return r.dispatch=i,[e.memoizedState,i]},useDebugValue:sm,useDeferredValue:function(e,r){var i=vn();return om(i,e,r)},useTransition:function(){var e=nm(!1);return e=dv.bind(null,Ue,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,r,i){var u=Ue,h=vn();if(Je){if(i===void 0)throw Error(o(407));i=i()}else{if(i=r(),xt===null)throw Error(o(349));(We&127)!==0||B1(u,r,i)}h.memoizedState=i;var x={value:i,getSnapshot:r};return h.queue=x,nv(H1.bind(null,u,x,e),[e]),u.flags|=2048,$o(9,{destroy:void 0},$1.bind(null,u,x,i,r),null),i},useId:function(){var e=vn(),r=xt.identifierPrefix;if(Je){var i=_r,u=Ar;i=(u&~(1<<32-Mt(u)-1)).toString(32)+i,r="_"+r+"R_"+i,i=$c++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?j.createElement("select",{is:u.is}):j.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?j.createElement(h,{is:u.is}):j.createElement(h)}}x[ye]=r,x[Re]=u;e:for(j=r.child;j!==null;){if(j.tag===5||j.tag===6)x.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===r)break e;for(;j.sibling===null;){if(j.return===null||j.return===r)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}r.stateNode=x;e:switch(ln(x,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&ia(r)}}return wt(r),Cm(r,r.type,e===null?null:e.memoizedProps,r.pendingProps,i),null;case 6:if(e&&r.stateNode!=null)e.memoizedProps!==u&&ia(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(o(166));if(e=xe.current,_o(r)){if(e=r.stateNode,i=r.memoizedProps,u=null,h=an,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}e[ye]=r,e=!!(e.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Ib(e.nodeValue,i)),e||Ua(r,!0)}else e=mu(e).createTextNode(u),e[ye]=r,r.stateNode=e}return wt(r),null;case 31:if(i=r.memoizedState,e===null||e.memoizedState!==null){if(u=_o(r),i!==null){if(e===null){if(!u)throw Error(o(318));if(e=r.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[ye]=r}else Ds(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;wt(r),e=!1}else i=Df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return r.flags&256?(Un(r),r):(Un(r),null);if((r.flags&128)!==0)throw Error(o(558))}return wt(r),null;case 13:if(u=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=_o(r),u!==null&&u.dehydrated!==null){if(e===null){if(!h)throw Error(o(318));if(h=r.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(o(317));h[ye]=r}else Ds(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;wt(r),h=!1}else h=Df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return r.flags&256?(Un(r),r):(Un(r),null)}return Un(r),(r.flags&128)!==0?(r.lanes=i,r):(i=u!==null,e=e!==null&&e.memoizedState!==null,i&&(u=r.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==h&&(u.flags|=2048)),i!==e&&i&&(r.child.flags|=8192),Qc(r,r.updateQueue),wt(r),null);case 4:return me(),e===null&&Fm(r.stateNode.containerInfo),wt(r),null;case 10:return ra(r.type),wt(r),null;case 19:if(D(Lt),u=r.memoizedState,u===null)return wt(r),null;if(h=(r.flags&128)!==0,x=u.rendering,x===null)if(h)ol(u,!1);else{if(_t!==0||e!==null&&(e.flags&128)!==0)for(e=r.child;e!==null;){if(x=Uc(e),x!==null){for(r.flags|=128,ol(u,!1),e=x.updateQueue,r.updateQueue=e,Qc(r,e),r.subtreeFlags=0,e=i,i=r.child;i!==null;)g1(i,e),i=i.sibling;return $(Lt,Lt.current&1|2),Je&&ta(r,u.treeForkCount),r.child}e=e.sibling}u.tail!==null&&It()>ru&&(r.flags|=128,h=!0,ol(u,!1),r.lanes=4194304)}else{if(!h)if(e=Uc(x),e!==null){if(r.flags|=128,h=!0,e=e.updateQueue,r.updateQueue=e,Qc(r,e),ol(u,!0),u.tail===null&&u.tailMode==="hidden"&&!x.alternate&&!Je)return wt(r),null}else 2*It()-u.renderingStartTime>ru&&i!==536870912&&(r.flags|=128,h=!0,ol(u,!1),r.lanes=4194304);u.isBackwards?(x.sibling=r.child,r.child=x):(e=u.last,e!==null?e.sibling=x:r.child=x,u.last=x)}return u.tail!==null?(e=u.tail,u.rendering=e,u.tail=e.sibling,u.renderingStartTime=It(),e.sibling=null,i=Lt.current,$(Lt,h?i&1|2:i&1),Je&&ta(r,u.treeForkCount),e):(wt(r),null);case 22:case 23:return Un(r),Yf(),u=r.memoizedState!==null,e!==null?e.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(i&536870912)!==0&&(r.flags&128)===0&&(wt(r),r.subtreeFlags&6&&(r.flags|=8192)):wt(r),i=r.updateQueue,i!==null&&Qc(r,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==i&&(r.flags|=2048),e!==null&&D(zs),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),r.memoizedState.cache!==i&&(r.flags|=2048),ra(Ut),wt(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function j4(e,r){switch(Af(r),r.tag){case 1:return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return ra(Ut),me(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 26:case 27:case 5:return ie(r),null;case 31:if(r.memoizedState!==null){if(Un(r),r.alternate===null)throw Error(o(340));Ds()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 13:if(Un(r),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(o(340));Ds()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return D(Lt),null;case 4:return me(),null;case 10:return ra(r.type),null;case 22:case 23:return Un(r),Yf(),e!==null&&D(zs),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 24:return ra(Ut),null;case 25:return null;default:return null}}function Gv(e,r){switch(Af(r),r.tag){case 3:ra(Ut),me();break;case 26:case 27:case 5:ie(r);break;case 4:me();break;case 31:r.memoizedState!==null&&Un(r);break;case 13:Un(r);break;case 19:D(Lt);break;case 10:ra(r.type);break;case 22:case 23:Un(r),Yf(),e!==null&&D(zs);break;case 24:ra(Ut)}}function il(e,r){try{var i=r.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var h=u.next;i=h;do{if((i.tag&e)===e){u=void 0;var x=i.create,j=i.inst;u=x(),j.destroy=u}i=i.next}while(i!==h)}}catch(A){ct(r,r.return,A)}}function Ya(e,r,i){try{var u=r.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var x=h.next;u=x;do{if((u.tag&e)===e){var j=u.inst,A=j.destroy;if(A!==void 0){j.destroy=void 0,h=r;var z=i,J=A;try{J()}catch(le){ct(h,z,le)}}}u=u.next}while(u!==x)}}catch(le){ct(r,r.return,le)}}function Vv(e){var r=e.updateQueue;if(r!==null){var i=e.stateNode;try{O1(r,i)}catch(u){ct(e,e.return,u)}}}function Fv(e,r,i){i.props=$s(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(u){ct(e,r,u)}}function ll(e,r){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var u=e.stateNode;break;case 30:u=e.stateNode;break;default:u=e.stateNode}typeof i=="function"?e.refCleanup=i(u):i.current=u}}catch(h){ct(e,r,h)}}function Dr(e,r){var i=e.ref,u=e.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(h){ct(e,r,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(h){ct(e,r,h)}else i.current=null}function Yv(e){var r=e.type,i=e.memoizedProps,u=e.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(h){ct(e,e.return,h)}}function Sm(e,r,i){try{var u=e.stateNode;V4(u,e.type,i,r),u[Re]=r}catch(h){ct(e,e.return,h)}}function qv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ja(e.type)||e.tag===4}function Nm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ja(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Em(e,r,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,r?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,r):(r=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.appendChild(e),i=i._reactRootContainer,i!=null||r.onclick!==null||(r.onclick=Qr));else if(u!==4&&(u===27&&Ja(e.type)&&(i=e.stateNode,r=null),e=e.child,e!==null))for(Em(e,r,i),e=e.sibling;e!==null;)Em(e,r,i),e=e.sibling}function Jc(e,r,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,r?i.insertBefore(e,r):i.appendChild(e);else if(u!==4&&(u===27&&Ja(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Jc(e,r,i),e=e.sibling;e!==null;)Jc(e,r,i),e=e.sibling}function Kv(e){var r=e.stateNode,i=e.memoizedProps;try{for(var u=e.type,h=r.attributes;h.length;)r.removeAttributeNode(h[0]);ln(r,u,i),r[ye]=e,r[Re]=i}catch(x){ct(e,e.return,x)}}var la=!1,Ht=!1,km=!1,Wv=typeof WeakSet=="function"?WeakSet:Set,Xt=null;function C4(e,r){if(e=e.containerInfo,Km=yu,e=i1(e),yf(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var h=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{i.nodeType,x.nodeType}catch{i=null;break e}var j=0,A=-1,z=-1,J=0,le=0,he=e,ee=null;t:for(;;){for(var ne;he!==i||h!==0&&he.nodeType!==3||(A=j+h),he!==x||u!==0&&he.nodeType!==3||(z=j+u),he.nodeType===3&&(j+=he.nodeValue.length),(ne=he.firstChild)!==null;)ee=he,he=ne;for(;;){if(he===e)break t;if(ee===i&&++J===h&&(A=j),ee===x&&++le===u&&(z=j),(ne=he.nextSibling)!==null)break;he=ee,ee=he.parentNode}he=ne}i=A===-1||z===-1?null:{start:A,end:z}}else i=null}i=i||{start:0,end:0}}else i=null;for(Wm={focusedElem:e,selectionRange:i},yu=!1,Xt=r;Xt!==null;)if(r=Xt,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Xt=e;else for(;Xt!==null;){switch(r=Xt,x=r.alternate,e=r.flags,r.tag){case 0:if((e&4)!==0&&(e=r.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i title"))),ln(x,u,i),x[ye]=e,Wt(x),u=x;break e;case"link":var j=ty("link","href",h).get(u+(i.href||""));if(j){for(var A=0;Agt&&(j=gt,gt=Le,Le=j);var F=s1(A,Le),U=s1(A,gt);if(F&&U&&(ne.rangeCount!==1||ne.anchorNode!==F.node||ne.anchorOffset!==F.offset||ne.focusNode!==U.node||ne.focusOffset!==U.offset)){var Q=he.createRange();Q.setStart(F.node,F.offset),ne.removeAllRanges(),Le>gt?(ne.addRange(Q),ne.extend(U.node,U.offset)):(Q.setEnd(U.node,U.offset),ne.addRange(Q))}}}}for(he=[],ne=A;ne=ne.parentNode;)ne.nodeType===1&&he.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;Ai?32:i,P.T=null,i=Om,Om=null;var x=Xa,j=ma;if(Yt=0,Yo=Xa=null,ma=0,(ot&6)!==0)throw Error(o(331));var A=ot;if(ot|=4,ob(x.current),rb(x,x.current,j,i),ot=A,pl(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(gr,x)}catch{}return!0}finally{Z.p=h,P.T=u,Sb(e,r)}}function Eb(e,r,i){r=rr(i,r),r=mm(e.stateNode,r,2),e=Ga(e,r,2),e!==null&&(Ft(e,2),Or(e))}function ct(e,r,i){if(e.tag===3)Eb(e,e,i);else for(;r!==null;){if(r.tag===3){Eb(r,e,i);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Wa===null||!Wa.has(u))){e=rr(i,e),i=kv(2),u=Ga(r,i,2),u!==null&&(Tv(i,u,r,e),Ft(u,2),Or(u));break}}r=r.return}}function Im(e,r,i){var u=e.pingCache;if(u===null){u=e.pingCache=new E4;var h=new Set;u.set(r,h)}else h=u.get(r),h===void 0&&(h=new Set,u.set(r,h));h.has(i)||(Rm=!0,h.add(i),e=A4.bind(null,e,r,i),r.then(e,e))}function A4(e,r,i){var u=e.pingCache;u!==null&&u.delete(r),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,xt===e&&(We&i)===i&&(_t===4||_t===3&&(We&62914560)===We&&300>It()-nu?(ot&2)===0&&qo(e,0):Am|=i,Fo===We&&(Fo=0)),Or(e)}function kb(e,r){r===0&&(r=it()),e=As(e,r),e!==null&&(Ft(e,r),Or(e))}function _4(e){var r=e.memoizedState,i=0;r!==null&&(i=r.retryLane),kb(e,i)}function D4(e,r){var i=0;switch(e.tag){case 31:case 13:var u=e.stateNode,h=e.memoizedState;h!==null&&(i=h.retryLane);break;case 19:u=e.stateNode;break;case 22:u=e.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(r),kb(e,i)}function O4(e,r){return _n(e,r)}var cu=null,Wo=null,Um=!1,uu=!1,Bm=!1,Qa=0;function Or(e){e!==Wo&&e.next===null&&(Wo===null?cu=Wo=e:Wo=Wo.next=e),uu=!0,Um||(Um=!0,z4())}function pl(e,r){if(!Bm&&uu){Bm=!0;do for(var i=!1,u=cu;u!==null;){if(e!==0){var h=u.pendingLanes;if(h===0)var x=0;else{var j=u.suspendedLanes,A=u.pingedLanes;x=(1<<31-Mt(42|e)+1)-1,x&=h&~(j&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(i=!0,Ab(u,x))}else x=We,x=La(u,u===xt?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(x&3)===0||Oe(u,x)||(i=!0,Ab(u,x));u=u.next}while(i);Bm=!1}}function L4(){Tb()}function Tb(){uu=Um=!1;var e=0;Qa!==0&&Y4()&&(e=Qa);for(var r=It(),i=null,u=cu;u!==null;){var h=u.next,x=Mb(u,r);x===0?(u.next=null,i===null?cu=h:i.next=h,h===null&&(Wo=i)):(i=u,(e!==0||(x&3)!==0)&&(uu=!0)),u=h}Yt!==0&&Yt!==5||pl(e),Qa!==0&&(Qa=0)}function Mb(e,r){for(var i=e.suspendedLanes,u=e.pingedLanes,h=e.expirationTimes,x=e.pendingLanes&-62914561;0A)break;var le=z.transferSize,he=z.initiatorType;le&&Ub(he)&&(z=z.responseEnd,j+=le*(z"u"?null:document;function Zb(e,r,i){var u=Xo;if(u&&typeof r=="string"&&r){var h=tr(r);h='link[rel="'+e+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),Xb.has(h)||(Xb.add(h),e={rel:e,crossOrigin:i,href:r},u.querySelector(h)===null&&(r=u.createElement("link"),ln(r,"link",e),Wt(r),u.head.appendChild(r)))}}function t3(e){pa.D(e),Zb("dns-prefetch",e,null)}function n3(e,r){pa.C(e,r),Zb("preconnect",e,r)}function r3(e,r,i){pa.L(e,r,i);var u=Xo;if(u&&e&&r){var h='link[rel="preload"][as="'+tr(r)+'"]';r==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+tr(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+tr(i.imageSizes)+'"]')):h+='[href="'+tr(e)+'"]';var x=h;switch(r){case"style":x=Zo(e);break;case"script":x=Qo(e)}cr.has(x)||(e=b({rel:"preload",href:r==="image"&&i&&i.imageSrcSet?void 0:e,as:r},i),cr.set(x,e),u.querySelector(h)!==null||r==="style"&&u.querySelector(vl(x))||r==="script"&&u.querySelector(bl(x))||(r=u.createElement("link"),ln(r,"link",e),Wt(r),u.head.appendChild(r)))}}function a3(e,r){pa.m(e,r);var i=Xo;if(i&&e){var u=r&&typeof r.as=="string"?r.as:"script",h='link[rel="modulepreload"][as="'+tr(u)+'"][href="'+tr(e)+'"]',x=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Qo(e)}if(!cr.has(x)&&(e=b({rel:"modulepreload",href:e},r),cr.set(x,e),i.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(bl(x)))return}u=i.createElement("link"),ln(u,"link",e),Wt(u),i.head.appendChild(u)}}}function s3(e,r,i){pa.S(e,r,i);var u=Xo;if(u&&e){var h=bo(u).hoistableStyles,x=Zo(e);r=r||"default";var j=h.get(x);if(!j){var A={loading:0,preload:null};if(j=u.querySelector(vl(x)))A.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":r},i),(i=cr.get(x))&&np(e,i);var z=j=u.createElement("link");Wt(z),ln(z,"link",e),z._p=new Promise(function(J,le){z.onload=J,z.onerror=le}),z.addEventListener("load",function(){A.loading|=1}),z.addEventListener("error",function(){A.loading|=2}),A.loading|=4,hu(j,r,u)}j={type:"stylesheet",instance:j,count:1,state:A},h.set(x,j)}}}function o3(e,r){pa.X(e,r);var i=Xo;if(i&&e){var u=bo(i).hoistableScripts,h=Qo(e),x=u.get(h);x||(x=i.querySelector(bl(h)),x||(e=b({src:e,async:!0},r),(r=cr.get(h))&&rp(e,r),x=i.createElement("script"),Wt(x),ln(x,"link",e),i.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(h,x))}}function i3(e,r){pa.M(e,r);var i=Xo;if(i&&e){var u=bo(i).hoistableScripts,h=Qo(e),x=u.get(h);x||(x=i.querySelector(bl(h)),x||(e=b({src:e,async:!0,type:"module"},r),(r=cr.get(h))&&rp(e,r),x=i.createElement("script"),Wt(x),ln(x,"link",e),i.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(h,x))}}function Qb(e,r,i,u){var h=(h=xe.current)?pu(h):null;if(!h)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(r=Zo(i.href),i=bo(h).hoistableStyles,u=i.get(r),u||(u={type:"style",instance:null,count:0,state:null},i.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Zo(i.href);var x=bo(h).hoistableStyles,j=x.get(e);if(j||(h=h.ownerDocument||h,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,j),(x=h.querySelector(vl(e)))&&!x._p&&(j.instance=x,j.state.loading=5),cr.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},cr.set(e,i),x||l3(h,e,i,j.state))),r&&u===null)throw Error(o(528,""));return j}if(r&&u!==null)throw Error(o(529,""));return null;case"script":return r=i.async,i=i.src,typeof i=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Qo(i),i=bo(h).hoistableScripts,u=i.get(r),u||(u={type:"script",instance:null,count:0,state:null},i.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Zo(e){return'href="'+tr(e)+'"'}function vl(e){return'link[rel="stylesheet"]['+e+"]"}function Jb(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function l3(e,r,i,u){e.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=e.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),ln(r,"link",i),Wt(r),e.head.appendChild(r))}function Qo(e){return'[src="'+tr(e)+'"]'}function bl(e){return"script[async]"+e}function ey(e,r,i){if(r.count++,r.instance===null)switch(r.type){case"style":var u=e.querySelector('style[data-href~="'+tr(i.href)+'"]');if(u)return r.instance=u,Wt(u),u;var h=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(e.ownerDocument||e).createElement("style"),Wt(u),ln(u,"style",h),hu(u,i.precedence,e),r.instance=u;case"stylesheet":h=Zo(i.href);var x=e.querySelector(vl(h));if(x)return r.state.loading|=4,r.instance=x,Wt(x),x;u=Jb(i),(h=cr.get(h))&&np(u,h),x=(e.ownerDocument||e).createElement("link"),Wt(x);var j=x;return j._p=new Promise(function(A,z){j.onload=A,j.onerror=z}),ln(x,"link",u),r.state.loading|=4,hu(x,i.precedence,e),r.instance=x;case"script":return x=Qo(i.src),(h=e.querySelector(bl(x)))?(r.instance=h,Wt(h),h):(u=i,(h=cr.get(x))&&(u=b({},i),rp(u,h)),e=e.ownerDocument||e,h=e.createElement("script"),Wt(h),ln(h,"link",u),e.head.appendChild(h),r.instance=h);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,hu(u,i.precedence,e));return r.instance}function hu(e,r,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,x=h,j=0;j title"):null)}function c3(e,r,i){if(i===1||r.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return e=r.disabled,typeof r.precedence=="string"&&e==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function ry(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function u3(e,r,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var h=Zo(u.href),x=r.querySelector(vl(h));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(e.count++,e=xu.bind(e),r.then(e,e)),i.state.loading|=4,i.instance=x,Wt(x);return}x=r.ownerDocument||r,u=Jb(u),(h=cr.get(h))&&np(u,h),x=x.createElement("link"),Wt(x);var j=x;j._p=new Promise(function(A,z){j.onload=A,j.onerror=z}),ln(x,"link",u),i.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,r),(r=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=xu.bind(e),r.addEventListener("load",i),r.addEventListener("error",i))}}var ap=0;function d3(e,r){return e.stylesheets&&e.count===0&&bu(e,e.stylesheets),0ap?50:800)+r);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(u),clearTimeout(h)}}:null}function xu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vu=null;function bu(e,r){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vu=new Map,r.forEach(f3,e),vu=null,xu.call(e))}function f3(e,r){if(!(r.state.loading&4)){var i=vu.get(e);if(i)var u=i.get(null);else{i=new Map,vu.set(e,i);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),pp.exports=R3(),pp.exports}var _3=A3();/** + * react-router v7.18.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var Zh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,i2=/^[\\/]{2}/;function D3(t,n){return n+t.replace(/\\/g,"/")}var Ay="popstate";function _y(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function O3(t={}){function n(o,c){var g;let l=(g=c.state)==null?void 0:g.masked,{pathname:d,search:m,hash:p}=l||o.location;return Qp("",{pathname:d,search:m,hash:p},c.state&&c.state.usr||null,c.state&&c.state.key||"default",l?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function a(o,c){return typeof c=="string"?c:Il(c)}return z3(n,a,null,t)}function Nt(t,n){if(t===!1||t===null||typeof t>"u")throw new Error(n)}function fr(t,n){if(!t){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function L3(){return Math.random().toString(36).substring(2,10)}function Dy(t,n){return{usr:t.state,key:t.key,idx:n,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Qp(t,n,a=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof n=="string"?vi(n):n,state:a,key:n&&n.key||o||L3(),mask:c}}function Il({pathname:t="/",search:n="",hash:a=""}){return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),a&&a!=="#"&&(t+=a.charAt(0)==="#"?a:"#"+a),t}function vi(t){let n={};if(t){let a=t.indexOf("#");a>=0&&(n.hash=t.substring(a),t=t.substring(0,a));let o=t.indexOf("?");o>=0&&(n.search=t.substring(o),t=t.substring(0,o)),t&&(n.pathname=t)}return n}function z3(t,n,a,o={}){let{window:c=document.defaultView,v5Compat:l=!1}=o,d=c.history,m="POP",p=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function b(){m="POP";let E=v(),k=E==null?null:E-g;g=E,p&&p({action:m,location:S.location,delta:k})}function w(E,k){m="PUSH";let N=_y(E)?E:Qp(S.location,E,k);g=v()+1;let T=Dy(N,g),M=S.createHref(N.mask||N);try{d.pushState(T,"",M)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;c.location.assign(M)}l&&p&&p({action:m,location:S.location,delta:1})}function y(E,k){m="REPLACE";let N=_y(E)?E:Qp(S.location,E,k);g=v();let T=Dy(N,g),M=S.createHref(N.mask||N);d.replaceState(T,"",M),l&&p&&p({action:m,location:S.location,delta:0})}function C(E){return P3(c,E)}let S={get action(){return m},get location(){return t(c,d)},listen(E){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(Ay,b),p=E,()=>{c.removeEventListener(Ay,b),p=null}},createHref(E){return n(c,E)},createURL:C,encodeLocation(E){let k=C(E);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:w,replace:y,go(E){return d.go(E)}};return S}function P3(t,n,a=!1){let o="http://localhost";t&&(o=t.location.origin!=="null"?t.location.origin:t.location.href),Nt(o,"No window.location.(origin|href) available to create URL");let c=typeof n=="string"?n:Il(n);return c=c.replace(/ $/,"%20"),!a&&i2.test(c)&&(c=o+c),new URL(c,o)}function l2(t,n,a="/"){return I3(t,n,a,!1)}function I3(t,n,a,o,c){let l=typeof n=="string"?vi(n):n,d=Na(l.pathname||"/",a);if(d==null)return null;let m=U3(t),p=null,g=X3(d);for(let v=0;p==null&&v{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&p)return;Nt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let b=Cr([o,v.relativePath]),w=a.concat(v);d.children&&d.children.length>0&&(Nt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),c2(d.children,n,w,b,p)),!(d.path==null&&!d.index)&&n.push({path:b,score:q3(b,d.index),routesMeta:w.map((y,C)=>{let[S,E]=f2(y.relativePath,y.caseSensitive,C===w.length-1);return{...y,matcher:S,compiledParams:E}})})};return t.forEach((d,m)=>{var p;if(d.path===""||!((p=d.path)!=null&&p.includes("?")))l(d,m);else for(let g of u2(d.path))l(d,m,!0,g)}),n}function u2(t){let n=t.split("/");if(n.length===0)return[];let[a,...o]=n,c=a.endsWith("?"),l=a.replace(/\?$/,"");if(o.length===0)return c?[l,""]:[l];let d=u2(o.join("/")),m=[];return m.push(...d.map(p=>p===""?l:[l,p].join("/"))),c&&m.push(...d),m.map(p=>t.startsWith("/")&&p===""?"/":p)}function B3(t){t.sort((n,a)=>n.score!==a.score?a.score-n.score:K3(n.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var $3=/^:[\w-]+$/,H3=3,G3=2,V3=1,F3=10,Y3=-2,Oy=t=>t==="*";function q3(t,n){let a=t.split("/"),o=a.length;return a.some(Oy)&&(o+=Y3),n&&(o+=G3),a.filter(c=>!Oy(c)).reduce((c,l)=>c+($3.test(l)?H3:l===""?V3:F3),o)}function K3(t,n){return t.length===n.length&&t.slice(0,-1).every((o,c)=>o===n[c])?t[t.length-1]-n[n.length-1]:0}function W3(t,n,a=!1){let{routesMeta:o}=t,c={},l="/",d=[];for(let m=0;m{if(v==="*"){let C=m[w]||"";d=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const y=m[w];return b&&!y?g[v]=void 0:g[v]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:l,pathnameBase:d,pattern:t}}function f2(t,n=!1,a=!0){fr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,p,g,v)=>{if(o.push({paramName:m,isOptional:p!=null}),p){let b=v.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,n?void 0:"i"),o]}function X3(t){try{return t.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return fr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),t}}function Na(t,n){if(n==="/")return t;if(!t.toLowerCase().startsWith(n.toLowerCase()))return null;let a=n.endsWith("/")?n.length-1:n.length,o=t.charAt(a);return o&&o!=="/"?null:t.slice(a)||"/"}function Z3(t,n="/"){let{pathname:a,search:o="",hash:c=""}=typeof t=="string"?vi(t):t,l;return a?(a=m2(a),a.startsWith("/")?l=Ly(a.substring(1),"/"):l=Ly(a,n)):l=n,{pathname:l,search:eN(o),hash:tN(c)}}function Ly(t,n){let a=ad(n).split("/");return t.split("/").forEach(c=>{c===".."?a.length>1&&a.pop():c!=="."&&a.push(c)}),a.length>1?a.join("/"):"/"}function vp(t,n,a,o){return`Cannot include a '${t}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Q3(t){return t.filter((n,a)=>a===0||n.route.path&&n.route.path.length>0)}function Qh(t){let n=Q3(t);return n.map((a,o)=>o===n.length-1?a.pathname:a.pathnameBase)}function xd(t,n,a,o=!1){let c;typeof t=="string"?c=vi(t):(c={...t},Nt(!c.pathname||!c.pathname.includes("?"),vp("?","pathname","search",c)),Nt(!c.pathname||!c.pathname.includes("#"),vp("#","pathname","hash",c)),Nt(!c.search||!c.search.includes("#"),vp("#","search","hash",c)));let l=t===""||c.pathname==="",d=l?"/":c.pathname,m;if(d==null)m=a;else{let b=n.length-1;if(!o&&d.startsWith("..")){let w=d.split("/");for(;w[0]==="..";)w.shift(),b-=1;c.pathname=w.join("/")}m=b>=0?n[b]:"/"}let p=Z3(c,m),g=d&&d!=="/"&&d.endsWith("/"),v=(l||d===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(g||v)&&(p.pathname+="/"),p}var m2=t=>t.replace(/[\\/]{2,}/g,"/"),Cr=t=>m2(t.join("/")),ad=t=>t.replace(/\/+$/,""),J3=t=>ad(t).replace(/^\/*/,"/"),eN=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,tN=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,nN=class{constructor(t,n,a,o=!1){this.status=t,this.statusText=n||"",this.internal=o,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function rN(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function aN(t){let n=t.map(a=>a.route.path).filter(Boolean);return Cr(n)||"/"}var p2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function h2(t,n){let a=t;if(typeof a!="string"||!Zh.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,c=!1;if(p2)try{let l=new URL(window.location.href),d=i2.test(a)?new URL(D3(a,l.protocol)):new URL(a),m=Na(d.pathname,n);d.origin===l.origin&&m!=null?a=m+d.search+d.hash:c=!0}catch{fr(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var g2=["POST","PUT","PATCH","DELETE"];new Set(g2);var sN=["GET",...g2];new Set(sN);var oN=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function iN(t){try{return oN.includes(new URL(t).protocol)}catch{return!1}}var bi=f.createContext(null);bi.displayName="DataRouter";var vd=f.createContext(null);vd.displayName="DataRouterState";var x2=f.createContext(!1);function lN(){return f.useContext(x2)}var v2=f.createContext({isTransitioning:!1});v2.displayName="ViewTransition";var cN=f.createContext(new Map);cN.displayName="Fetchers";var uN=f.createContext(null);uN.displayName="Await";var qn=f.createContext(null);qn.displayName="Navigation";var Jl=f.createContext(null);Jl.displayName="Location";var Er=f.createContext({outlet:null,matches:[],isDataRoute:!1});Er.displayName="Route";var Jh=f.createContext(null);Jh.displayName="RouteError";var b2="REACT_ROUTER_ERROR",dN="REDIRECT",fN="ROUTE_ERROR_RESPONSE";function mN(t){if(t.startsWith(`${b2}:${dN}:{`))try{let n=JSON.parse(t.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function pN(t){if(t.startsWith(`${b2}:${fN}:{`))try{let n=JSON.parse(t.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new nN(n.status,n.statusText,n.data)}catch{}}function hN(t,{relative:n}={}){Nt(yi(),"useHref() may be used only in the context of a component.");let{basename:a,navigator:o}=f.useContext(qn),{hash:c,pathname:l,search:d}=ec(t,{relative:n}),m=l;return a!=="/"&&(m=l==="/"?a:Cr([a,l])),o.createHref({pathname:m,search:d,hash:c})}function yi(){return f.useContext(Jl)!=null}function Kn(){return Nt(yi(),"useLocation() may be used only in the context of a component."),f.useContext(Jl).location}var y2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function w2(t){f.useContext(qn).static||f.useLayoutEffect(t)}function ao(){let{isDataRoute:t}=f.useContext(Er);return t?RN():gN()}function gN(){Nt(yi(),"useNavigate() may be used only in the context of a component.");let t=f.useContext(bi),{basename:n,navigator:a}=f.useContext(qn),{matches:o}=f.useContext(Er),{pathname:c}=Kn(),l=JSON.stringify(Qh(o)),d=f.useRef(!1);return w2(()=>{d.current=!0}),f.useCallback((p,g={})=>{if(fr(d.current,y2),!d.current)return;if(typeof p=="number"){a.go(p);return}let v=xd(p,JSON.parse(l),c,g.relative==="path");t==null&&n!=="/"&&(v.pathname=v.pathname==="/"?n:Cr([n,v.pathname])),(g.replace?a.replace:a.push)(v,g.state,g)},[n,a,l,c,t])}var xN=f.createContext(null);function vN(t){let n=f.useContext(Er).outlet;return f.useMemo(()=>n&&f.createElement(xN.Provider,{value:t},n),[n,t])}function ec(t,{relative:n}={}){let{matches:a}=f.useContext(Er),{pathname:o}=Kn(),c=JSON.stringify(Qh(a));return f.useMemo(()=>xd(t,JSON.parse(c),o,n==="path"),[t,c,o,n])}function bN(t,n){return j2(t,n)}function j2(t,n,a){var E;Nt(yi(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=f.useContext(qn),{matches:c}=f.useContext(Er),l=c[c.length-1],d=l?l.params:{},m=l?l.pathname:"/",p=l?l.pathnameBase:"/",g=l&&l.route;{let k=g&&g.path||"";S2(m,!g||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${m}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let v=Kn(),b;if(n){let k=typeof n=="string"?vi(n):n;Nt(p==="/"||((E=k.pathname)==null?void 0:E.startsWith(p)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),b=k}else b=v;let w=b.pathname||"/",y=w;if(p!=="/"){let k=p.replace(/^\//,"").split("/");y="/"+w.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=a&&a.state.matches.length?a.state.matches.map(k=>Object.assign(k,{route:a.manifest[k.route.id]||k.route})):l2(t,{pathname:y});fr(g||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),fr(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let S=SN(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},d,k.params),pathname:Cr([p,o.encodeLocation?o.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:Cr([p,o.encodeLocation?o.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),c,a);return n&&S?f.createElement(Jl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},S):S}function yN(){let t=MN(),n=rN(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},l={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:l},"ErrorBoundary")," or"," ",f.createElement("code",{style:l},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},n),a?f.createElement("pre",{style:c},a):null,d)}var wN=f.createElement(yN,null),C2=class extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){this.props.onError?this.props.onError(t,n):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const a=pN(t.digest);a&&(t=a)}let n=t!==void 0?f.createElement(Er.Provider,{value:this.props.routeContext},f.createElement(Jh.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?f.createElement(jN,{error:t},n):n}};C2.contextType=x2;var bp=new WeakMap;function jN({children:t,error:n}){let{basename:a}=f.useContext(qn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=mN(n.digest);if(o){let c=bp.get(n);if(c)throw c;let l=h2(o.location,a),d=l.absoluteURL||l.to;if(iN(d))throw new Error("Invalid redirect location");if(p2&&!bp.get(n))if(l.isExternal||o.reloadDocument)window.location.href=d;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:o.replace}));throw bp.set(n,m),m}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return t}function CN({routeContext:t,match:n,children:a}){let o=f.useContext(bi);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(Er.Provider,{value:t},a)}function SN(t,n=[],a){let o=a==null?void 0:a.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)t=o.matches;else return null}let c=t,l=o==null?void 0:o.errors;if(l!=null){let v=c.findIndex(b=>b.route.id&&(l==null?void 0:l[b.route.id])!==void 0);Nt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,m=-1;if(a&&o){d=o.renderFallback;for(let v=0;v=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let p=a==null?void 0:a.onError,g=o&&p?(v,b)=>{var w,y;p(v,{location:o.location,params:((y=(w=o.matches)==null?void 0:w[0])==null?void 0:y.params)??{},pattern:aN(o.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,w)=>{let y,C=!1,S=null,E=null;o&&(y=l&&b.route.id?l[b.route.id]:void 0,S=b.route.errorElement||wN,d&&(m<0&&w===0?(S2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,E=null):m===w&&(C=!0,E=b.route.hydrateFallbackElement||null)));let k=n.concat(c.slice(0,w+1)),N=()=>{let T;return y?T=S:C?T=E:b.route.Component?T=f.createElement(b.route.Component,null):b.route.element?T=b.route.element:T=v,f.createElement(CN,{match:b,routeContext:{outlet:v,matches:k,isDataRoute:o!=null},children:T})};return o&&(b.route.ErrorBoundary||b.route.errorElement||w===0)?f.createElement(C2,{location:o.location,revalidation:o.revalidation,component:S,error:y,children:N(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:g}):N()},null)}function eg(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function NN(t){let n=f.useContext(bi);return Nt(n,eg(t)),n}function EN(t){let n=f.useContext(vd);return Nt(n,eg(t)),n}function kN(t){let n=f.useContext(Er);return Nt(n,eg(t)),n}function tg(t){let n=kN(t),a=n.matches[n.matches.length-1];return Nt(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function TN(){return tg("useRouteId")}function MN(){var o;let t=f.useContext(Jh),n=EN("useRouteError"),a=tg("useRouteError");return t!==void 0?t:(o=n.errors)==null?void 0:o[a]}function RN(){let{router:t}=NN("useNavigate"),n=tg("useNavigate"),a=f.useRef(!1);return w2(()=>{a.current=!0}),f.useCallback(async(c,l={})=>{fr(a.current,y2),a.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:n,...l}))},[t,n])}var zy={};function S2(t,n,a){!n&&!zy[t]&&(zy[t]=!0,fr(!1,a))}f.memo(AN);function AN({routes:t,manifest:n,future:a,state:o,isStatic:c,onError:l}){return j2(t,void 0,{manifest:n,state:o,isStatic:c,onError:l})}function ya({to:t,replace:n,state:a,relative:o}){Nt(yi()," may be used only in the context of a component.");let{static:c}=f.useContext(qn);fr(!c," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:l}=f.useContext(Er),{pathname:d}=Kn(),m=ao(),p=xd(t,Qh(l),d,o==="path"),g=JSON.stringify(p);return f.useEffect(()=>{m(JSON.parse(g),{replace:n,state:a,relative:o})},[m,g,o,n,a]),null}function _N(t){return vN(t.context)}function cn(t){Nt(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function DN({basename:t="/",children:n=null,location:a,navigationType:o="POP",navigator:c,static:l=!1,useTransitions:d}){Nt(!yi(),"You cannot render a inside another . You should never have more than one in your app.");let m=t.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:m,navigator:c,static:l,useTransitions:d,future:{}}),[m,c,l,d]);typeof a=="string"&&(a=vi(a));let{pathname:g="/",search:v="",hash:b="",state:w=null,key:y="default",mask:C}=a,S=f.useMemo(()=>{let E=Na(g,m);return E==null?null:{location:{pathname:E,search:v,hash:b,state:w,key:y,mask:C},navigationType:o}},[m,g,v,b,w,y,o,C]);return fr(S!=null,` is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the won't render anything.`),S==null?null:f.createElement(qn.Provider,{value:p},f.createElement(Jl.Provider,{children:n,value:S}))}function Py({children:t,location:n}){return bN(Jp(t),n)}function Jp(t,n=[]){let a=[];return f.Children.forEach(t,(o,c)=>{if(!f.isValidElement(o))return;let l=[...n,c];if(o.type===f.Fragment){a.push.apply(a,Jp(o.props.children,l));return}Nt(o.type===cn,`[${typeof o.type=="string"?o.type:o.type.name}] is not a component. All component children of must be a or `),Nt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||l.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=Jp(o.props.children,l)),a.push(d)}),a}var Fu="get",Yu="application/x-www-form-urlencoded";function bd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function ON(t){return bd(t)&&t.tagName.toLowerCase()==="button"}function LN(t){return bd(t)&&t.tagName.toLowerCase()==="form"}function zN(t){return bd(t)&&t.tagName.toLowerCase()==="input"}function PN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function IN(t,n){return t.button===0&&(!n||n==="_self")&&!PN(t)}function eh(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((n,a)=>{let o=t[a];return n.concat(Array.isArray(o)?o.map(c=>[a,c]):[[a,o]])},[]))}function UN(t,n){let a=eh(t);return n&&n.forEach((o,c)=>{a.has(c)||n.getAll(c).forEach(l=>{a.append(c,l)})}),a}var ku=null;function BN(){if(ku===null)try{new FormData(document.createElement("form"),0),ku=!1}catch{ku=!0}return ku}var $N=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yp(t){return t!=null&&!$N.has(t)?(fr(!1,`"${t}" is not a valid \`encType\` for \`\`/\`\` and will default to "${Yu}"`),null):t}function HN(t,n){let a,o,c,l,d;if(LN(t)){let m=t.getAttribute("action");o=m?Na(m,n):null,a=t.getAttribute("method")||Fu,c=yp(t.getAttribute("enctype"))||Yu,l=new FormData(t)}else if(ON(t)||zN(t)&&(t.type==="submit"||t.type==="image")){let m=t.form;if(m==null)throw new Error('Cannot submit a `,_=>`${M}-${_.id}`)}const E=w`
${n.i18n.searchDescription}
${n.i18n.skinToneDescription}
${y(n.skinTones,(N,T)=>w`
${N}
`,N=>N)}
${y(n.currentEmojisWithCategories,(N,T)=>w`
${C(N.emojis,n.searchMode,"emo")}
`,N=>N.category)}
`,k=(N,T)=>{for(const M of t.querySelectorAll(`[${N}]`))T(M,M.getAttribute(N))};if(p){t.appendChild(E);for(const N of["click","focusout","input","keydown","keyup"])k(`data-on-${N}`,(T,M)=>{T.addEventListener(N,o[M])});k("data-ref",(N,T)=>{l[T]=N}),d.addEventListener("abort",()=>{t.removeChild(E)})}k("data-action",(N,T)=>{let M=m.get(T);M||m.set(T,M=new WeakSet),M.has(N)||(M.add(N),c[T](N))})}const md=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t);function oO(t){let n=!1,a;const o=new Map,c=new Set;let l;const d=()=>{if(n)return;const g=[...c];c.clear();try{for(const v of g)v()}finally{l=!1,c.size&&(l=!0,md(d))}},m=new Proxy({},{get(g,v){if(a){let b=o.get(v);b||(b=new Set,o.set(v,b)),b.add(a)}return g[v]},set(g,v,b){if(g[v]!==b){g[v]=b;const w=o.get(v);if(w){for(const y of w)c.add(y);l||(l=!0,md(d))}}return!0}}),p=g=>{const v=()=>{const b=a;a=v;try{return g()}finally{a=b}};return v()};return t.addEventListener("abort",()=>{n=!0}),{state:m,createEffect:p}}function qp(t,n,a){if(t.length!==n.length)return!1;for(let o=0;o{c.disconnect()})),c.observe(t)}}const Kp=[],{assign:$u}=Object;function lO(t,n){const a={},o=new AbortController,c=o.signal,{state:l,createEffect:d}=oO(c),m=new Map;$u(l,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),$u(l,n),$u(l,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:kD,isRtl:!1,currentGroupIndex:0,groups:Hp,databaseLoaded:!1,activeSearchItemId:void 0}),d(()=>{l.currentGroup!==l.groups[l.currentGroupIndex]&&(l.currentGroup=l.groups[l.currentGroupIndex])});const p=B=>{t.getElementById(B).focus()},g=B=>t.getElementById(`emo-${B.id}`),v=(B,ie)=>{a.rootElement.dispatchEvent(new CustomEvent(B,{detail:ie,bubbles:!0,composed:!0}))},b=(B,ie)=>B.id===ie.id,w=(B,ie)=>{const{category:we,emojis:Ce}=B,{category:ze,emojis:Ke}=ie;return we!==ze?!1:qp(Ce,Ke,b)},y=B=>{qp(l.currentEmojis,B,b)||(l.currentEmojis=B)},C=B=>{l.searchMode!==B&&(l.searchMode=B)},S=B=>{qp(l.currentEmojisWithCategories,B,w)||(l.currentEmojisWithCategories=B)},E=(B,ie)=>ie&&B.skins&&B.skins[ie]||B.unicode,T={labelWithSkin:(B,ie)=>VD([B.name||E(B,ie),B.annotation,...B.shortcodes||Kp].filter(Boolean)).join(", "),titleForEmoji:B=>B.annotation||(B.shortcodes||Kp).join(", "),unicodeWithSkin:E},M={onClickSkinToneButton:X,onEmojiClick:D,onNavClick:ae,onNavKeydown:re,onSearchKeydown:Z,onSkinToneOptionsClick:H,onSkinToneOptionsFocusOut:ge,onSkinToneOptionsKeydown:xe,onSkinToneOptionsKeyup:q,onSearchInput:me},_={calculateEmojiGridStyle:te,updateOnIntersection:K};let R=!0;d(()=>{sO(t,l,T,M,_,a,c,m,R),R=!1}),l.emojiVersion||Vp().then(B=>{B||(l.message=l.i18n.emojiUnsupportedMessage)}),d(()=>{async function B(){let ie=!1;const we=setTimeout(()=>{ie=!0,l.message=l.i18n.loadingMessage},ND);try{await l.database.ready(),l.databaseLoaded=!0}catch(Ce){console.error(Ce),l.message=l.i18n.networkErrorMessage}finally{clearTimeout(we),ie&&(ie=!1,l.message="")}}l.database&&B()}),d(()=>{l.pickerStyle=` + --num-groups: ${l.groups.length}; + --indicator-opacity: ${l.searchMode?0:1}; + --num-skintones: ${z0};`}),d(()=>{l.customEmoji&&l.database&&L()}),d(()=>{l.customEmoji&&l.customEmoji.length?l.groups!==Fh&&(l.groups=Fh):l.groups!==Hp&&(l.currentGroupIndex&&l.currentGroupIndex--,l.groups=Hp)}),d(()=>{async function B(){l.databaseLoaded&&(l.currentSkinTone=await l.database.getPreferredSkinTone())}B()}),d(()=>{l.skinTones=Array(z0).fill().map((B,ie)=>ID(l.skinToneEmoji,ie))}),d(()=>{l.skinToneButtonText=l.skinTones[l.currentSkinTone]}),d(()=>{l.skinToneButtonLabel=l.i18n.skinToneLabel.replace("{skinTone}",l.i18n.skinTones[l.currentSkinTone])}),d(()=>{async function B(){const{database:ie}=l,we=(await Promise.all(TD.map(Ce=>ie.getEmojiByUnicodeOrName(Ce)))).filter(Boolean);l.defaultFavoriteEmojis=we}l.databaseLoaded&&B()});function L(){const{customEmoji:B,database:ie}=l,we=B||Kp;ie.customEmoji!==we&&(ie.customEmoji=we)}d(()=>{async function B(){L();const{database:ie,defaultFavoriteEmojis:we,numColumns:Ce}=l,ze=await ie.getTopFavoriteEmoji(Ce),Ke=await fe(XS([...ze,...we],ft=>ft.unicode||ft.name).slice(0,Ce));l.currentFavorites=Ke}l.databaseLoaded&&l.defaultFavoriteEmojis&&B()});function te(B){$D(B,c,()=>{{const ie=getComputedStyle(a.rootElement),we=parseInt(ie.getPropertyValue("--num-columns"),10),Ce=ie.getPropertyValue("direction")==="rtl";l.numColumns=we,l.isRtl=Ce}})}function K(B){iO(B,c,ie=>{for(const{target:we,isIntersecting:Ce}of ie)we.classList.toggle("onscreen",Ce)})}d(()=>{async function B(){const{searchText:ie,currentGroup:we,databaseLoaded:Ce,customEmoji:ze}=l;if(!Ce)l.currentEmojis=[],l.searchMode=!1;else if(ie.length>=CD){const Ke=await P(ie);l.searchText===ie&&(y(Ke),C(!0))}else{const{id:Ke}=we;if(Ke!==-1||ze&&ze.length){const ft=await se(Ke);l.currentGroup.id===Ke&&(y(ft),C(!1))}}}B()});const I=()=>{ed(()=>FD(a.tabpanelElement))};d(()=>{const{currentEmojis:B,emojiVersion:ie}=l,we=B.filter(Ce=>Ce.unicode).filter(Ce=>P0(Ce)&&!Yh.has(Ce.unicode));if(!ie&&we.length)y(B),ed(()=>G(we));else{const Ce=ie?B:B.filter(Y);y(Ce),I()}});function G(B){GD(B,a.baselineEmoji,g)?I():l.currentEmojis=[...l.currentEmojis]}function Y(B){return!B.unicode||!P0(B)||Yh.get(B.unicode)}async function ce(B){const ie=l.emojiVersion||await Vp();return B.filter(({version:we})=>!we||we<=ie)}async function fe(B){return UD(B,l.emojiVersion||await Vp())}async function se(B){const ie=B===-1?l.customEmoji:await l.database.getEmojiByGroup(B);return fe(await ce(ie))}async function P(B){return fe(await ce(await l.database.getEmojiBySearchQuery(B)))}d(()=>{}),d(()=>{function B(){const{searchMode:we,currentEmojis:Ce}=l;if(we)return[{category:"",emojis:Ce}];const ze=new Map;for(const Ke of Ce){const ft=Ke.category||"";let Pt=ze.get(ft);Pt||(Pt=[],ze.set(ft,Pt)),Pt.push(Ke)}return[...ze.entries()].map(([Ke,ft])=>({category:Ke,emojis:ft})).sort((Ke,ft)=>l.customCategorySorting(Ke.category,ft.category))}const ie=B();S(ie)}),d(()=>{l.activeSearchItemId=l.activeSearchItem!==-1&&l.currentEmojis[l.activeSearchItem].id}),d(()=>{const{rawSearchText:B}=l;KS(()=>{l.searchText=(B||"").trim(),l.activeSearchItem=-1})});function Z(B){if(!l.searchMode||!l.currentEmojis.length)return;const ie=we=>{zr(B),l.activeSearchItem=Fp(we,l.activeSearchItem,l.currentEmojis)};switch(B.key){case"ArrowDown":return ie(!1);case"ArrowUp":return ie(!0);case"Enter":if(l.activeSearchItem===-1)l.activeSearchItem=0;else return zr(B),O(l.currentEmojis[l.activeSearchItem].id)}}function ae(B){const{target:ie}=B,we=ie.closest(".nav-button");if(!we)return;const Ce=parseInt(we.dataset.groupId,10);a.searchElement.value="",l.rawSearchText="",l.searchText="",l.activeSearchItem=-1,l.currentGroupIndex=l.groups.findIndex(ze=>ze.id===Ce)}function re(B){const{target:ie,key:we}=B,Ce=ze=>{ze&&(zr(B),ze.focus())};switch(we){case"ArrowLeft":return Ce(ie.previousElementSibling);case"ArrowRight":return Ce(ie.nextElementSibling);case"Home":return Ce(ie.parentElement.firstElementChild);case"End":return Ce(ie.parentElement.lastElementChild)}}async function V(B){const ie=await l.database.getEmojiByUnicodeOrName(B),we=[...l.currentEmojis,...l.currentFavorites].find(ze=>ze.id===B),Ce=we.unicode&&E(we,l.currentSkinTone);return await l.database.incrementFavoriteEmojiCount(B),{emoji:ie,skinTone:l.currentSkinTone,...Ce&&{unicode:Ce},...we.name&&{name:we.name}}}async function O(B){const ie=V(B);v("emoji-click-sync",ie),v("emoji-click",await ie)}function D(B){const{target:ie}=B;if(!ie.classList.contains("emoji"))return;zr(B);const we=ie.id.substring(4);O(we)}function $(B){l.currentSkinTone=B,l.skinTonePickerExpanded=!1,p("skintone-button"),v("skin-tone-change",{skinTone:B}),l.database.setPreferredSkinTone(B)}function H(B){const{target:{id:ie}}=B,we=ie&&ie.match(/^skintone-(\d)/);if(!we)return;zr(B);const Ce=parseInt(we[1],10);$(Ce)}function X(B){l.skinTonePickerExpanded=!l.skinTonePickerExpanded,l.activeSkinTone=l.currentSkinTone,l.skinTonePickerExpanded&&(zr(B),ed(()=>p("skintone-list")))}d(()=>{l.skinTonePickerExpanded?a.skinToneDropdown.addEventListener("transitionend",()=>{l.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):l.skinTonePickerExpandedAfterAnimation=!1});function xe(B){if(!l.skinTonePickerExpanded)return;const ie=async we=>{zr(B),l.activeSkinTone=we};switch(B.key){case"ArrowUp":return ie(Fp(!0,l.activeSkinTone,l.skinTones));case"ArrowDown":return ie(Fp(!1,l.activeSkinTone,l.skinTones));case"Home":return ie(0);case"End":return ie(l.skinTones.length-1);case"Enter":return zr(B),$(l.activeSkinTone);case"Escape":return zr(B),l.skinTonePickerExpanded=!1,p("skintone-button")}}function q(B){if(l.skinTonePickerExpanded)switch(B.key){case" ":return zr(B),$(l.activeSkinTone)}}async function ge(B){const{relatedTarget:ie}=B;(!ie||ie.id!=="skintone-list")&&(l.skinTonePickerExpanded=!1)}function me(B){l.rawSearchText=B.target.value}return{$set(B){$u(l,B)},$destroy(){o.abort()}}}const cO="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",uO="en";var dO={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},fO=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const ZS=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],mO=`:host{--emoji-font-family:${WS}}`;class Cx extends HTMLElement{constructor(n){super(),this.attachShadow({mode:"open"});const a=document.createElement("style");a.textContent=fO+mO,this.shadowRoot.appendChild(a),this._ctx={locale:uO,dataSource:cO,skinToneEmoji:ED,customCategorySorting:MD,customEmoji:null,i18n:dO,emojiVersion:null,...n};for(const o of ZS)o!=="database"&&Object.prototype.hasOwnProperty.call(this,o)&&(this._ctx[o]=this[o],delete this[o]);this._dbFlush()}connectedCallback(){V0(this),this._cmp||(this._cmp=lO(this.shadowRoot,this._ctx))}disconnectedCallback(){V0(this),md(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:n}=this._ctx;n.close().catch(a=>console.error(a))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(n,a,o){this._set(n.replace(/-([a-z])/g,(c,l)=>l.toUpperCase()),n==="emoji-version"?parseFloat(o):o)}_set(n,a){this._ctx[n]=a,this._cmp&&this._cmp.$set({[n]:a}),["locale","dataSource"].includes(n)&&this._dbFlush()}_dbCreate(){const{locale:n,dataSource:a,database:o}=this._ctx;(!o||o.locale!==n||o.dataSource!==a)&&this._set("database",new jD({locale:n,dataSource:a}))}_dbFlush(){md(()=>this._dbCreate())}}const QS={};for(const t of ZS)QS[t]={get(){return t==="database"&&this._dbCreate(),this._ctx[t]},set(n){if(t==="database")throw new Error("database is read-only");this._set(t,n)}};Object.defineProperties(Cx.prototype,QS);function V0(t){t instanceof Cx||Object.setPrototypeOf(t,customElements.get(t.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Cx);function pO({onPick:t}){const n=f.useRef(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const o=document.createElement("emoji-picker");o.className="unicode-emoji-picker-el",o.setAttribute("data-theme","dark");const c=l=>{var p;const d=l.detail,m=(d==null?void 0:d.unicode)??((p=d==null?void 0:d.emoji)==null?void 0:p.unicode);m&&t(m)};return o.addEventListener("emoji-click",c),a.appendChild(o),()=>{o.removeEventListener("emoji-click",c),o.remove()}},[t]),s.jsx("div",{ref:n,className:"unicode-emoji-panel-host overflow-hidden rounded-lg border border-border/50"})}const hO=/^<(a?):([^:>]+):(\d{17,20})>$/;function td(t,n,a=!1){return`${a?"`}function JS(t){const n=String(t??"").trim();if(!n)return{kind:"empty",value:""};const a=n.match(hO);return a?{kind:"custom",value:n,animated:a[1]==="a",name:a[2],id:a[3]}:{kind:"unicode",value:n}}function e5(t,n=!1){return`https://cdn.discordapp.com/emojis/${t}.${n?"gif":"png"}?size=64`}function gO(t,n=[]){const a=JS(t);if(a.kind==="custom"&&a.id&&!a.name){const o=n.find(c=>c.id===a.id);if(o)return{kind:"custom",value:td(o.name,o.id,o.animated),name:o.name,id:o.id,animated:o.animated}}if(a.kind==="custom"&&a.id){const o=n.find(c=>c.id===a.id);if(o&&a.value!==td(o.name,o.id,o.animated))return{kind:"custom",value:td(o.name,o.id,o.animated),name:o.name,id:o.id,animated:o.animated}}return a}function xO({value:t,guildEmojis:n,size:a="md"}){const o=gO(t,n),c=a==="lg"?"size-10":"size-7",l=a==="lg"?"text-3xl":"text-2xl";return o.kind==="empty"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"No emoji selected"}):o.kind==="custom"&&o.id?s.jsxs("span",{className:"inline-flex items-center gap-3",children:[s.jsx("img",{src:e5(o.id,o.animated),alt:o.name??"custom emoji",className:pe(c,"shrink-0 rounded-md"),loading:"lazy"}),s.jsxs("span",{className:"flex flex-col items-start gap-0.5",children:[s.jsxs("span",{className:"text-sm font-medium",children:[":",o.name,":"]}),s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:o.value})]})]}):s.jsx("span",{className:pe(l,"leading-none"),title:o.value,children:o.value})}function vO({id:t,label:n,description:a,value:o,onChange:c,readOnly:l}){const[d,m]=f.useState(!1),[p,g]=f.useState("server"),[v,b]=f.useState(null),[w,y]=f.useState(""),[C,S]=f.useState(!1),[E,k]=f.useState(""),N=f.useCallback(async(I=!1)=>{S(!0),y("");try{const G=await Ne.getGuildResources(I);G.data?(b(G.data),Array.isArray(G.data.emojis)||y("Server response is missing emojis. Restart the bot after updating.")):y("No guild data returned.")}catch(G){y(G instanceof Error?G.message:"Could not load server emojis")}finally{S(!1)}},[]);f.useEffect(()=>{d&&N(!0)},[d,N]);const T=f.useMemo(()=>Array.isArray(v==null?void 0:v.emojis)?v.emojis:[],[v]),M=f.useMemo(()=>{const I=E.trim().toLowerCase();return I?T.filter(G=>G.name.toLowerCase().includes(I)):T},[T,E]),_=String(o??""),R=JS(_);function L(I){c(I),m(!1)}function te(I){c(td(I.name,I.id,I.animated)),m(!1)}function K(){c("")}return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:t,children:n}),a?s.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null,s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(xO,{value:o,guildEmojis:T,size:"lg"})}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(ue,{type:"button",variant:"secondary",size:"sm",disabled:l,onClick:()=>m(!0),children:"Choose emoji"}),_?s.jsx(ue,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:K,children:"Clear"}):null]})]}),s.jsx(Qs,{open:d,onOpenChange:m,children:s.jsxs(hs,{className:"max-h-[min(90vh,720px)] max-w-lg gap-0 overflow-hidden p-0 sm:max-w-xl",children:[s.jsxs(gs,{className:"space-y-1 border-b border-border px-5 py-4",children:[s.jsx(xs,{children:"Choose emoji"}),s.jsxs(vs,{children:["Server emojis save as"," ",s.jsx("code",{className:"rounded bg-muted px-1 text-xs",children:"<:name:id>"}),". Standard emojis save as Unicode characters."]})]}),s.jsxs(DS,{value:p,onValueChange:I=>g(I),className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs(xx,{className:"mx-5 mt-3 grid h-9 w-auto grid-cols-2",children:[s.jsx(Ys,{value:"server",children:"Server"}),s.jsx(Ys,{value:"unicode",children:"All emojis"})]}),s.jsxs($h,{value:"server",className:"mt-0 flex-1 px-5 pb-4 pt-3",children:[s.jsxs("div",{className:"relative mb-3",children:[s.jsx(ve,{icon:ji,size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(De,{placeholder:"Search by name…",value:E,onChange:I=>k(I.target.value),className:"h-9 border-border bg-secondary/30 pl-9"})]}),v?s.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:[v.guildName," · ",T.length," custom emoji",T.length===1?"":"s"]}):null,s.jsx(fc,{className:"h-[min(50vh,320px)] rounded-lg border border-border/50 bg-secondary/20",children:C?s.jsx("div",{className:"grid grid-cols-6 gap-2 p-3 sm:grid-cols-8",children:Array.from({length:24}).map((I,G)=>s.jsx(Be,{className:"aspect-square rounded-lg"},G))}):w?s.jsxs("div",{className:"space-y-3 p-4 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:w}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(!0),children:"Retry"})]}):M.length===0?s.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground",children:T.length===0?"No custom emojis in this server, or the bot needs the Guild Emojis intent (restart after update).":"No emojis match your search."}):s.jsx("div",{className:"grid grid-cols-6 gap-1.5 p-2 sm:grid-cols-8",children:M.map(I=>{const G=R.kind==="custom"&&R.id===I.id;return s.jsx("button",{type:"button",title:`:${I.name}:`,className:pe("flex aspect-square items-center justify-center rounded-lg border border-transparent bg-background/50 transition-colors hover:border-primary/30 hover:bg-accent",G&&"border-primary/50 bg-primary/15 ring-2 ring-primary/30"),onClick:()=>te(I),children:s.jsx("img",{src:I.url??e5(I.id,I.animated),alt:I.name,className:"size-8 object-contain",loading:"lazy"})},I.id)})})})]}),s.jsx($h,{value:"unicode",className:"mt-0 px-5 pb-4 pt-3",children:s.jsx(pO,{onPick:L})})]})]})}),s.jsx(De,{value:_,disabled:l,onChange:I=>c(I.target.value),placeholder:"Unicode or <:name:id>",className:"border-border bg-secondary/30 font-mono text-xs"})]})}const F0="BOT_TOKEN",bO="MODEL_API_KEY";function pd({field:t,value:n,onChange:a,readOnly:o}){const c=t.path.replace(/\./g,"-");if(t.type==="googleFont")return s.jsx(S_,{field:t,value:n,onChange:a,readOnly:o});if(t.type==="boolean")return s.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border bg-secondary/20 px-3 py-2.5",children:[s.jsxs("div",{children:[s.jsx(_e,{htmlFor:c,className:"font-medium",children:t.label}),t.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null]}),s.jsx(kt,{id:c,checked:!!n,disabled:o,onCheckedChange:a})]});if(t.type==="stringList")return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:t.label}),t.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null,s.jsx(w_,{value:Array.isArray(n)?n:[],onChange:a})]});if(t.type==="select"&&t.options)return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:c,children:t.label}),s.jsxs(Ca,{value:String(n??""),disabled:o,onValueChange:a,children:[s.jsx(Br,{id:c,className:"border-border bg-secondary/30",children:s.jsx(Sa,{placeholder:"Select…"})}),s.jsx($r,{children:t.options.map(d=>s.jsx(vt,{value:d.value,children:d.label},d.value))})]})]});if(t.type==="color"){const d=Ur(String(n??"#000000"));return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:c,children:t.label}),t.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null,s.jsxs("div",{className:"flex gap-2",children:[s.jsx(tf,{value:d,onChange:a}),s.jsx(De,{id:c,value:d,disabled:o,onChange:m=>a(m.target.value),onBlur:m=>a(Ur(m.target.value,d)),className:"border-border bg-secondary/30 font-mono uppercase",placeholder:"#000000",maxLength:7})]})]})}if(t.type==="emoji")return s.jsx(vO,{id:c,label:t.label,description:t.description,value:n,onChange:a,readOnly:o});if(t.type==="discordChannel"||t.type==="discordRole"||t.type==="discordCategory"){const d=t.type==="discordRole"?"role":t.type==="discordCategory"?"category":"channel";return s.jsx(TS,{id:c,label:t.label,description:t.description,kind:d,value:n,onChange:a,readOnly:o})}if(t.type==="secret"){const d=n===F0||n===bO||!n?"":"••••••••••••";return s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:c,children:t.label}),t.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null,s.jsx(De,{id:c,type:"password",value:d,disabled:o,placeholder:t.placeholder??"Unchanged if empty",onChange:m=>{const p=m.target.value;a(p||(t.placeholder??F0))},className:"border-border bg-secondary/30"})]})}const l="border-border bg-secondary/30";return t.type==="textarea"?s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:c,children:t.label}),s.jsx(Jd,{id:c,value:String(n??""),disabled:o,onChange:d=>a(d.target.value),className:`min-h-[88px] ${l}`})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:c,children:t.label}),t.description?s.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null,s.jsx(De,{id:c,type:t.type==="number"?"number":"text",value:n==null?"":String(n),disabled:o,onChange:d=>a(t.type==="number"?Number(d.target.value):d.target.value),placeholder:t.placeholder??(t.type==="discordId"?"Discord snowflake ID":void 0),className:l})]})}const Ze=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("rounded-xl border border-border bg-card text-card-foreground shadow-none",t),...n}));Ze.displayName="Card";const ut=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("flex flex-col space-y-1.5 p-6",t),...n}));ut.displayName="CardHeader";const dt=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("font-semibold leading-none tracking-tight",t),...n}));dt.displayName="CardTitle";const Ot=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("text-sm text-muted-foreground",t),...n}));Ot.displayName="CardDescription";const Qe=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("p-6 pt-0",t),...n}));Qe.displayName="CardContent";const Sx=f.forwardRef(({className:t,...n},a)=>s.jsx("div",{ref:a,className:pe("flex items-center p-6 pt-0",t),...n}));Sx.displayName="CardFooter";function Y0(t){return t.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function yO(t,n){if(typeof n=="boolean")return"boolean";if(typeof n=="number")return"number";if(Array.isArray(n))return"stringList";if(typeof n=="string"){const a=t.toLowerCase();return/prefix/.test(a)?"text":/emoji/.test(a)?"emoji":/guild.?id|guild_id/.test(a)?"discordId":/category/.test(a)?"discordCategory":/channel|forum/.test(a)?"discordChannel":/role|staff|admin|moderator/.test(a)?"discordRole":n.length>100?"textarea":"text"}return"text"}function Nx(t,n=""){const a=[];for(const[o,c]of Object.entries(t)){const l=n?`${n}.${o}`:o;if(Array.isArray(c)){if(c.length>0&&typeof c[0]=="object"&&c[0]!==null&&!Array.isArray(c[0]))continue;a.push({path:l,label:Y0(o),type:"stringList"});continue}if(c&&typeof c=="object"&&Object.keys(c).length>0){a.push(...Nx(c,l));continue}a.push({path:l,label:Y0(o),type:yO(o,c)})}return a}function wO(t){const n=Nx(t);return n.length===0?[{title:"Configuration",fields:[]}]:[{title:"Settings",description:"Values from this addon’s config file.",fields:n}]}function Fr(t,n){const a=n.split(".");let o=t;for(const c of a){if(o==null||typeof o!="object")return;o=o[c]}return o}function Gn(t,n,a){const o=n.split("."),c=structuredClone(t);let l=c;for(let d=0;d{switch(t){case"success":return NO;case"info":return kO;case"warning":return EO;case"error":return TO;default:return null}},CO=Array(12).fill(0),SO=({visible:t,className:n})=>be.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":t},be.createElement("div",{className:"sonner-spinner"},CO.map((a,o)=>be.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),NO=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),EO=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),kO=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),TO=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),MO=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},be.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),be.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),RO=()=>{let[t,n]=be.useState(document.hidden);return be.useEffect(()=>{let a=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),t},qh=1,AO=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:a,...o}=t,c=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:qh++,l=this.toasts.find(m=>m.id===c),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),l?this.toasts=this.toasts.map(m=>m.id===c?(this.publish({...m,...t,id:c,title:a}),{...m,...t,id:c,dismissible:d,title:a}):m):this.addToast({title:a,...o,dismissible:d,id:c}),c},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),c=a!==void 0,l,d=o.then(async p=>{if(l=["resolve",p],be.isValidElement(p))c=!1,this.create({id:a,type:"default",message:p});else if(DO(p)&&!p.ok){c=!1;let g=typeof n.error=="function"?await n.error(`HTTP error! status: ${p.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${p.status}`):n.description;this.create({id:a,type:"error",message:g,description:v})}else if(n.success!==void 0){c=!1;let g=typeof n.success=="function"?await n.success(p):n.success,v=typeof n.description=="function"?await n.description(p):n.description;this.create({id:a,type:"success",message:g,description:v})}}).catch(async p=>{if(l=["reject",p],n.error!==void 0){c=!1;let g=typeof n.error=="function"?await n.error(p):n.error,v=typeof n.description=="function"?await n.description(p):n.description;this.create({id:a,type:"error",message:g,description:v})}}).finally(()=>{var p;c&&(this.dismiss(a),a=void 0),(p=n.finally)==null||p.call(n)}),m=()=>new Promise((p,g)=>d.then(()=>l[0]==="reject"?g(l[1]):p(l[1])).catch(g));return typeof a!="string"&&typeof a!="number"?{unwrap:m}:Object.assign(a,{unwrap:m})},this.custom=(t,n)=>{let a=(n==null?void 0:n.id)||qh++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Tn=new AO,_O=(t,n)=>{let a=(n==null?void 0:n.id)||qh++;return Tn.addToast({title:t,...n,id:a}),a},DO=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",OO=_O,LO=()=>Tn.toasts,zO=()=>Tn.getActiveToasts(),Dt=Object.assign(OO,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:LO,getToasts:zO});function PO(t,{insertAt:n}={}){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}PO(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function Hu(t){return t.label!==void 0}var IO=3,UO="32px",BO="16px",q0=4e3,$O=356,HO=14,GO=20,VO=200;function wr(...t){return t.filter(Boolean).join(" ")}function FO(t){let[n,a]=t.split("-"),o=[];return n&&o.push(n),a&&o.push(a),o}var YO=t=>{var n,a,o,c,l,d,m,p,g,v,b;let{invert:w,toast:y,unstyled:C,interacting:S,setHeights:E,visibleToasts:k,heights:N,index:T,toasts:M,expanded:_,removeToast:R,defaultRichColors:L,closeButton:te,style:K,cancelButtonStyle:I,actionButtonStyle:G,className:Y="",descriptionClassName:ce="",duration:fe,position:se,gap:P,loadingIcon:Z,expandByDefault:ae,classNames:re,icons:V,closeButtonAriaLabel:O="Close toast",pauseWhenPageIsHidden:D}=t,[$,H]=be.useState(null),[X,xe]=be.useState(null),[q,ge]=be.useState(!1),[me,B]=be.useState(!1),[ie,we]=be.useState(!1),[Ce,ze]=be.useState(!1),[Ke,ft]=be.useState(!1),[Pt,gn]=be.useState(0),[Yr,_n]=be.useState(0),wn=be.useRef(y.duration||fe||q0),Xn=be.useRef(null),Zn=be.useRef(null),It=T===0,po=T+1<=k,nn=y.type,Dn=y.dismissible!==!1,Da=y.className||"",ho=y.descriptionClassName||"",Qn=be.useMemo(()=>N.findIndex(Oe=>Oe.toastId===y.id)||0,[N,y.id]),Es=be.useMemo(()=>{var Oe;return(Oe=y.closeButton)!=null?Oe:te},[y.closeButton,te]),qr=be.useMemo(()=>y.duration||fe||q0,[y.duration,fe]),gr=be.useRef(0),Tt=be.useRef(0),On=be.useRef(0),Mt=be.useRef(null),[Oi,Li]=se.split("-"),go=be.useMemo(()=>N.reduce((Oe,tt,it)=>it>=Qn?Oe:Oe+tt.height,0),[N,Qn]),Kr=RO(),Oa=y.invert||w,Mr=nn==="loading";Tt.current=be.useMemo(()=>Qn*P+go,[Qn,go]),be.useEffect(()=>{wn.current=qr},[qr]),be.useEffect(()=>{ge(!0)},[]),be.useEffect(()=>{let Oe=Zn.current;if(Oe){let tt=Oe.getBoundingClientRect().height;return _n(tt),E(it=>[{toastId:y.id,height:tt,position:y.position},...it]),()=>E(it=>it.filter(rn=>rn.toastId!==y.id))}},[E,y.id]),be.useLayoutEffect(()=>{if(!q)return;let Oe=Zn.current,tt=Oe.style.height;Oe.style.height="auto";let it=Oe.getBoundingClientRect().height;Oe.style.height=tt,_n(it),E(rn=>rn.find(Ft=>Ft.toastId===y.id)?rn.map(Ft=>Ft.toastId===y.id?{...Ft,height:it}:Ft):[{toastId:y.id,height:it,position:y.position},...rn])},[q,y.title,y.description,E,y.id]);let Kt=be.useCallback(()=>{B(!0),gn(Tt.current),E(Oe=>Oe.filter(tt=>tt.toastId!==y.id)),setTimeout(()=>{R(y)},VO)},[y,R,E,Tt]);be.useEffect(()=>{if(y.promise&&nn==="loading"||y.duration===1/0||y.type==="loading")return;let Oe;return _||S||D&&Kr?(()=>{if(On.current{var tt;(tt=y.onAutoClose)==null||tt.call(y,y),Kt()},wn.current)),()=>clearTimeout(Oe)},[_,S,y,nn,D,Kr,Kt]),be.useEffect(()=>{y.delete&&Kt()},[Kt,y.delete]);function La(){var Oe,tt,it;return V!=null&&V.loading?be.createElement("div",{className:wr(re==null?void 0:re.loader,(Oe=y==null?void 0:y.classNames)==null?void 0:Oe.loader,"sonner-loader"),"data-visible":nn==="loading"},V.loading):Z?be.createElement("div",{className:wr(re==null?void 0:re.loader,(tt=y==null?void 0:y.classNames)==null?void 0:tt.loader,"sonner-loader"),"data-visible":nn==="loading"},Z):be.createElement(SO,{className:wr(re==null?void 0:re.loader,(it=y==null?void 0:y.classNames)==null?void 0:it.loader),visible:nn==="loading"})}return be.createElement("li",{tabIndex:0,ref:Zn,className:wr(Y,Da,re==null?void 0:re.toast,(n=y==null?void 0:y.classNames)==null?void 0:n.toast,re==null?void 0:re.default,re==null?void 0:re[nn],(a=y==null?void 0:y.classNames)==null?void 0:a[nn]),"data-sonner-toast":"","data-rich-colors":(o=y.richColors)!=null?o:L,"data-styled":!(y.jsx||y.unstyled||C),"data-mounted":q,"data-promise":!!y.promise,"data-swiped":Ke,"data-removed":me,"data-visible":po,"data-y-position":Oi,"data-x-position":Li,"data-index":T,"data-front":It,"data-swiping":ie,"data-dismissible":Dn,"data-type":nn,"data-invert":Oa,"data-swipe-out":Ce,"data-swipe-direction":X,"data-expanded":!!(_||ae&&q),style:{"--index":T,"--toasts-before":T,"--z-index":M.length-T,"--offset":`${me?Pt:Tt.current}px`,"--initial-height":ae?"auto":`${Yr}px`,...K,...y.style},onDragEnd:()=>{we(!1),H(null),Mt.current=null},onPointerDown:Oe=>{Mr||!Dn||(Xn.current=new Date,gn(Tt.current),Oe.target.setPointerCapture(Oe.pointerId),Oe.target.tagName!=="BUTTON"&&(we(!0),Mt.current={x:Oe.clientX,y:Oe.clientY}))},onPointerUp:()=>{var Oe,tt,it,rn;if(Ce||!Dn)return;Mt.current=null;let Ft=Number(((Oe=Zn.current)==null?void 0:Oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Rt=Number(((tt=Zn.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Jn=new Date().getTime()-((it=Xn.current)==null?void 0:it.getTime()),fn=$==="x"?Ft:Rt,Ln=Math.abs(fn)/Jn;if(Math.abs(fn)>=GO||Ln>.11){gn(Tt.current),(rn=y.onDismiss)==null||rn.call(y,y),xe($==="x"?Ft>0?"right":"left":Rt>0?"down":"up"),Kt(),ze(!0),ft(!1);return}we(!1),H(null)},onPointerMove:Oe=>{var tt,it,rn,Ft;if(!Mt.current||!Dn||((tt=window.getSelection())==null?void 0:tt.toString().length)>0)return;let Rt=Oe.clientY-Mt.current.y,Jn=Oe.clientX-Mt.current.x,fn=(it=t.swipeDirections)!=null?it:FO(se);!$&&(Math.abs(Jn)>1||Math.abs(Rt)>1)&&H(Math.abs(Jn)>Math.abs(Rt)?"x":"y");let Ln={x:0,y:0};$==="y"?(fn.includes("top")||fn.includes("bottom"))&&(fn.includes("top")&&Rt<0||fn.includes("bottom")&&Rt>0)&&(Ln.y=Rt):$==="x"&&(fn.includes("left")||fn.includes("right"))&&(fn.includes("left")&&Jn<0||fn.includes("right")&&Jn>0)&&(Ln.x=Jn),(Math.abs(Ln.x)>0||Math.abs(Ln.y)>0)&&ft(!0),(rn=Zn.current)==null||rn.style.setProperty("--swipe-amount-x",`${Ln.x}px`),(Ft=Zn.current)==null||Ft.style.setProperty("--swipe-amount-y",`${Ln.y}px`)}},Es&&!y.jsx?be.createElement("button",{"aria-label":O,"data-disabled":Mr,"data-close-button":!0,onClick:Mr||!Dn?()=>{}:()=>{var Oe;Kt(),(Oe=y.onDismiss)==null||Oe.call(y,y)},className:wr(re==null?void 0:re.closeButton,(c=y==null?void 0:y.classNames)==null?void 0:c.closeButton)},(l=V==null?void 0:V.close)!=null?l:MO):null,y.jsx||f.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:be.createElement(be.Fragment,null,nn||y.icon||y.promise?be.createElement("div",{"data-icon":"",className:wr(re==null?void 0:re.icon,(d=y==null?void 0:y.classNames)==null?void 0:d.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||La():null,y.type!=="loading"?y.icon||(V==null?void 0:V[nn])||jO(nn):null):null,be.createElement("div",{"data-content":"",className:wr(re==null?void 0:re.content,(m=y==null?void 0:y.classNames)==null?void 0:m.content)},be.createElement("div",{"data-title":"",className:wr(re==null?void 0:re.title,(p=y==null?void 0:y.classNames)==null?void 0:p.title)},typeof y.title=="function"?y.title():y.title),y.description?be.createElement("div",{"data-description":"",className:wr(ce,ho,re==null?void 0:re.description,(g=y==null?void 0:y.classNames)==null?void 0:g.description)},typeof y.description=="function"?y.description():y.description):null),f.isValidElement(y.cancel)?y.cancel:y.cancel&&Hu(y.cancel)?be.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||I,onClick:Oe=>{var tt,it;Hu(y.cancel)&&Dn&&((it=(tt=y.cancel).onClick)==null||it.call(tt,Oe),Kt())},className:wr(re==null?void 0:re.cancelButton,(v=y==null?void 0:y.classNames)==null?void 0:v.cancelButton)},y.cancel.label):null,f.isValidElement(y.action)?y.action:y.action&&Hu(y.action)?be.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||G,onClick:Oe=>{var tt,it;Hu(y.action)&&((it=(tt=y.action).onClick)==null||it.call(tt,Oe),!Oe.defaultPrevented&&Kt())},className:wr(re==null?void 0:re.actionButton,(b=y==null?void 0:y.classNames)==null?void 0:b.actionButton)},y.action.label):null))};function K0(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function qO(t,n){let a={};return[t,n].forEach((o,c)=>{let l=c===1,d=l?"--mobile-offset":"--offset",m=l?BO:UO;function p(g){["top","right","bottom","left"].forEach(v=>{a[`${d}-${v}`]=typeof g=="number"?`${g}px`:g})}typeof o=="number"||typeof o=="string"?p(o):typeof o=="object"?["top","right","bottom","left"].forEach(g=>{o[g]===void 0?a[`${d}-${g}`]=m:a[`${d}-${g}`]=typeof o[g]=="number"?`${o[g]}px`:o[g]}):p(m)}),a}var KO=f.forwardRef(function(t,n){let{invert:a,position:o="bottom-right",hotkey:c=["altKey","KeyT"],expand:l,closeButton:d,className:m,offset:p,mobileOffset:g,theme:v="light",richColors:b,duration:w,style:y,visibleToasts:C=IO,toastOptions:S,dir:E=K0(),gap:k=HO,loadingIcon:N,icons:T,containerAriaLabel:M="Notifications",pauseWhenPageIsHidden:_}=t,[R,L]=be.useState([]),te=be.useMemo(()=>Array.from(new Set([o].concat(R.filter(D=>D.position).map(D=>D.position)))),[R,o]),[K,I]=be.useState([]),[G,Y]=be.useState(!1),[ce,fe]=be.useState(!1),[se,P]=be.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=be.useRef(null),ae=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),re=be.useRef(null),V=be.useRef(!1),O=be.useCallback(D=>{L($=>{var H;return(H=$.find(X=>X.id===D.id))!=null&&H.delete||Tn.dismiss(D.id),$.filter(({id:X})=>X!==D.id)})},[]);return be.useEffect(()=>Tn.subscribe(D=>{if(D.dismiss){L($=>$.map(H=>H.id===D.id?{...H,delete:!0}:H));return}setTimeout(()=>{m8.flushSync(()=>{L($=>{let H=$.findIndex(X=>X.id===D.id);return H!==-1?[...$.slice(0,H),{...$[H],...D},...$.slice(H+1)]:[D,...$]})})})}),[]),be.useEffect(()=>{if(v!=="system"){P(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),typeof window>"u")return;let D=window.matchMedia("(prefers-color-scheme: dark)");try{D.addEventListener("change",({matches:$})=>{P($?"dark":"light")})}catch{D.addListener(({matches:H})=>{try{P(H?"dark":"light")}catch(X){console.error(X)}})}},[v]),be.useEffect(()=>{R.length<=1&&Y(!1)},[R]),be.useEffect(()=>{let D=$=>{var H,X;c.every(xe=>$[xe]||$.code===xe)&&(Y(!0),(H=Z.current)==null||H.focus()),$.code==="Escape"&&(document.activeElement===Z.current||(X=Z.current)!=null&&X.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[c]),be.useEffect(()=>{if(Z.current)return()=>{re.current&&(re.current.focus({preventScroll:!0}),re.current=null,V.current=!1)}},[Z.current]),be.createElement("section",{ref:n,"aria-label":`${M} ${ae}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},te.map((D,$)=>{var H;let[X,xe]=D.split("-");return R.length?be.createElement("ol",{key:D,dir:E==="auto"?K0():E,tabIndex:-1,ref:Z,className:m,"data-sonner-toaster":!0,"data-theme":se,"data-y-position":X,"data-lifted":G&&R.length>1&&!l,"data-x-position":xe,style:{"--front-toast-height":`${((H=K[0])==null?void 0:H.height)||0}px`,"--width":`${$O}px`,"--gap":`${k}px`,...y,...qO(p,g)},onBlur:q=>{V.current&&!q.currentTarget.contains(q.relatedTarget)&&(V.current=!1,re.current&&(re.current.focus({preventScroll:!0}),re.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||V.current||(V.current=!0,re.current=q.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{ce||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||fe(!0)},onPointerUp:()=>fe(!1)},R.filter(q=>!q.position&&$===0||q.position===D).map((q,ge)=>{var me,B;return be.createElement(YO,{key:q.id,icons:T,index:ge,toast:q,defaultRichColors:b,duration:(me=S==null?void 0:S.duration)!=null?me:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:a,visibleToasts:C,closeButton:(B=S==null?void 0:S.closeButton)!=null?B:d,interacting:ce,position:D,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,removeToast:O,toasts:R.filter(ie=>ie.position==q.position),heights:K.filter(ie=>ie.position==q.position),setHeights:I,expandByDefault:l,gap:k,loadingIcon:N,expanded:G,pauseWhenPageIsHidden:_,swipeDirections:t.swipeDirections})})):null}))});async function nd(t){const n=Dt.loading("Saving changes…");try{const a=await t();if(Dt.success("Changes saved",{id:n}),a.botRestart){const o=Dt.loading("Restarting bot…");a.botRestart.success?Dt.success("Bot started",{id:o}):Dt.error(a.botRestart.error??"Could not start bot",{id:o})}return a}catch(a){throw Dt.error(a instanceof Error?a.message:"Save failed",{id:n}),a}}function WO({filename:t}){const{canEditConfig:n}=qt(),a=!n("supportbot"),[o,c]=f.useState(null),[l,d]=f.useState(null),[m,p]=f.useState(!0),[g,v]=f.useState(!1),[b,w]=f.useState(""),[y,C]=f.useState(""),S=f.useCallback(async()=>{p(!0),w(""),C("");try{const _=(await Ne.getAddonConfigJson(t)).data??{};c(_),d(structuredClone(_))}catch(M){w(M instanceof Error?M.message:"Failed to load config")}finally{p(!1)}},[t]);f.useEffect(()=>{S()},[S]);const E=o?wO(o):null;function k(M,_){c(R=>R&&Gn(R,M,_))}async function N(){if(!(a||!o)){v(!0),w(""),C("");try{const M=await nd(()=>Ne.saveAddonConfig(t,o));C(M.message||"Saved."),await S()}catch(M){w(M instanceof Error?M.message:"Save failed")}finally{v(!1)}}}if(m)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-24 w-full rounded-xl"}),s.jsx(Be,{className:"h-48 w-full rounded-xl"})]});if(!o||!E)return s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:b||"Failed to load"})});const T=l&&JSON.stringify(o)!==JSON.stringify(l);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[T?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,s.jsx(ue,{variant:"outline",size:"sm",onClick:S,disabled:m||g,children:"Reload"}),a?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(ue,{size:"sm",onClick:N,disabled:g||!T,children:[s.jsx(ve,{icon:Sd,size:16,className:"mr-1.5"}),g?"Saving…":"Save"]})]}),b?s.jsxs(Ye,{variant:"destructive",children:[s.jsx(ve,{icon:ig,size:18}),s.jsx(qe,{children:b})]}):null,y?s.jsx(Ye,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(qe,{children:y})}):null,E.map(M=>s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsx(dt,{className:"text-base",children:M.title}),M.description?s.jsx(Ot,{children:M.description}):null]}),s.jsx(Qe,{className:"grid gap-4 sm:grid-cols-2",children:M.fields.map(_=>s.jsx("div",{className:_.type==="textarea"||_.type==="stringList"?"sm:col-span-2":"",children:s.jsx(pd,{field:_,value:Fr(o,_.path),readOnly:a,onChange:R=>k(_.path,R)})},_.path))})]},M.title))]})}function XO(t){return t.startsWith("Ticket.DepartmentSystem.")?"Ticket Departments":t.startsWith("Ticket.PrioritySystem.")?"Ticket Priorities":t.startsWith("Ticket.")?"Tickets":(t.split(".")[0]??"Other").replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,a=>a.toUpperCase())}function ZO(t,n){const a=new Set(t.flatMap(d=>d.fields.map(m=>m.path))),o=Nx(n).filter(d=>!a.has(d.path));if(o.length===0)return t;const c=t.map(d=>({...d,fields:[...d.fields]})),l=new Map;for(const d of o){const m=XO(d.path),p=l.get(m)??[];p.push(d),l.set(m,p)}for(const[d,m]of l.entries()){const p=c.find(g=>g.title.toLowerCase()===d.toLowerCase());p?p.fields.push(...m):c.push({title:d,description:"These options exist in your config file but are not in the main editor sections.",fields:m.sort((g,v)=>g.path.localeCompare(v.path))})}return c}function W0(t,n){(n==null||n>t.length)&&(n=t.length);for(var a=0,o=Array(n);a=t.length?t.apply(this,c):function(){for(var d=arguments.length,m=new Array(d),p=0;p1&&arguments[1]!==void 0?arguments[1]:{};Gu.initial(t),Gu.handler(n);var a={current:t},o=Al(wL)(a,n),c=Al(yL)(a),l=Al(Gu.changes)(t),d=Al(bL)(a);function m(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(v){return v};return Gu.selector(g),g(a.current)}function p(g){cL(o,c,l,d)(g)}return[m,p]}function bL(t,n){return Ql(n)?n(t.current):n}function yL(t,n){return t.current=J0(J0({},t.current),n),n}function wL(t,n,a){return Ql(n)?n(t.current):Object.keys(a).forEach(function(o){var c;return(c=n[o])===null||c===void 0?void 0:c.call(n,t.current[o])}),a}var jL={create:vL},CL={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function SL(t){return function n(){for(var a=this,o=arguments.length,c=new Array(o),l=0;l=t.length?t.apply(this,c):function(){for(var d=arguments.length,m=new Array(d),p=0;p{o.current=!1}:t,n)}var Yn=XL;function zl(){}function li(t,n,a,o){return ZL(t,o)||QL(t,n,a,o)}function ZL(t,n){return t.editor.getModel(l5(t,n))}function QL(t,n,a,o){return t.editor.createModel(n,a,o?l5(t,o):void 0)}function l5(t,n){return t.Uri.parse(n)}function JL({original:t,modified:n,language:a,originalLanguage:o,modifiedLanguage:c,originalModelPath:l,modifiedModelPath:d,keepCurrentOriginalModel:m=!1,keepCurrentModifiedModel:p=!1,theme:g="light",loading:v="Loading...",options:b={},height:w="100%",width:y="100%",className:C,wrapperProps:S={},beforeMount:E=zl,onMount:k=zl}){let[N,T]=f.useState(!1),[M,_]=f.useState(!0),R=f.useRef(null),L=f.useRef(null),te=f.useRef(null),K=f.useRef(k),I=f.useRef(E),G=f.useRef(!1);i5(()=>{let se=s5.init();return se.then(P=>(L.current=P)&&_(!1)).catch(P=>(P==null?void 0:P.type)!=="cancelation"&&console.error("Monaco initialization: error:",P)),()=>R.current?fe():se.cancel()}),Yn(()=>{if(R.current&&L.current){let se=R.current.getOriginalEditor(),P=li(L.current,t||"",o||a||"text",l||"");P!==se.getModel()&&se.setModel(P)}},[l],N),Yn(()=>{if(R.current&&L.current){let se=R.current.getModifiedEditor(),P=li(L.current,n||"",c||a||"text",d||"");P!==se.getModel()&&se.setModel(P)}},[d],N),Yn(()=>{let se=R.current.getModifiedEditor();se.getOption(L.current.editor.EditorOption.readOnly)?se.setValue(n||""):n!==se.getValue()&&(se.executeEdits("",[{range:se.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),se.pushUndoStop())},[n],N),Yn(()=>{var se,P;(P=(se=R.current)==null?void 0:se.getModel())==null||P.original.setValue(t||"")},[t],N),Yn(()=>{let{original:se,modified:P}=R.current.getModel();L.current.editor.setModelLanguage(se,o||a||"text"),L.current.editor.setModelLanguage(P,c||a||"text")},[a,o,c],N),Yn(()=>{var se;(se=L.current)==null||se.editor.setTheme(g)},[g],N),Yn(()=>{var se;(se=R.current)==null||se.updateOptions(b)},[b],N);let Y=f.useCallback(()=>{var Z;if(!L.current)return;I.current(L.current);let se=li(L.current,t||"",o||a||"text",l||""),P=li(L.current,n||"",c||a||"text",d||"");(Z=R.current)==null||Z.setModel({original:se,modified:P})},[a,n,c,t,o,l,d]),ce=f.useCallback(()=>{var se;!G.current&&te.current&&(R.current=L.current.editor.createDiffEditor(te.current,{automaticLayout:!0,...b}),Y(),(se=L.current)==null||se.editor.setTheme(g),T(!0),G.current=!0)},[b,g,Y]);f.useEffect(()=>{N&&K.current(R.current,L.current)},[N]),f.useEffect(()=>{!M&&!N&&ce()},[M,N,ce]);function fe(){var P,Z,ae,re;let se=(P=R.current)==null?void 0:P.getModel();m||((Z=se==null?void 0:se.original)==null||Z.dispose()),p||((ae=se==null?void 0:se.modified)==null||ae.dispose()),(re=R.current)==null||re.dispose()}return be.createElement(o5,{width:y,height:w,isEditorReady:N,loading:v,_ref:te,className:C,wrapperProps:S})}var ez=JL;f.memo(ez);function tz(t){let n=f.useRef();return f.useEffect(()=>{n.current=t},[t]),n.current}var nz=tz,Vu=new Map;function rz({defaultValue:t,defaultLanguage:n,defaultPath:a,value:o,language:c,path:l,theme:d="light",line:m,loading:p="Loading...",options:g={},overrideServices:v={},saveViewState:b=!0,keepCurrentModel:w=!1,width:y="100%",height:C="100%",className:S,wrapperProps:E={},beforeMount:k=zl,onMount:N=zl,onChange:T,onValidate:M=zl}){let[_,R]=f.useState(!1),[L,te]=f.useState(!0),K=f.useRef(null),I=f.useRef(null),G=f.useRef(null),Y=f.useRef(N),ce=f.useRef(k),fe=f.useRef(),se=f.useRef(o),P=nz(l),Z=f.useRef(!1),ae=f.useRef(!1);i5(()=>{let O=s5.init();return O.then(D=>(K.current=D)&&te(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>I.current?V():O.cancel()}),Yn(()=>{var D,$,H,X;let O=li(K.current,t||o||"",n||c||"",l||a||"");O!==((D=I.current)==null?void 0:D.getModel())&&(b&&Vu.set(P,($=I.current)==null?void 0:$.saveViewState()),(H=I.current)==null||H.setModel(O),b&&((X=I.current)==null||X.restoreViewState(Vu.get(l))))},[l],_),Yn(()=>{var O;(O=I.current)==null||O.updateOptions(g)},[g],_),Yn(()=>{!I.current||o===void 0||(I.current.getOption(K.current.editor.EditorOption.readOnly)?I.current.setValue(o):o!==I.current.getValue()&&(ae.current=!0,I.current.executeEdits("",[{range:I.current.getModel().getFullModelRange(),text:o,forceMoveMarkers:!0}]),I.current.pushUndoStop(),ae.current=!1))},[o],_),Yn(()=>{var D,$;let O=(D=I.current)==null?void 0:D.getModel();O&&c&&(($=K.current)==null||$.editor.setModelLanguage(O,c))},[c],_),Yn(()=>{var O;m!==void 0&&((O=I.current)==null||O.revealLine(m))},[m],_),Yn(()=>{var O;(O=K.current)==null||O.editor.setTheme(d)},[d],_);let re=f.useCallback(()=>{var O;if(!(!G.current||!K.current)&&!Z.current){ce.current(K.current);let D=l||a,$=li(K.current,o||t||"",n||c||"",D||"");I.current=(O=K.current)==null?void 0:O.editor.create(G.current,{model:$,automaticLayout:!0,...g},v),b&&I.current.restoreViewState(Vu.get(D)),K.current.editor.setTheme(d),m!==void 0&&I.current.revealLine(m),R(!0),Z.current=!0}},[t,n,a,o,c,l,g,v,b,d,m]);f.useEffect(()=>{_&&Y.current(I.current,K.current)},[_]),f.useEffect(()=>{!L&&!_&&re()},[L,_,re]),se.current=o,f.useEffect(()=>{var O,D;_&&T&&((O=fe.current)==null||O.dispose(),fe.current=(D=I.current)==null?void 0:D.onDidChangeModelContent($=>{ae.current||T(I.current.getValue(),$)}))},[_,T]),f.useEffect(()=>{if(_){let O=K.current.editor.onDidChangeMarkers(D=>{var H;let $=(H=I.current.getModel())==null?void 0:H.uri;if($&&D.find(X=>X.path===$.path)){let X=K.current.editor.getModelMarkers({resource:$});M==null||M(X)}});return()=>{O==null||O.dispose()}}return()=>{}},[_,M]);function V(){var O,D;(O=fe.current)==null||O.dispose(),w?b&&Vu.set(l,I.current.saveViewState()):(D=I.current.getModel())==null||D.dispose(),I.current.dispose()}return be.createElement(o5,{width:y,height:C,isEditorReady:_,loading:p,_ref:G,className:S,wrapperProps:E})}var az=rz,sz=f.memo(az),oz=sz;function iz(t){return t!==null&&typeof t=="object"&&"Command"in t}function lz(t){return Object.entries(t).filter(([,n])=>iz(n)).map(([n,a])=>({key:n,...a}))}function cz({data:t,onChange:n}){const a=lz(t);function o(c,l){const d=t[c];n({...t,[c]:{...d,...l}})}return a.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No commands found in this config."}):s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.map(c=>s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"flex flex-row items-center gap-2 space-y-0 pb-2",children:[s.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-primary/15 text-primary",children:s.jsx(ve,{icon:ds,size:18})}),s.jsx(dt,{className:"text-base",children:c.key})]}),s.jsxs(Qe,{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(_e,{htmlFor:`${c.key}-enabled`,children:"Enabled"}),s.jsx(kt,{id:`${c.key}-enabled`,checked:c.Enabled!==!1,onCheckedChange:l=>o(c.key,{Enabled:l})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{children:"Slash command"}),s.jsx(De,{value:c.Command??"",onChange:l=>o(c.key,{Command:l.target.value}),className:"border-border bg-secondary/30 font-mono"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{children:"Description"}),s.jsx(De,{value:c.Description??"",onChange:l=>o(c.key,{Description:l.target.value}),className:"border-border bg-secondary/30"})]})]})]},c.key))})}function uz(t,n){let a=structuredClone(n);if(t==="supportbot"){const o=Fr(a,"General.Token");o&&o!=="BOT_TOKEN"&&(a=Gn(a,"General.Token","BOT_TOKEN"))}if(t==="supportbot-ai"){const o=Fr(a,"General.Model_API_Key");o&&o!=="MODEL_API_KEY"&&(a=Gn(a,"General.Model_API_Key","MODEL_API_KEY"))}return a}function dz(t,n,a,o){const c={};for(const l of n)for(const d of l.fields){const m=Fr(a,d.path),p=Fr(o,d.path);d.type==="secret"&&(m==="BOT_TOKEN"||m==="MODEL_API_KEY"||m===""||m===void 0)||JSON.stringify(m)!==JSON.stringify(p)&&(c[`${t}:${d.path}`]=m)}return c}function fz(t,n){const a=new Map,o=[];for(const l of t){const d=l.path.split(".");if(d.length>=5&&d[1]==="DepartmentSystem"&&d[2]==="Departments"){const m=d[3],p=a.get(m)??[];p.push(l),a.set(m,p)}else if(d.length>=3){const m=d[1],p=a.get(m)??[];p.push(l),a.set(m,p)}else o.push(l)}if(a.size===0)return{standalone:t,groups:[]};const c=[...a.entries()].map(([l,d])=>{const m=["enabled","name","description","emoji","category","role","channelprefix","defaultpriority","questions"];d.sort((v,b)=>{var E,k;const w=((E=v.path.split(".").pop())==null?void 0:E.toLowerCase())||"",y=((k=b.path.split(".").pop())==null?void 0:k.toLowerCase())||"",C=m.indexOf(w),S=m.indexOf(y);return C!==-1&&S!==-1?C-S:C!==-1?-1:S!==-1?1:w.localeCompare(y)});const p=d.find(v=>v.path.toLowerCase().endsWith(".name")||v.path.toLowerCase().endsWith(".title"));let g="";if(p&&n){const v=Fr(n,p.path);typeof v=="string"&&v.trim()&&(g=v.trim())}return g||(g=l.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,v=>v.toUpperCase())),{key:l,name:g,fields:d}});return{standalone:o,groups:c}}function mz({configFile:t}){const{permissions:n,canEditConfig:a}=qt(),o=Mn(n,"configs.raw_yaml"),c=!a(t),[l,d]=f.useState(null),[m,p]=f.useState(null),[g,v]=f.useState(!0),[b,w]=f.useState(!1),[y,C]=f.useState(""),[S,E]=f.useState(""),[k,N]=f.useState("visual");f.useEffect(()=>{!o&&k==="yaml"&&N("visual")},[o,k]);const[T,M]=f.useState(""),[_,R]=f.useState(""),[L]=wd(),[te,K]=f.useState(()=>L.get("tab")||null),[I,G]=f.useState(!1),[Y,ce]=f.useState(""),[fe,se]=f.useState(""),P=()=>{const q=Y.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"");if(!q||!l)return;const ge=fe.trim()||q,me=`Ticket.DepartmentSystem.Departments.${q}`,B={...l};Gn(B,`${me}.Name`,ge),Gn(B,`${me}.Description`,`Open a ${ge} ticket`),Gn(B,`${me}.Emoji`,"🎫"),Gn(B,`${me}.Category`,"CATEGORY_ID"),Gn(B,`${me}.Role`,"ROLE_ID"),Gn(B,`${me}.ChannelPrefix`,`${q}-`),Gn(B,`${me}.DefaultPriority`,"normal"),Gn(B,`${me}.Questions`,["What do you need assistance with?"]),d(B),G(!1),ce(""),se("")},Z=q=>{if(!l)return;const ge=`Ticket.DepartmentSystem.Departments.${q}`,me=JSON.parse(JSON.stringify(l));if(Object.keys(me).forEach(B=>{(B.startsWith(ge)||B===ge)&&delete me[B]}),me.Ticket&&typeof me.Ticket=="object"){const B=me.Ticket.DepartmentSystem;B&&typeof B=="object"&&B.Departments&&typeof B.Departments=="object"&&delete B.Departments[q]}d(me)},ae=FM(t),re=f.useMemo(()=>!ae||ae==="commands"||!l?ae:ZO(ae,l),[ae,l]);f.useEffect(()=>{var q;if(re&&re!=="commands"){const ge=L.get("tab");if(ge&&re.find(me=>me.title.toLowerCase()===ge.toLowerCase())){const me=re.find(B=>B.title.toLowerCase()===ge.toLowerCase());me&&me.title!==te&&K(me.title)}else(!te||!re.find(me=>me.title===te))&&K(((q=re[0])==null?void 0:q.title)||null)}},[re,te,L]);const V=f.useCallback(async()=>{v(!0),C(""),E("");try{const ge=(await Ne.getConfigJson(t)).data??{},me=uz(t,ge);d(me),p(me);const ie=(await Ne.getConfigRaw(t)).data??"",we=z8(ie,t);M(we),R(we)}catch(q){C(q instanceof Error?q.message:"Failed to load config")}finally{v(!1)}},[t]);f.useEffect(()=>{V()},[V]);function O(q,ge){d(me=>me&&Gn(me,q,ge))}async function D(){if(!(c||T===_)){w(!0),C(""),E("");try{const q=await nd(()=>Ne.saveConfigRaw(t,T));E(q.message||"Config saved."),await V()}catch(q){C(q instanceof Error?q.message:"Save failed")}finally{w(!1)}}}async function $(){if(!(c||!l||!m)){if(k==="yaml"){await D();return}w(!0),C(""),E("");try{if(ae==="commands"){const q={};for(const me of Object.keys(l))JSON.stringify(l[me])!==JSON.stringify(m[me])&&(q[`${t}:${me}`]=l[me]);if(Object.keys(q).length===0){E("No changes to save.");return}const ge=await nd(()=>Ne.updateConfigFields(q));E(ge.message||"")}else if(re&&re!=="commands"){const q=dz(t,re,l,m);if(Object.keys(q).length===0){E("No changes to save.");return}const ge=await nd(()=>Ne.updateConfigFields(q));E(ge.message||"")}await V()}catch(q){C(q instanceof Error?q.message:"Save failed")}finally{w(!1)}}}if(ae===null)return s.jsx(Ye,{children:s.jsx(qe,{children:"No visual editor available for this file."})});if(g)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-24 w-full rounded-xl"}),s.jsx(Be,{className:"h-48 w-full rounded-xl"})]});if(!l)return s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:y||"Failed to load"})});const H=m&&JSON.stringify(l)!==JSON.stringify(m),xe=k==="yaml"?T!==_:H;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o?s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsx(ue,{type:"button",variant:k==="visual"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>N("visual"),children:"Visual"}),s.jsx(ue,{type:"button",variant:k==="yaml"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>N("yaml"),children:"YAML"})]}):null,s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[xe?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,s.jsx(ue,{variant:"outline",size:"sm",onClick:V,disabled:g||b,children:"Reload"}),c?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(ue,{size:"sm",onClick:$,disabled:b||!xe,children:[s.jsx(ve,{icon:Sd,size:16,className:"mr-1.5"}),b?"Saving…":"Save"]})]})]}),y?s.jsxs(Ye,{variant:"destructive",children:[s.jsx(ve,{icon:ig,size:18}),s.jsx(qe,{children:y})]}):null,S?s.jsx(Ye,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(qe,{children:S})}):null,k==="yaml"?s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsx(dt,{className:"text-base",children:"Raw YAML"}),s.jsx(Ot,{children:"Edit the full file. Use this for nested lists (e.g. welcome buttons) or any option not in Visual mode."})]}),s.jsx(Qe,{className:"h-[min(520px,60vh)] overflow-hidden rounded-b-xl border-t border-border p-0",children:s.jsx(oz,{height:"100%",language:"yaml",theme:"vs-dark",value:T,onChange:q=>M(q||""),options:{readOnly:c,minimap:{enabled:!1},fontSize:13,wordWrap:"on",scrollBeyondLastLine:!1,padding:{top:16},tabSize:2}})})]}):ae==="commands"?s.jsx(cz,{data:l,onChange:q=>d(q)}):re&&re!=="commands"?s.jsxs("div",{className:"grid gap-6 lg:grid-cols-[200px_1fr]",children:[s.jsx("nav",{className:"flex flex-col gap-1",children:re.map(q=>s.jsx("button",{onClick:()=>K(q.title),className:pe("text-left px-3 py-2 text-sm rounded-md transition-colors",te===q.title?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:q.title},q.title))}),s.jsx("div",{className:"min-w-0",children:re.filter(q=>q.title===te).map(q=>s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"pb-3 flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(dt,{className:"text-base",children:q.title}),q.description?s.jsx(Ot,{children:q.description}):null]}),q.title==="Ticket Departments"&&!c&&s.jsxs(ue,{type:"button",size:"sm",variant:"outline",onClick:()=>G(!0),className:"gap-1.5 text-xs h-8 shrink-0",children:[s.jsx(ve,{icon:sg,size:14})," Add Department"]})]}),s.jsx(Qe,{className:"space-y-6",children:(()=>{const{standalone:ge,groups:me}=fz(q.fields,l);return s.jsxs(s.Fragment,{children:[ge.length>0&&s.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:ge.map(B=>s.jsx("div",{className:B.type==="textarea"||B.type==="stringList"?"sm:col-span-2":"",children:s.jsx(pd,{field:B,value:Fr(l,B.path),readOnly:c,onChange:ie=>O(B.path,ie)})},B.path))}),me.map(B=>s.jsxs("div",{className:"rounded-xl border border-border bg-card/60 p-4 space-y-4 shadow-sm transition-all hover:border-primary/40",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 pb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-semibold text-base text-foreground",children:B.name}),s.jsx("span",{className:"text-xs font-mono px-2.5 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20 font-medium",children:q.title==="Ticket Departments"?`Ticket.${B.key}`:B.key})]}),q.title==="Ticket Departments"&&B.key!=="DepartmentSystem"&&!c&&s.jsx(ue,{type:"button",size:"sm",variant:"ghost",onClick:()=>Z(B.key),className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",title:"Delete Department",children:s.jsx(ve,{icon:wi,size:14})})]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:B.fields.map(ie=>s.jsx("div",{className:ie.type==="textarea"||ie.type==="stringList"?"sm:col-span-2":"",children:s.jsx(pd,{field:ie,value:Fr(l,ie.path),readOnly:c,onChange:we=>O(ie.path,we)})},ie.path))})]},B.key))]})})()})]},q.title))})]}):null,s.jsx(Qs,{open:I,onOpenChange:G,children:s.jsxs(hs,{className:"sm:max-w-[400px]",children:[s.jsxs(gs,{children:[s.jsx(xs,{className:"text-base",children:"Add Ticket Department"}),s.jsx(vs,{className:"text-xs",children:"Create a new support department for ticket creation."})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(_e,{className:"text-xs font-semibold",children:"Department Key (Internal ID)"}),s.jsx(De,{placeholder:"billing",value:Y,onChange:q=>ce(q.target.value.toLowerCase().replace(/[^a-z0-9_-]/g,"")),className:"text-xs font-mono border-border bg-secondary/30"}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["e.g. ",s.jsx("code",{children:"billing"}),", ",s.jsx("code",{children:"technical"}),", ",s.jsx("code",{children:"sales"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(_e,{className:"text-xs font-semibold",children:"Department Display Name"}),s.jsx(De,{placeholder:"Billing & Sales Support",value:fe,onChange:q=>se(q.target.value),className:"text-xs border-border bg-secondary/30"})]})]}),s.jsxs(Js,{className:"gap-2 sm:gap-0",children:[s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>G(!1),className:"text-xs",children:"Cancel"}),s.jsx(ue,{size:"sm",onClick:P,disabled:!Y.trim(),className:"text-xs bg-primary font-semibold",children:"Create Department"})]})]})})]})}const pz=Ne.listConfigs(),hz={supportbot:"Bot config","ticket-panel":"Ticket panel",commands:"Commands",messages:"Messages","supportbot-ai":"AI assistant"};function gz(){var T,M;const{permissions:t,canViewConfig:n}=qt(),{files:a}=$2(),[o,c]=wd(),l=o.get("file"),d=n("supportbot"),m=f.useMemo(()=>pz.filter(_=>n(_)),[n]),p=f.useMemo(()=>d?a:[],[d,a]),g=f.useMemo(()=>[...m,...p.map(_=>_l(_))],[m,p]),v=g[0]??"",[b,w]=f.useState(()=>l&&g.includes(l)?l:v);if(f.useEffect(()=>{l&&g.includes(l)?w(l):g.includes(b)||(w(v),v&&c({file:v}))},[l,g,b,v,c]),g.length===0)return s.jsx(ya,{to:mg(t),replace:!0});const y=H8(b),C=(y==null?void 0:y.type)==="addon",S=C?y.file:null,E=C?H2(S):hz[b]??"Configuration",k=C?!!((T=t==null?void 0:t.configs.supportbot)!=null&&T.edit):t?!!((M=t.configs[b])!=null&&M.edit):!1,N=C?S:`${b}.yml`;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:E}),s.jsx("p",{className:"text-muted-foreground",children:k?`Edit ${N} — changes apply to the running bot without restarting the dashboard.`:`Viewing ${N} — you do not have permission to save changes.`})]}),s.jsx("div",{className:"mt-6",children:C&&S?s.jsx(WO,{filename:S},S):s.jsx(mz,{configFile:b},b)})]})}const xz={oauth_not_configured:"Discord OAuth is not configured. Complete setup at /setup first.",not_allowed:"Your Discord account is not allowed. Ask an owner to add you under Users, or add your ID to OwnerUserIds in Configs/api.yml.",invalid_state:"Login session expired. Please try again.",missing_code:"Discord did not return an authorization code. Please try again.",oauth_failed:"Could not complete Discord sign-in. Check your OAuth settings.",access_denied:"You cancelled Discord sign-in."};function vz(t){return t?xz[t]||"Sign-in failed. Please try again.":""}function bz(){const{branding:t}=Ed(),{isAuthenticated:n,loading:a,loginWithDiscord:o}=qt(),[c]=wd(),l=f.useMemo(()=>vz(c.get("error")),[c]);return!a&&n?s.jsx(ya,{to:"/",replace:!0}):s.jsx("div",{className:"relative flex min-h-svh items-center justify-center bg-[#0c0c10] p-4 overflow-hidden",children:s.jsxs(Ze,{className:"relative z-10 w-full max-w-md overflow-hidden rounded-3xl border border-white/10 bg-card/30 p-2 shadow-2xl backdrop-blur-2xl",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/5 to-transparent pointer-events-none"}),s.jsxs(ut,{className:"space-y-6 pt-10 pb-4 text-center",children:[s.jsx("div",{className:"mx-auto flex size-28 items-center justify-center overflow-hidden rounded-3xl bg-white/5 p-4 shadow-inner ring-1 ring-white/10 transition-transform duration-500 hover:scale-105",children:s.jsx("img",{src:"/logo.png",alt:"SupportBot Logo",className:"h-full w-full object-contain drop-shadow-xl"})}),s.jsxs("div",{children:[s.jsx(dt,{className:"bg-gradient-to-br from-white to-white/50 bg-clip-text text-3xl font-extrabold tracking-tight text-transparent",children:t.title||"SupportBot"}),s.jsx(Ot,{className:"mt-2 text-base font-medium text-white/50",children:"Sign in to your dashboard"})]})]}),s.jsxs(Qe,{className:"space-y-6 pb-10",children:[s.jsxs("div",{className:"text-center space-y-1",children:[s.jsx("p",{className:"text-sm font-medium text-white/50",children:"Securely authenticate using your Discord account."}),s.jsxs("p",{className:"text-xs text-white/30",children:["Credentials are configured in ",s.jsx("code",{className:"rounded bg-white/5 px-1 py-0.5 text-white/40",children:"Configs/api.yml"})]})]}),l?s.jsx(Ye,{variant:"destructive",className:"border-red-500/50 bg-red-500/10 text-red-200 backdrop-blur-md",children:s.jsx(qe,{className:"font-medium",children:l})}):null,s.jsxs(ue,{type:"button",className:"group relative w-full overflow-hidden rounded-2xl bg-primary px-8 py-6 text-base font-bold text-primary-foreground shadow-[0_0_20px_rgba(var(--primary),0.3)] transition-all duration-300 hover:scale-[1.02] hover:shadow-[0_0_30px_rgba(var(--primary),0.5)] active:scale-95",disabled:a,onClick:o,children:[s.jsx("div",{className:"absolute inset-0 translate-x-[-100%] bg-gradient-to-r from-transparent via-white/20 to-transparent transition-transform duration-1000 group-hover:translate-x-[100%]"}),s.jsxs("span",{className:"relative flex items-center justify-center gap-2",children:[s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 127.14 96.36",fill:"currentColor",children:s.jsx("path",{d:"M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1,105.25,105.25,0,0,0,32.19-16.14c2.64-27.38-4.51-51.11-19.32-72.15ZM42.68,68.22c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C52.34,63.32,48.09,68.22,42.68,68.22Zm41.76,0c-5.28,0-9.66-4.9-9.66-10.89s4.29-10.89,9.66-10.89c5.41,0,9.75,4.9,9.66,10.89C84.44,63.32,80.19,68.22,84.44,68.22Z"})}),a?"Authenticating...":"Continue with Discord"]})]})]})]})})}const mi=[{id:"botToken",title:"Bot token",subtitle:"Connect your Discord bot",icon:cg},{id:"database",title:"Database",subtitle:"SQLite or MySQL engine",icon:x8},{id:"secretKey",title:"Session secret",subtitle:"Secure dashboard logins",icon:M8},{id:"oauth",title:"Discord OAuth",subtitle:"Sign in with Discord",icon:By},{id:"redirectUri",title:"Redirect URL",subtitle:"OAuth callback address",icon:Nd},{id:"owners",title:"Dashboard owners",subtitle:"Who can access this panel",icon:rh},{id:"emeraldApi",title:"Emerald API",subtitle:"One-click addons",icon:By}];function yz(t){return t==="oauth"?"oauth":t==="owners"?"owners":t}function wz({brandingTitle:t,faviconUrl:n,faviconVersion:a,hasFavicon:o,children:c}){return s.jsx("div",{className:"min-h-svh bg-background",children:s.jsxs("div",{className:"mx-auto flex min-h-svh max-w-6xl flex-col px-4 py-6 md:px-8 md:py-10",children:[s.jsxs("header",{className:"mb-8 flex items-center gap-4",children:[o&&n?s.jsx("img",{src:`${n}${a?`?v=${a}`:""}`,alt:"",className:"size-12 rounded-2xl border border-border object-contain"}):s.jsx("div",{className:"flex size-12 items-center justify-center rounded-2xl border border-border bg-primary text-primary-foreground",children:s.jsx(ve,{icon:cg,size:24})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"First-time setup"}),s.jsx("h1",{className:"text-2xl font-semibold tracking-tight md:text-3xl",children:t})]})]}),c]})})}function jz({currentIndex:t,validation:n}){const a=(t+1)/mi.length*100;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Step ",t+1," of ",mi.length]}),s.jsxs("span",{children:[Math.round(a),"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-secondary",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300 ease-out",style:{width:`${a}%`}})})]}),s.jsx("nav",{className:"hidden space-y-1 md:block","aria-label":"Setup steps",children:mi.map((o,c)=>{var g;const l=yz(o.id),d=(g=n[l])==null?void 0:g.ok,m=c===t,p=cs.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(ve,{icon:jd,size:14}),o.globalName||o.username,s.jsx("span",{className:"font-mono text-xs opacity-80",children:o.id})]},o.id))}):null,!t.bot&&!((a=t.users)!=null&&a.length)?s.jsx("p",{children:t.warning||"Verified successfully."}):null]})}):s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:t.error})}):null}function Sz({values:t,setValues:n,validation:a,validating:o,onValidate:c}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Open the"," ",s.jsx("a",{href:"https://discord.com/developers/applications",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:"Discord Developer Portal"}),", select your application, go to ",s.jsx("strong",{children:"Bot"}),", and reset or copy the token."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"botToken",children:"Bot token"}),s.jsx(De,{id:"botToken",type:"password",autoComplete:"off",value:t.botToken,onChange:l=>n({...t,botToken:l.target.value}),placeholder:"MTI…",className:"h-11 font-mono text-sm"})]}),s.jsx(mo,{result:a.botToken}),s.jsx("div",{className:"mt-auto",children:s.jsx(ue,{type:"button",variant:"secondary",disabled:o||!t.botToken,onClick:c,children:o?"Checking with Discord…":"Verify bot token"})})]})}function Nz({values:t,setValues:n,validation:a,validating:o,onValidate:c,onGenerate:l}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:"This random string signs your login cookies. Store it like a password — do not commit it to public repos."}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"secretKey",children:"Session secret"}),s.jsx(De,{id:"secretKey",type:"password",autoComplete:"off",value:t.secretKey,onChange:d=>n({...t,secretKey:d.target.value}),className:"h-11 font-mono text-sm"})]}),s.jsx(mo,{result:a.secretKey}),s.jsxs("div",{className:"mt-auto flex flex-wrap gap-2",children:[s.jsx(ue,{type:"button",variant:"outline",onClick:l,children:"Generate secure secret"}),s.jsx(ue,{type:"button",variant:"secondary",disabled:o||!t.secretKey,onClick:c,children:o?"Checking…":"Validate"})]})]})}function Ez({values:t,setValues:n,validation:a,validating:o,onValidate:c}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Use the ",s.jsx("strong",{children:"same application"})," as your bot. Under OAuth2, copy the Client ID and Client Secret."]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(_e,{htmlFor:"clientId",children:"Client ID"}),s.jsx(De,{id:"clientId",value:t.clientId,onChange:l=>n({...t,clientId:l.target.value}),className:"h-11 font-mono text-sm"})]}),s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(_e,{htmlFor:"clientSecret",children:"Client Secret"}),s.jsx(De,{id:"clientSecret",type:"password",autoComplete:"off",value:t.clientSecret,onChange:l=>n({...t,clientSecret:l.target.value}),className:"h-11 font-mono text-sm"})]})]}),s.jsx(mo,{result:a.oauth}),s.jsx("div",{className:"mt-auto",children:s.jsx(ue,{type:"button",variant:"secondary",disabled:o||!t.clientId||!t.clientSecret,onClick:c,children:o?"Checking with Discord…":"Verify OAuth credentials"})})]})}function kz({values:t,setValues:n,validation:a}){async function o(){if(t.redirectUri)try{await navigator.clipboard.writeText(t.redirectUri)}catch{}}return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Add this exact URL under ",s.jsx("strong",{children:"OAuth2 → Redirects"})," in the Developer Portal. It must match character-for-character."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"redirectUri",children:"Redirect URI"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(De,{id:"redirectUri",value:t.redirectUri,onChange:c=>n({...t,redirectUri:c.target.value}),className:"h-11 flex-1 font-mono text-xs"}),s.jsx(ue,{type:"button",variant:"outline",size:"icon",className:"size-11 shrink-0",onClick:()=>void o(),title:"Copy URL",children:s.jsx(ve,{icon:R2,size:18})})]})]}),a.redirectUri&&!a.redirectUri.ok?s.jsx(mo,{result:a.redirectUri}):s.jsx(Ye,{className:"border-border bg-secondary",children:s.jsx(qe,{className:"text-sm text-muted-foreground",children:"We pre-filled this from your current dashboard URL. If you access the panel from a different domain later, update this and add the new URL in Discord too."})})]})}function Tz({values:t,setValues:n,validation:a,validating:o,onValidate:c}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Enable ",s.jsx("strong",{children:"Developer Mode"})," in Discord (Settings → Advanced), then right-click your profile and ",s.jsx("strong",{children:"Copy User ID"}),". Add one ID per line."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"owners",children:"Owner user IDs"}),s.jsx(Jd,{id:"owners",value:t.ownerUserIds,onChange:l=>n({...t,ownerUserIds:l.target.value}),placeholder:`829112572816130058 +987654321098765432`,className:"min-h-[120px] font-mono text-sm"})]}),s.jsx(mo,{result:a.owners}),s.jsx("div",{className:"mt-auto",children:s.jsx(ue,{type:"button",variant:"secondary",disabled:o||!t.ownerUserIds.trim(),onClick:c,children:o?"Checking with Discord…":"Verify owner IDs"})})]})}function Mz({onContinue:t}){return s.jsx("div",{className:"mx-auto flex w-full max-w-lg flex-1 flex-col justify-center py-8",children:s.jsxs("div",{className:"rounded-2xl border border-border bg-card px-6 py-10 text-center md:px-10",children:[s.jsx("div",{className:"mx-auto mb-6 flex size-16 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:s.jsx(ve,{icon:jd,size:40})}),s.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Setup complete"}),s.jsxs("p",{className:"mx-auto mt-3 max-w-sm text-sm leading-relaxed text-muted-foreground",children:["Your configuration has been saved. Restart the server for changes to take effect — stop the running process, then start it again (for example"," ",s.jsx("code",{className:"rounded-md bg-muted px-1.5 py-0.5 font-mono text-xs",children:"npm start"}),")."]}),s.jsx(Ye,{className:"mt-6 text-left",children:s.jsx(qe,{children:"After restarting, sign in with Discord to open the dashboard."})}),s.jsx(ue,{type:"button",size:"lg",className:"mt-8 min-w-[220px]",onClick:t,children:"Continue to sign in"})]})})}function Rz({currentIndex:t,validating:n,saving:a,onBack:o,onNext:c,onFinish:l}){const d=t===mi.length-1;return s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs(ue,{type:"button",variant:"ghost",disabled:t===0||a,onClick:o,children:[s.jsx(ve,{icon:T2,size:18,className:"mr-1"}),"Back"]}),s.jsx("div",{className:"flex flex-1 justify-end gap-2",children:d?s.jsx(ue,{type:"button",size:"lg",disabled:a||n,onClick:l,className:"min-w-[200px]",children:a?"Saving…":"Finish setup"}):s.jsxs(ue,{type:"button",size:"lg",disabled:n||a,onClick:c,children:["Continue",s.jsx(ve,{icon:lg,size:18,className:"ml-1"})]})})]})}function Az({values:t,setValues:n,validation:a,validating:o,onValidate:c}){return s.jsxs("div",{className:"flex flex-1 flex-col gap-5",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["An Emerald Services API key is optional, but required to use the one-click addon installer in the dashboard. You can get yours from the"," ",s.jsx("a",{href:"https://emeraldsrv.dev",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:"Emerald Services Marketplace"}),"."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"emeraldApiKey",children:"Emerald API key (Optional)"}),s.jsx(De,{id:"emeraldApiKey",type:"password",autoComplete:"off",value:t.emeraldApiKey,onChange:l=>n({...t,emeraldApiKey:l.target.value}),placeholder:"em_...",className:"h-11 font-mono text-sm"})]}),s.jsx(mo,{result:a.emeraldApi}),s.jsx("div",{className:"mt-auto",children:s.jsx(ue,{type:"button",variant:"secondary",disabled:o,onClick:c,children:o?"Checking…":t.emeraldApiKey?"Verify key":"Skip step"})})]})}function _z({values:t,setValues:n,validation:a,validating:o,onValidate:c}){const l=a.database,d=t.dbDriver==="mysql";return s.jsxs("div",{className:"flex flex-1 flex-col gap-6",children:[s.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:["Choose your database storage engine. Select ",s.jsx("strong",{children:"SQLite"})," for instant zero-config local storage, or ",s.jsx("strong",{children:"MySQL / MariaDB"})," for external host databases."]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{onClick:()=>n(m=>({...m,dbDriver:"sqlite"})),className:pe("cursor-pointer rounded-xl border p-4 transition-all hover:border-primary",t.dbDriver==="sqlite"?"border-primary bg-primary/5 ring-2 ring-primary/20":"border-border bg-card"),children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"font-semibold text-foreground",children:"SQLite"}),s.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-xs font-medium text-emerald-500",children:"Zero Config"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Single-file SQL database stored locally at ",s.jsx("code",{className:"font-mono",children:"./Data/supportbot.db"}),". Zero extra setup required."]})]}),s.jsxs("div",{onClick:()=>n(m=>({...m,dbDriver:"mysql"})),className:pe("cursor-pointer rounded-xl border p-4 transition-all hover:border-primary",t.dbDriver==="mysql"?"border-primary bg-primary/5 ring-2 ring-primary/20":"border-border bg-card"),children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"font-semibold text-foreground",children:"MySQL / MariaDB"}),s.jsx("span",{className:"rounded-full bg-blue-500/10 px-2.5 py-0.5 text-xs font-medium text-blue-500",children:"External Database"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to a remote or local MySQL database server."})]})]}),d&&s.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card/50 p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"MySQL Connection Settings"}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(_e,{htmlFor:"dbHost",children:"Database Host"}),s.jsx(De,{id:"dbHost",placeholder:"127.0.0.1 or localhost",value:t.dbHost,onChange:m=>n(p=>({...p,dbHost:m.target.value})),className:"h-11 text-sm"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"dbPort",children:"Port"}),s.jsx(De,{id:"dbPort",placeholder:"3306",value:t.dbPort,onChange:m=>n(p=>({...p,dbPort:m.target.value})),className:"h-11 text-sm font-mono"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"dbDatabase",children:"Database Name"}),s.jsx(De,{id:"dbDatabase",placeholder:"supportbot",value:t.dbDatabase,onChange:m=>n(p=>({...p,dbDatabase:m.target.value})),className:"h-11 text-sm"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"dbUser",children:"Database User"}),s.jsx(De,{id:"dbUser",placeholder:"root",value:t.dbUser,onChange:m=>n(p=>({...p,dbUser:m.target.value})),className:"h-11 text-sm font-mono"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"dbPassword",children:"Password"}),s.jsx(De,{id:"dbPassword",type:"password",placeholder:"••••••••••••",value:t.dbPassword,onChange:m=>n(p=>({...p,dbPassword:m.target.value})),className:"h-11 text-sm font-mono"})]})]})]}),s.jsx(mo,{result:l}),s.jsx("div",{className:"mt-auto",children:s.jsx(ue,{type:"button",variant:"secondary",disabled:o,onClick:c,children:o?"Testing Connection...":"Test Connection & Validate"})})]})}function Dz(){const t=crypto.randomUUID().replace(/-/g,""),n=crypto.randomUUID().replace(/-/g,"");return t+n}function Oz(t){return t.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean)}function t2(t){return t==="oauth"?"oauth":t==="owners"?"owners":t==="database"?"database":t==="emeraldApi"?"emeraldApi":t}function Lz(){const t=ao(),{branding:n}=Ed(),{loading:a,error:o,refresh:c,status:l}=fS(),[d,m]=f.useState(0),[p,g]=f.useState({botToken:"",dbDriver:"sqlite",dbHost:"127.0.0.1",dbPort:"3306",dbUser:"",dbPassword:"",dbDatabase:"supportbot",secretKey:"",clientId:"",clientSecret:"",redirectUri:"",ownerUserIds:"",emeraldApiKey:""}),[v,b]=f.useState({}),[w,y]=f.useState(!1),[C,S]=f.useState(!1),[E,k]=f.useState(""),[N,T]=f.useState(!1),M=mi[d];f.useEffect(()=>{l!=null&&l.suggestedRedirectUri&&!p.redirectUri&&g(G=>({...G,redirectUri:l.suggestedRedirectUri}))},[l==null?void 0:l.suggestedRedirectUri,p.redirectUri]);const _=f.useMemo(()=>({botToken:p.botToken,dbDriver:p.dbDriver,dbHost:p.dbHost,dbPort:p.dbPort,dbUser:p.dbUser,dbPassword:p.dbPassword,dbDatabase:p.dbDatabase,secretKey:p.secretKey,clientId:p.clientId,clientSecret:p.clientSecret,redirectUri:p.redirectUri,ownerUserIds:Oz(p.ownerUserIds),emeraldApiKey:p.emeraldApiKey}),[p]);async function R(){y(!0),k("");try{const G=await Ne.validateSetup(_);return b(Y=>{var ce;return{...Y,...(ce=G.data)==null?void 0:ce.results}}),G.data}catch(G){return k(G instanceof Error?G.message:"Validation failed"),null}finally{y(!1)}}async function L(){var ce,fe;const G=t2(M.id),Y=await R();return!!((fe=(ce=Y==null?void 0:Y.results)==null?void 0:ce[G])!=null&&fe.ok)}async function te(){const G=t2(M.id),Y=v[G];!(Y!=null&&Y.ok)&&!await L()||m(ce=>Math.min(ce+1,mi.length-1))}async function K(){S(!0),k("");try{const G=await R();if(!(G!=null&&G.ok)){k("Fix the steps marked with errors before finishing.");return}await Ne.completeSetup(_),T(!0)}catch(G){k(G instanceof Error?G.message:"Could not save setup")}finally{S(!1)}}function I(){const G={values:p,setValues:g,validation:v,validating:w};switch(M.id){case"botToken":return s.jsx(Sz,{...G,onValidate:()=>void L()});case"database":return s.jsx(_z,{...G,onValidate:()=>void L()});case"secretKey":return s.jsx(Nz,{...G,onGenerate:()=>g(Y=>({...Y,secretKey:Dz()})),onValidate:()=>void L()});case"oauth":return s.jsx(Ez,{...G,onValidate:()=>void L()});case"redirectUri":return s.jsx(kz,{values:p,setValues:g,validation:v});case"owners":return s.jsx(Tz,{...G,onValidate:()=>void L()});case"emeraldApi":return s.jsx(Az,{...G,onValidate:()=>void L()})}}return a?s.jsx("div",{className:"min-h-svh bg-background px-4 py-10",children:s.jsxs("div",{className:"mx-auto max-w-6xl space-y-8",children:[s.jsx(Be,{className:"h-14 w-64"}),s.jsxs("div",{className:"grid gap-8 lg:grid-cols-[280px_1fr]",children:[s.jsx(Be,{className:"hidden h-80 lg:block"}),s.jsx(Be,{className:"h-[520px] rounded-2xl"})]})]})}):s.jsxs(wz,{brandingTitle:n.title,faviconUrl:n.faviconUrl,faviconVersion:n.updatedAt??void 0,hasFavicon:n.hasFavicon,children:[o?s.jsx(Ye,{variant:"destructive",className:"mb-6",children:s.jsx(qe,{children:o})}):null,E?s.jsx(Ye,{variant:"destructive",className:"mb-6",children:s.jsx(qe,{children:E})}):null,N?s.jsx(Mz,{onContinue:async()=>{await c(),t("/login",{replace:!0})}}):s.jsxs("div",{className:"grid flex-1 gap-8 lg:grid-cols-[minmax(0,280px)_1fr]",children:[s.jsx(jz,{currentIndex:d,validation:v}),s.jsx(Cz,{step:M,footer:s.jsx(Rz,{currentIndex:d,validating:w,saving:C,onBack:()=>m(G=>Math.max(0,G-1)),onNext:()=>void te(),onFinish:()=>void K()}),children:I()})]})]})}const zz={todo:"bg-rose-500/15 text-rose-400",progress:"bg-amber-500/15 text-amber-400",done:"bg-emerald-500/15 text-emerald-400"};function Pz({title:t,icon:n,href:a,badge:o="Configured",status:c="done"}){return s.jsxs(Jt,{to:a,className:pe("flex items-center gap-3 rounded-2xl border border-border bg-card p-4 transition-colors","hover:border-primary hover:bg-secondary"),children:[s.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-full bg-secondary text-primary",children:s.jsx(ve,{icon:n,size:20})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate font-semibold",children:t}),s.jsx("span",{className:pe("mt-1 inline-flex rounded-md px-2 py-0.5 text-[10px] font-semibold",zz[c]),children:o})]})]})}function Iz({percent:t,size:n=128,className:a,trackClassName:o="stroke-white/20",strokeClassName:c="stroke-white"}){const d=2*Math.PI*42,m=Math.min(100,Math.max(0,t)),p=d-m/100*d;return s.jsxs("div",{className:pe("relative inline-flex",a),children:[s.jsxs("svg",{width:n,height:n,viewBox:"0 0 100 100",className:"-rotate-90","aria-hidden":!0,children:[s.jsx("circle",{cx:"50",cy:"50",r:42,fill:"none",strokeWidth:"9",className:o}),s.jsx("circle",{cx:"50",cy:"50",r:42,fill:"none",strokeWidth:"9",strokeLinecap:"round",strokeDasharray:d,strokeDashoffset:p,className:c})]}),s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center",children:[s.jsxs("span",{className:"text-2xl font-bold tabular-nums leading-none",children:[Math.round(m),"%"]}),s.jsx("span",{className:"mt-0.5 text-[10px] font-medium uppercase tracking-wide opacity-80",children:"Complete"})]})]})}const Uz={todo:{dot:"bg-rose-500",badge:"bg-rose-500/15 text-rose-400",label:"Needs setup"},progress:{dot:"bg-amber-400",badge:"bg-amber-500/15 text-amber-400",label:"In progress"},done:{dot:"bg-sky-400",badge:"bg-sky-500/15 text-sky-400",label:"Active"}};function Bz({title:t,subtitle:n,icon:a,href:o,status:c,meta:l="Open in dashboard"}){const d=Uz[c];return s.jsxs(Jt,{to:o,className:pe("group flex min-w-[280px] flex-1 flex-col gap-4 rounded-2xl border border-border bg-card p-4 transition-colors","hover:border-primary hover:bg-secondary","sm:min-w-[300px] lg:min-w-0"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("span",{className:pe("mt-1.5 size-2 shrink-0 rounded-full",d.dot)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:n})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold leading-snug tracking-tight",children:t}),s.jsx("span",{className:pe("mt-2 inline-flex rounded-md px-2 py-0.5 text-[11px] font-semibold",d.badge),children:d.label})]}),s.jsxs("div",{className:"mt-auto flex items-center justify-between border-t border-border pt-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-secondary text-primary",children:s.jsx(ve,{icon:a,size:16})}),s.jsx("span",{className:"text-xs text-muted-foreground",children:l})]}),s.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[s.jsx(ve,{icon:Nd,size:14,className:"opacity-60"}),s.jsx(ve,{icon:qs,size:14,className:"opacity-60 group-hover:text-primary"}),s.jsx(ve,{icon:lg,size:14,className:"text-primary opacity-0 transition-opacity group-hover:opacity-100"})]})]})]})}function $z({stats:t}){const n=[{id:"ping",label:"Gateway latency",detail:`${t.bot.ping}ms`,badge:t.bot.ping<200?"Good":"High",badgeClass:t.bot.ping<200?"bg-emerald-500/15 text-emerald-400":"bg-amber-500/15 text-amber-400"},{id:"uptime",label:"Bot uptime",detail:fg(t.bot.uptime),badge:"Live",badgeClass:"bg-primary/20 text-primary"},{id:"ram",label:"Memory usage",detail:`${t.hosting.ram_used} / ${t.hosting.ram_total}`,badge:`${t.hosting.ram_percent}%`,badgeClass:"bg-sky-500/15 text-sky-400"}];return s.jsxs("aside",{className:"hidden w-[min(100%,320px)] shrink-0 space-y-4 xl:block",children:[s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between space-y-0 pb-3",children:[s.jsxs(dt,{className:"text-sm font-semibold",children:["Connected servers (",t.servers,")"]}),s.jsx(ue,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",children:s.jsx("span",{className:"text-lg leading-none",children:"+"})})]}),s.jsxs(Qe,{className:"pt-0",children:[s.jsxs("div",{className:"flex -space-x-2",children:[Array.from({length:Math.min(6,t.servers)}).map((a,o)=>s.jsxs(bs,{className:"size-9 border-2 border-card ring-0",children:[s.jsx(eo,{src:t.bot.avatar,alt:""}),s.jsx(ys,{className:"bg-primary/25 text-[10px] text-primary",children:String(o+1)})]},o)),t.servers>6?s.jsxs("div",{className:"flex size-9 items-center justify-center rounded-full border-2 border-card bg-secondary text-xs font-medium text-muted-foreground",children:["+",t.servers-6]}):null]}),s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[t.users.toLocaleString()," members across your guilds"]})]})]}),s.jsx(Ze,{className:"overflow-hidden border-border bg-secondary",children:s.jsx(Qe,{className:"p-5",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground",children:s.jsx(ve,{icon:T8,size:22})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:"Keep SupportBot up to date"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Check for releases and install updates from settings."})]}),s.jsx(ue,{asChild:!0,size:"sm",className:"w-full",children:s.jsxs(Jt,{to:"/settings",children:[s.jsx(ve,{icon:Cd,size:16,className:"mr-2"}),"Open settings"]})})]})})}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(dt,{className:"text-sm font-semibold",children:"System activity"}),s.jsx(ue,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",children:s.jsx("span",{className:"text-base leading-none",children:"⋯"})})]}),s.jsxs(Qe,{className:"space-y-1 p-0 pb-2",children:[n.map(a=>s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-secondary/40",children:[s.jsxs(bs,{className:"size-9",children:[s.jsx(eo,{src:t.bot.avatar,alt:t.bot.username}),s.jsx(ys,{className:"bg-secondary text-xs",children:"SB"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:a.label}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.detail})]}),s.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ${a.badgeClass}`,children:a.badge})]},a.id)),s.jsx(ue,{asChild:!0,variant:"ghost",className:"mx-2 mt-1 w-[calc(100%-1rem)] justify-between text-xs text-muted-foreground",children:s.jsxs(Jt,{to:"/system",children:["All system details",s.jsx(ve,{icon:lg,size:14})]})})]})]}),s.jsx(Ze,{className:"border-border bg-card",children:s.jsxs(Qe,{className:"flex items-center gap-3 p-4",children:[s.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-secondary text-primary",children:s.jsx(ve,{icon:qs,size:18})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-sm font-medium",children:["v",t.bot.version]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["CPU ",t.hosting.cpu_load]})]})]})})]})}const c5={todo:"Needs setup",progress:"In progress",done:"Active"};function Kh(t,n,a="Configure module"){const o=n==null?void 0:n[t];return o||{status:"todo",subtitle:a}}function Hz(){return s.jsxs("div",{className:"flex gap-6",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-6",children:[s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-44 rounded-2xl"}),s.jsx(Be,{className:"h-44 rounded-2xl"})]}),s.jsx(Be,{className:"h-8 w-48"}),s.jsx("div",{className:"flex gap-4 overflow-hidden",children:Array.from({length:3}).map((t,n)=>s.jsx(Be,{className:"h-40 min-w-[280px] rounded-2xl"},n))}),s.jsx(Be,{className:"h-8 w-56"}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Array.from({length:4}).map((t,n)=>s.jsx(Be,{className:"h-20 rounded-2xl"},n))})]}),s.jsx(Be,{className:"hidden h-[520px] w-80 shrink-0 rounded-2xl xl:block"})]})}function Gz(){const{stats:t,loading:n,error:a}=kd(),[o,c]=f.useState("all"),l=f.useMemo(()=>{if(!t)return 0;const v=t.tickets.total||0;return v===0?100:Math.round(t.tickets.closed/v*100)},[t]),d=f.useMemo(()=>o==="open"||o==="closed"?ii.filter(v=>v.category==="tickets"):o==="all"?ii:ii.filter(v=>v.category===o),[o]);if(n)return s.jsx(Hz,{});if(a||!t)return s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:a||"No stats available"})});const m=t.tickets.open,p=t.tickets.closed,g=t.tickets.total;return s.jsxs("div",{className:"flex flex-col gap-6 xl:flex-row xl:items-start",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-6",children:[s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Ze,{className:"overflow-hidden border-border bg-card",children:s.jsxs(Qe,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("p",{className:"text-lg font-semibold leading-snug",children:["You have"," ",s.jsx("span",{className:"text-primary",children:m})," open ticket",m===1?"":"s"]}),s.jsx("p",{className:"max-w-xs text-sm text-muted-foreground",children:"Review transcripts or tune your ticket panel so new requests are handled smoothly."}),s.jsx(ue,{asChild:!0,size:"sm",className:"rounded-lg px-5",children:s.jsx(Jt,{to:"/transcripts",children:"Review"})})]}),s.jsxs("div",{className:"relative mx-auto flex size-28 shrink-0 items-end justify-center sm:mx-0 sm:size-32","aria-hidden":!0,children:[s.jsx("div",{className:"absolute inset-0 rounded-2xl bg-secondary"}),s.jsx("span",{className:"relative text-6xl",children:"🎫"})]})]})}),s.jsx(Ze,{className:"overflow-hidden border-border bg-primary text-primary-foreground",children:s.jsxs(Qe,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm font-medium text-white/80",children:"Ticket summary"}),s.jsxs("ul",{className:"space-y-1.5 text-sm",children:[s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[g," total"]})]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[p," closed"]})]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-white/70"}),s.jsxs("span",{className:"text-white/90",children:[m," open"]})]})]})]}),s.jsx(Iz,{percent:l,size:120})]})})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"Module overview"}),s.jsx(DS,{value:o,onValueChange:v=>c(v),children:s.jsxs(xx,{className:"h-auto flex-wrap rounded-xl bg-secondary/60 p-1",children:[s.jsx(Ys,{value:"all",className:"rounded-lg text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"All"}),s.jsx(Ys,{value:"open",className:"rounded-lg text-xs data-[state=active]:bg-background",children:"Open"}),s.jsx(Ys,{value:"closed",className:"rounded-lg text-xs data-[state=active]:bg-background",children:"Closed"}),YM.filter(v=>v.id!=="all").map(v=>s.jsx(Ys,{value:v.id,className:"rounded-lg text-xs data-[state=active]:bg-background",children:v.label},v.id))]})})]}),s.jsx("div",{className:"-mx-1 flex gap-4 overflow-x-auto px-1 pb-2 lg:grid lg:grid-cols-3 lg:overflow-visible",children:(o==="open"?[{id:"open-queue",title:"Open ticket queue",subtitle:`${m} waiting`,icon:is,href:"/tickets",status:"done",meta:"View live tickets"}]:o==="closed"?[{id:"closed-archive",title:"Closed tickets",subtitle:`${p} resolved`,icon:jd,href:"/transcripts",status:"done",meta:"Browse archive"}]:d.map(v=>{const b=Kh(v.id,t.modules,v.description);return{id:v.id,title:v.title,subtitle:b.subtitle,icon:v.icon,href:v.href,status:b.status,meta:b.status==="done"?"View settings":"Configure"}})).map(v=>s.jsx(Bz,{title:v.title,subtitle:v.subtitle,icon:v.icon,href:v.href,status:v.status,meta:v.meta},v.id))})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"Active modules"}),s.jsx(Jt,{to:"/configs",className:"text-sm font-medium text-primary hover:underline",children:"See all"})]}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:ii.slice(0,4).map(v=>{const b=Kh(v.id,t.modules);return s.jsx(Pz,{title:v.title,icon:v.icon,href:v.href,badge:c5[b.status],status:b.status},v.id)})})]})]}),s.jsx($z,{stats:t})]})}function Vz(){const{permissions:t}=qt();return Mn(t,"overview")?s.jsx(Gz,{}):s.jsx(ya,{to:mg(t),replace:!0})}function ga({permission:t,children:n}){const{loading:a,isAuthenticated:o,permissions:c}=qt();return a?s.jsx("div",{className:"flex flex-1 items-center justify-center py-16 text-sm text-muted-foreground",children:"Loading…"}):o?Mn(c,t)?s.jsx(s.Fragment,{children:n}):s.jsx(ya,{to:mg(c),replace:!0}):s.jsx(ya,{to:"/login",replace:!0})}function Fz(){const{hasPermission:t}=qt(),n=t("settings.update"),a=ao(),[o,c]=f.useState([]),[l,d]=f.useState(""),[m,p]=f.useState(!0),[g,v]=f.useState(""),[b,w]=f.useState(""),[y,C]=f.useState(null),S=f.useCallback(async()=>{p(!0),v("");try{const k=await Ne.getAddonsCatalog();k.data&&(c(k.data.addons),d(k.data.repository))}catch(k){v(k instanceof Error?k.message:"Failed to load addons")}finally{p(!1)}},[]);f.useEffect(()=>{S()},[S]);async function E(k){if(n){C(k.id),w(""),v("");try{const N=await Ne.installAddon(k.id);w(N.message||`${k.name} installed.`),await S();const T=k.configFiles[0];T&&a(`/configs?file=${_l(T)}`)}catch(N){v(N instanceof Error?N.message:"Install failed")}finally{C(null)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Addons"}),s.jsxs("p",{className:"text-muted-foreground",children:["Requires an API key from"," ",s.jsx("a",{href:"https://emeraldsrv.dev",target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:"emeraldsrv.dev"})," ","to browse and install addons. Configs will appear in the sidebar once installed."]})]}),s.jsxs(ue,{variant:"outline",size:"sm",onClick:S,disabled:m,children:[s.jsx(ve,{icon:_2,size:16,className:pe("mr-1.5",m&&"animate-spin")}),"Refresh"]})]}),g?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:g})}):null,b?s.jsx(Ye,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(qe,{children:b})}):null,s.jsxs("section",{className:"space-y-4",children:[s.jsx("h2",{className:"text-sm font-semibold uppercase tracking-widest text-muted-foreground",children:"Marketplace"}),m?s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[s.jsx(Be,{className:"h-40 rounded-xl"}),s.jsx(Be,{className:"h-40 rounded-xl"}),s.jsx(Be,{className:"h-40 rounded-xl"})]}):s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:o.map(k=>s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"pb-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs(dt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(ve,{icon:dg,size:20,className:"text-primary"}),k.name]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Fn,{variant:"outline",className:"shrink-0 uppercase tracking-widest text-[10px]",children:k.price===0||!k.price?"Free":`$${k.price}`}),k.installed?s.jsxs(Fn,{variant:"secondary",className:"shrink-0 gap-1",children:[s.jsx(ve,{icon:D8,size:14}),"Installed"]}):null]})]}),s.jsx(Ot,{children:k.description})]}),s.jsxs(Qe,{className:"space-y-2 text-xs text-muted-foreground",children:[k.is_external?s.jsxs("p",{children:["Available on: ",s.jsx("span",{className:"font-medium text-foreground",children:k.external_store||"External Store"})]}):null,k.configFiles&&k.configFiles.length>0?s.jsxs("p",{children:["Config:"," ",k.configFiles.map((N,T)=>s.jsxs("span",{children:[T>0?", ":null,s.jsx(Jt,{to:`/configs?file=${_l(N)}`,className:"font-mono text-primary hover:underline",children:N})]},N))]}):null]}),s.jsxs(Sx,{className:"flex flex-wrap gap-2",children:[k.is_external?s.jsx(ue,{variant:"outline",size:"sm",asChild:!0,children:s.jsx("a",{href:k.repositoryUrl,target:"_blank",rel:"noreferrer",children:"View Store"})}):null,k.installed&&k.configFiles&&k.configFiles[0]?s.jsx(ue,{size:"sm",variant:"secondary",asChild:!0,children:s.jsx(Jt,{to:`/configs?file=${_l(k.configFiles[0])}`,children:"Edit config"})}):null,k.installed?s.jsx(ue,{size:"sm",disabled:!0,variant:"secondary",children:"Installed"}):k.is_external?null:s.jsxs(ue,{size:"sm",disabled:!n||y===k.id,onClick:()=>E(k),children:[s.jsx(ve,{icon:Cd,size:14,className:"mr-1"}),y===k.id?"Installing…":"Install"]})]})]},k.id))})]})]})}function Yz(){const{permissions:t}=qt(),[n,a]=f.useState(!1),[o,c]=f.useState(!1),[l,d]=f.useState(""),[m,p]=f.useState(""),[g,v]=f.useState(""),[b,w]=f.useState("Administrator"),[y,C]=f.useState(""),[S,E]=f.useState(""),[k,N]=f.useState("General"),T=z2(t,"supportbot"),M=async()=>{if(!m.match(/^[a-z0-9_-]+$/i)){Dt.error("Command name can only contain letters, numbers, underscores and dashes.");return}a(!0),c(!1);try{const _=await Ne.buildAddon({name:m.toLowerCase(),description:g||"A custom command",permission:b,embed:{title:y,description:S||"Hello from your custom command!",color:k}});c(!0),d(_.message||"Restart required."),Dt.success(`Addon ${m}.js created successfully!`)}catch(_){Dt.error(_ instanceof Error?_.message:"Failed to build addon")}finally{a(!1)}};return T?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Addon Builder"}),s.jsx("p",{className:"text-muted-foreground",children:"Visually scaffold a custom slash command addon for your bot."})]}),o?s.jsxs(Ye,{className:"border-green-500/20 bg-green-500/10 text-green-600 dark:text-green-400",children:[s.jsx(x0,{className:"h-4 w-4"}),s.jsxs(qe,{className:"ml-2",children:["Successfully built ",s.jsxs("strong",{children:[m,".js"]}),"! ",l]})]}):null,s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ze,{children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Command Details"}),s.jsx(Ot,{children:"Configure how users trigger the command."})]}),s.jsxs(Qe,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Command Name"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"/"}),s.jsx(De,{placeholder:"ping",value:m,onChange:_=>p(_.target.value.replace(/[^a-z0-9_-]/gi,"").toLowerCase())})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Description"}),s.jsx(De,{placeholder:"Replies with a custom embed",value:g,onChange:_=>v(_.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Required Permission"}),s.jsxs(Ca,{value:b,onValueChange:w,children:[s.jsx(Br,{children:s.jsx(Sa,{})}),s.jsxs($r,{children:[s.jsx(vt,{value:"none",children:"@everyone"}),s.jsx(vt,{value:"Administrator",children:"Administrator"}),s.jsx(vt,{value:"ManageMessages",children:"Manage Messages"}),s.jsx(vt,{value:"ManageGuild",children:"Manage Server"})]})]})]})]})]}),s.jsxs(Ze,{children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Response Embed"}),s.jsx(Ot,{children:"What the bot will reply with."})]}),s.jsxs(Qe,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Embed Title (Optional)"}),s.jsx(De,{placeholder:"Hello!",value:y,onChange:_=>C(_.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Embed Description"}),s.jsx(Jd,{placeholder:"Type your message here...",className:"resize-none",rows:4,value:S,onChange:_=>E(_.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Embed Color"}),s.jsxs(Ca,{value:k,onValueChange:N,children:[s.jsx(Br,{children:s.jsx(Sa,{})}),s.jsxs($r,{children:[s.jsx(vt,{value:"General",children:"Theme General"}),s.jsx(vt,{value:"Success",children:"Theme Success"}),s.jsx(vt,{value:"Warning",children:"Theme Warning"}),s.jsx(vt,{value:"Error",children:"Theme Error"})]})]})]})]})]})]}),s.jsx("div",{className:"space-y-6",children:s.jsxs(Ze,{className:"sticky top-6 border-primary/20",children:[s.jsx(ut,{children:s.jsxs(dt,{className:"text-sm font-medium flex items-center gap-2",children:[s.jsx(ve,{icon:A8,size:16,className:"text-primary"}),"Live Preview"]})}),s.jsx(Qe,{children:s.jsx("div",{className:"rounded-md border bg-[#313338] p-4 font-sans text-sm text-[#dbdee1]",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"size-10 shrink-0 rounded-full bg-indigo-500 flex items-center justify-center font-bold text-white",children:"B"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-white",children:"SupportBot"}),s.jsxs("span",{className:"text-[10px] text-white font-medium uppercase px-1.5 py-0.5 rounded bg-[#5865F2] flex items-center gap-1",children:[s.jsx(x0,{size:10})," BOT"]}),s.jsx("span",{className:"text-xs text-[#949ba4]",children:"Today at 12:00 PM"})]}),s.jsxs("div",{className:"mt-2 rounded bg-[#2b2d31] border-l-4 border-l-[#5865F2] px-4 py-3 max-w-[432px]",children:[y&&s.jsx("div",{className:"mb-1 font-semibold text-white",children:y}),s.jsx("div",{className:"whitespace-pre-wrap",children:S||"Hello from your custom command!"})]})]})]})})}),s.jsx(Sx,{children:s.jsxs(ue,{className:"w-full gap-2",size:"lg",disabled:!m||n,onClick:M,children:[s.jsx(ve,{icon:ds,size:18}),n?"Building...":"Generate Addon"]})})]})})]})]}):s.jsx("div",{className:"flex h-[50vh] items-center justify-center text-muted-foreground",children:"You don't have permission to build addons."})}const Ex="supportbot-dashboard-accent",Pl="#45b46c",qz=["--primary","--ring","--chart-1","--sidebar-primary","--sidebar-ring","--accent","--accent-foreground","--sidebar-accent","--sidebar-accent-foreground"];function Kz(t){const n=Ur(t,Pl),a=parseInt(n.slice(1,3),16)/255,o=parseInt(n.slice(3,5),16)/255,c=parseInt(n.slice(5,7),16)/255,l=Math.max(a,o,c),d=Math.min(a,o,c),m=(l+d)/2;let p=0,g=0;if(l!==d){const v=l-d;switch(g=m>.5?v/(2-l-d):v/(l+d),l){case a:p=((o-c)/v+(o{const o=new FileReader;o.onload=()=>n(String(o.result)),o.onerror=()=>a(new Error("Could not read file")),o.readAsDataURL(t)})}function Jz({canEdit:t}){const[n,a]=f.useState(!1),[o,c]=f.useState(""),[l,d]=f.useState(!1);async function m(){if(t){a(!0),c("");try{const p=await Ne.resetDashboard();c(p.message||"Dashboard reset successfully."),setTimeout(()=>{window.location.href="/setup"},1500)}catch(p){c(p instanceof Error?p.message:"Reset failed"),a(!1)}}}return t?s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Reset the dashboard to factory settings. This clears the configuration and returns you to the initial setup screen."}),s.jsxs(Qs,{open:l,onOpenChange:d,children:[s.jsx(TM,{asChild:!0,children:s.jsx(ue,{type:"button",variant:"destructive",children:"Reset Dashboard"})}),s.jsxs(hs,{children:[s.jsxs(gs,{children:[s.jsx(xs,{children:"Are you absolutely sure?"}),s.jsx(vs,{children:"This action cannot be undone. This will reset the dashboard to setup mode. You will need to reconnect the Discord OAuth and reconfigure the dashboard owners."})]}),o&&s.jsx("p",{className:"text-sm font-medium text-destructive",children:o}),s.jsxs(Js,{children:[s.jsx(ue,{variant:"outline",onClick:()=>d(!1),disabled:n,children:"Cancel"}),s.jsx(ue,{variant:"destructive",onClick:()=>void m(),disabled:n,children:n?"Resetting...":"Yes, reset dashboard"})]})]})]})]}):null}function eP({canEdit:t}){const{branding:n,setBrandingLocal:a}=Ed(),o=f.useRef(null),[c,l]=f.useState(n.title),[d,m]=f.useState(n.pageTitle),[p,g]=f.useState(!1),[v,b]=f.useState(!1),[w,y]=f.useState("");f.useEffect(()=>{l(n.title),m(n.pageTitle)},[n.title,n.pageTitle]);const C=n.hasFavicon&&n.faviconUrl?`${n.faviconUrl}${n.updatedAt?`?v=${n.updatedAt}`:""}`:null;async function S(){if(t){g(!0),y("");try{const T=await Ne.updateBranding({title:c,pageTitle:d});T.data&&a(T.data),y(T.message||"Branding saved.")}catch(T){y(T instanceof Error?T.message:"Save failed")}finally{g(!1)}}}async function E(T){if(!(!t||!T)){b(!0),y("");try{const M=await Qz(T),_=await Ne.uploadBrandingFavicon(M);_.data&&a(_.data),y(_.message||"Favicon uploaded.")}catch(M){y(M instanceof Error?M.message:"Upload failed")}finally{b(!1),o.current&&(o.current.value="")}}}async function k(){if(t){b(!0),y("");try{const T=await Ne.removeBrandingFavicon();T.data&&a(T.data),y(T.message||"Favicon removed.")}catch(T){y(T instanceof Error?T.message:"Remove failed")}finally{b(!1)}}}const N=c.trim()!==n.title||d.trim()!==n.pageTitle;return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Branding Text"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Sidebar title and browser tab title — saved on the server for everyone using this dashboard."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"brand-title",children:"Sidebar title"}),s.jsx(De,{id:"brand-title",value:c,disabled:!t,maxLength:64,onChange:T=>l(T.target.value),className:"border-border bg-secondary/30",placeholder:"SupportBot"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"brand-page-title",children:"Browser tab title"}),s.jsx(De,{id:"brand-page-title",value:d,disabled:!t,maxLength:80,onChange:T=>m(T.target.value),className:"border-border bg-secondary/30",placeholder:"SupportBot Dashboard"})]})]}),t?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ue,{type:"button",disabled:p||!N,onClick:()=>void S(),children:p?"Saving…":"Save titles"}),w&&N?s.jsx("span",{className:"text-xs text-muted-foreground",children:w}):null]}):null]}),s.jsxs("div",{className:"space-y-4 border-t border-border pt-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Favicon"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, ICO, SVG, JPEG, or WebP — max 512 KB. Shown in the browser tab and beside the sidebar title."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsx("div",{className:"flex size-16 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary/30",children:C?s.jsx("img",{src:C,alt:"Favicon preview",className:"size-full object-contain p-2"}):s.jsx(ve,{icon:y8,size:24,className:"text-muted-foreground/50"})}),s.jsx("input",{ref:o,type:"file",accept:"image/png,image/jpeg,image/x-icon,image/vnd.microsoft.icon,image/svg+xml,image/webp,.ico",className:"hidden",disabled:!t||v,onChange:T=>{var M;return void E(((M=T.target.files)==null?void 0:M[0])??null)}}),s.jsxs("div",{className:"flex flex-col gap-2",children:[t?s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ue,{type:"button",variant:"secondary",disabled:v,onClick:()=>{var T;return(T=o.current)==null?void 0:T.click()},children:v?"Uploading…":"Upload Favicon"}),n.hasFavicon?s.jsx(ue,{type:"button",variant:"destructive",disabled:v,onClick:()=>void k(),children:"Remove"}):null]}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}),!N&&w?s.jsx("span",{className:"text-xs text-muted-foreground",children:w}):null]})]})]})]})}function tP(){var b,w,y,C,S,E,k,N,T,M,_;const{hasPermission:t}=qt(),n=t("settings.update"),[a,o]=f.useState(!0),[c,l]=f.useState(!1),[d,m]=f.useState(""),[p,g]=f.useState(null);f.useEffect(()=>{Ne.getConfigJson("api").then(R=>{R.data&&g(R.data)}).catch(()=>m("Failed to load API config")).finally(()=>o(!1))},[]);async function v(){var R,L,te,K,I,G,Y,ce,fe,se,P;if(!(!n||!p)){l(!0),m("");try{const Z={"api:API.Port":(R=p.API)==null?void 0:R.Port,"api:API.EmeraldAPIKey":(L=p.API)==null?void 0:L.EmeraldAPIKey,"api:API.TrustProxy":(te=p.API)==null?void 0:te.TrustProxy,"api:API.OAuth.Enabled":(I=(K=p.API)==null?void 0:K.OAuth)==null?void 0:I.Enabled,"api:API.OAuth.ClientId":(Y=(G=p.API)==null?void 0:G.OAuth)==null?void 0:Y.ClientId,"api:API.OAuth.ClientSecret":(fe=(ce=p.API)==null?void 0:ce.OAuth)==null?void 0:fe.ClientSecret,"api:API.OAuth.RedirectUri":(P=(se=p.API)==null?void 0:se.OAuth)==null?void 0:P.RedirectUri};await Ne.updateConfigFields(Z),m("API settings saved and backend restarted.")}catch(Z){m(Z instanceof Error?Z.message:"Save failed")}finally{l(!1)}}}return a?s.jsx("div",{className:"animate-pulse h-32 bg-secondary/20 rounded-md"}):p?s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Core API Settings"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the internal API that powers this dashboard."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"API Port"}),s.jsx(De,{type:"number",value:((b=p.API)==null?void 0:b.Port)||"",disabled:!n,onChange:R=>g({...p,API:{...p.API,Port:parseInt(R.target.value)||3e3}}),className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Emerald API Key"}),s.jsx(De,{type:"password",value:((w=p.API)==null?void 0:w.EmeraldAPIKey)||"",disabled:!n,onChange:R=>g({...p,API:{...p.API,EmeraldAPIKey:R.target.value}}),className:"border-border bg-secondary/30"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(kt,{checked:((y=p.API)==null?void 0:y.TrustProxy)||!1,disabled:!n,onCheckedChange:R=>g({...p,API:{...p.API,TrustProxy:R}})}),s.jsx(_e,{className:"text-sm",children:"Trust Proxy (Enable if using Cloudflare/Nginx)"})]})]}),s.jsxs("div",{className:"space-y-4 border-t border-border pt-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"OAuth Authentication"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Discord application credentials for dashboard login."})]}),s.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[s.jsx(kt,{checked:((S=(C=p.API)==null?void 0:C.OAuth)==null?void 0:S.Enabled)||!1,disabled:!n,onCheckedChange:R=>{var L;return g({...p,API:{...p.API,OAuth:{...(L=p.API)==null?void 0:L.OAuth,Enabled:R}}})}}),s.jsx(_e,{className:"text-sm",children:"Enable OAuth"})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Client ID"}),s.jsx(De,{value:((k=(E=p.API)==null?void 0:E.OAuth)==null?void 0:k.ClientId)||"",disabled:!n,onChange:R=>{var L;return g({...p,API:{...p.API,OAuth:{...(L=p.API)==null?void 0:L.OAuth,ClientId:R.target.value}}})},className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Client Secret"}),s.jsx(De,{type:"password",value:((T=(N=p.API)==null?void 0:N.OAuth)==null?void 0:T.ClientSecret)||"",disabled:!n,onChange:R=>{var L;return g({...p,API:{...p.API,OAuth:{...(L=p.API)==null?void 0:L.OAuth,ClientSecret:R.target.value}}})},className:"border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[s.jsx(_e,{children:"Redirect URI"}),s.jsx(De,{value:((_=(M=p.API)==null?void 0:M.OAuth)==null?void 0:_.RedirectUri)||"",disabled:!n,onChange:R=>{var L;return g({...p,API:{...p.API,OAuth:{...(L=p.API)==null?void 0:L.OAuth,RedirectUri:R.target.value}}})},className:"border-border bg-secondary/30"}),s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Must match the OAuth2 callback URL registered in the Discord Developer Portal exactly."})]})]})]}),n?s.jsxs("div",{className:"flex items-center gap-2 border-t border-border pt-6",children:[s.jsx(ue,{type:"button",disabled:c,onClick:()=>void v(),children:c?"Saving…":"Save API Config"}),d?s.jsx("span",{className:"text-xs text-muted-foreground",children:d}):null]}):null]}):null}function nP(){const{hasPermission:t}=qt(),n=t("settings.update"),[a,o]=f.useState(null),[c,l]=f.useState(!0),[d,m]=f.useState(!1),[p,g]=f.useState(""),[v,b]=f.useState(""),[w,y]=f.useState(()=>d5()??Pl),[C,S]=f.useState(""),[E,k]=f.useState("appearance"),N=f.useCallback(async()=>{l(!0),g("");try{const M=await Ne.checkForUpdates();M.data&&o(M.data)}catch(M){g(M instanceof Error?M.message:"Could not check for updates")}finally{l(!1)}},[]);f.useEffect(()=>{N()},[N]);async function T(M){if(M.updateAvailable){m(!0),g(""),b("");try{const _=await Ne.runUpdate(M.id,M.latest,M.zipUrl);b(_.message||"Update installed. Restart your server (stop and run npm start again) to finish applying changes."),await N()}catch(_){g(_ instanceof Error?_.message:"Update failed")}finally{m(!1)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Settings"}),s.jsx("p",{className:"text-muted-foreground",children:"Application updates and maintenance — config files are edited under each module in the sidebar."})]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-8 items-start",children:[s.jsx("aside",{className:"w-full md:w-56 shrink-0 sticky top-6",children:s.jsxs("nav",{className:"flex flex-row md:flex-col overflow-x-auto space-x-2 md:space-x-0 md:space-y-1 pb-2 md:pb-0",children:[s.jsx(ue,{variant:E==="appearance"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>k("appearance"),children:"Appearance"}),s.jsx(ue,{variant:E==="api"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>k("api"),children:"API Config"}),s.jsx(ue,{variant:E==="updates"?"secondary":"ghost",className:"justify-start w-full",onClick:()=>k("updates"),children:"Update Checker"}),n&&s.jsx(ue,{variant:"ghost",className:`justify-start w-full text-destructive hover:bg-destructive/10 hover:text-destructive ${E==="danger"?"bg-destructive/10 border-l-2 border-destructive rounded-l-none":""}`,onClick:()=>k("danger"),children:"Danger Zone"})]})}),s.jsxs("main",{className:"flex-1 w-full max-w-4xl space-y-6",children:[E==="appearance"&&s.jsx("div",{className:"space-y-6",children:s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Dashboard appearance"}),s.jsx(Ot,{children:"Customise branding for all users, and pick an accent colour for this browser only."})]}),s.jsxs(Qe,{className:"space-y-4",children:[s.jsx(eP,{canEdit:n}),s.jsxs("div",{className:"border-t border-border pt-4",children:[s.jsx("p",{className:"mb-1 text-sm font-medium",children:"Accent colour"}),s.jsx("p",{className:"mb-4 text-xs text-muted-foreground",children:"Buttons, links, and highlights — saved in this browser only."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tf,{value:w,onChange:M=>{y(M),n2(M),S("Accent updated.")}}),s.jsx(De,{id:"accent-colour",value:w,onChange:M=>y(M.target.value),onBlur:()=>{const M=Ur(w,Pl);y(M),n2(M),S("Accent updated.")},className:"w-32 border-border bg-secondary/30 font-mono uppercase",maxLength:7})]}),s.jsx(ue,{type:"button",variant:"outline",onClick:()=>{Xz(),y(Pl),S("Reset to default purple.")},children:"Reset to default"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 text-sm mt-5",children:[s.jsx("span",{className:"rounded-md bg-primary px-3 py-1.5 font-medium text-primary-foreground",children:"Primary button"}),s.jsx("span",{className:"rounded-md bg-primary/15 px-3 py-1.5 text-primary",children:"Highlight"}),s.jsx("span",{className:"rounded-md bg-accent px-3 py-1.5 text-accent-foreground",children:"Accent surface"})]}),C?s.jsx("p",{className:"text-xs text-muted-foreground",children:C}):null]})]})]})}),E==="danger"&&n&&s.jsxs(Ze,{className:"border-destructive/50 bg-destructive/5",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg text-destructive",children:"Danger Zone"}),s.jsx(Ot,{className:"text-destructive/80",children:"Destructive actions that reset or permanently alter your dashboard."})]}),s.jsx(Qe,{children:s.jsx(Jz,{canEdit:n})})]}),E==="api"&&s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"API Configuration"}),s.jsx(Ot,{children:"Configure the internal API settings, Emerald API key, and OAuth."})]}),s.jsx(Qe,{children:s.jsx(tP,{})})]}),E==="updates"&&s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Software updates"}),s.jsx(Ot,{children:"Manage updates for the bot and dashboard."})]}),s.jsxs(Qe,{className:"space-y-4",children:[c?s.jsx(Be,{className:"h-24 w-full"}):a&&a.length>0?s.jsx("div",{className:"space-y-4",children:a.map(M=>s.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-secondary/20 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"font-medium text-sm",children:[s.jsx("a",{href:M.repository,target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:M.name})," ","(",M.branch," branch)"]}),s.jsxs("div",{className:"flex gap-x-4 text-sm",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Installed: "}),s.jsxs("span",{className:"font-mono font-medium",children:["v",M.current]})]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Latest: "}),s.jsxs("span",{className:"font-mono font-medium",children:["v",M.latest]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[M.updateAvailable?s.jsx("p",{className:"text-sm text-amber-500",children:"A newer version is available. Update downloads files while keeping your Configs and Data."}):s.jsx("p",{className:"text-sm text-emerald-500",children:"You are on the latest release."}),M.updateAvailable&&n?s.jsxs(ue,{type:"button",size:"sm",onClick:()=>void T(M),disabled:d,children:[d?s.jsx(ve,{icon:_2,size:16,className:"mr-2 animate-spin"}):s.jsx(ve,{icon:Cd,size:16,className:"mr-2"}),d?"Installing…":"Update now"]}):null,M.updateAvailable&&!n?s.jsx("p",{className:"text-xs text-muted-foreground",children:"You cannot install updates with your role."}):null]})]},M.id))}):null,p?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:p})}):null,v?s.jsx(Ye,{children:s.jsx(qe,{children:v})}):null,s.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:s.jsxs(ue,{type:"button",variant:"outline",onClick:N,disabled:c||d,children:[s.jsx(ve,{icon:ur,size:16,className:"mr-2"}),"Check again"]})})]})]})]})]})]})}function kx(t){const[n,a]=f.useState(!1),o=f.useRef(t);return o.current=t,f.useEffect(()=>{let c=null,l=null;const d=()=>{c=new EventSource("/api/stream"),c.onopen=()=>{a(!0)},c.addEventListener("connected",()=>{a(!0)}),c.addEventListener("metrics",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onMetrics)==null||g.call(p,v)}catch{}}),c.addEventListener("log",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onLog)==null||g.call(p,v)}catch{}}),c.addEventListener("ticket_message",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onTicketMessage)==null||g.call(p,v)}catch{}}),c.addEventListener("ticket_message_deleted",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onTicketMessageDeleted)==null||g.call(p,v)}catch{}}),c.addEventListener("ticket_message_updated",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onTicketMessageUpdated)==null||g.call(p,v)}catch{}}),c.addEventListener("ticket_created",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onTicketCreated)==null||g.call(p,v)}catch{}}),c.addEventListener("ticket_closed",m=>{var p,g;try{const v=JSON.parse(m.data);(g=(p=o.current).onTicketClosed)==null||g.call(p,v)}catch{}}),c.onerror=()=>{a(!1),c==null||c.close(),l=window.setTimeout(d,4e3)}};return d(),()=>{l&&window.clearTimeout(l),c&&c.close()}},[]),{connected:n}}function Et({label:t,value:n,mono:a=!1}){return s.jsxs("div",{className:"flex flex-col gap-1 border-b border-border py-3 last:border-0 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("dt",{className:"text-sm text-muted-foreground",children:t}),s.jsx("dd",{className:`text-sm font-medium text-foreground ${a?"font-mono text-xs sm:text-sm":""}`,children:n})]})}const rP={ok:"Healthy",missing_config:"Guild ID not set",not_in_guild:"Not in configured server",extra_guilds:"Extra servers joined",offline:"Bot offline"};function aP(t){return t==="ok"?"text-emerald-500":t==="offline"?"text-destructive":"text-amber-500"}function sP(){var E;const{stats:t,loading:n,error:a,refresh:o}=kd(),[c,l]=f.useState(null),[d,m]=f.useState(null),[p,g]=f.useState(!1),[v,b]=f.useState(null),{connected:w}=kx({onMetrics:k=>{b(k)}}),y=f.useCallback(async()=>{const[k,N]=await Promise.all([Ne.getGuildStatus().catch(()=>null),Ne.health().catch(()=>null)]);k!=null&&k.data&&l(k.data),N!=null&&N.success&&N.data&&m({dashboard:N.data.dashboard,botReady:N.data.botReady,oauthEnabled:N.data.oauthEnabled,setupComplete:N.data.setupComplete})},[]);f.useEffect(()=>{y()},[y]);async function C(){g(!0);try{await Promise.all([o(),y()])}finally{g(!1)}}if(n&&!t)return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Be,{className:"h-10 w-64"}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-56 rounded-2xl"}),s.jsx(Be,{className:"h-56 rounded-2xl"})]})]});if(a||!t)return s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:a||"Could not load system details."})});const S=t.bot.ping<200;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ue,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-2 h-8 px-2 text-muted-foreground",children:s.jsxs(Jt,{to:"/",children:[s.jsx(ve,{icon:T2,size:16,className:"mr-1.5"}),"Back to dashboard"]})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"System details"}),s.jsx("p",{className:"text-muted-foreground",children:"Live bot, host, and dashboard status — refreshed every 30 seconds."})]})]}),s.jsxs(ue,{type:"button",variant:"outline",disabled:p,onClick:()=>void C(),children:[s.jsx(ve,{icon:ur,size:16,className:"mr-2"}),p?"Refreshing…":"Refresh now"]})]}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Discord bot"}),s.jsx(Ot,{children:"Connection and identity"})]}),s.jsxs(Qe,{children:[s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsxs(bs,{className:"size-12",children:[s.jsx(eo,{src:t.bot.avatar,alt:t.bot.username}),s.jsx(ys,{children:"SB"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:t.bot.username}),s.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:t.bot.id})]})]}),s.jsxs("dl",{children:[s.jsx(Et,{label:"Version",value:`v${t.bot.version}`,mono:!0}),s.jsx(Et,{label:"Gateway latency",value:s.jsxs("span",{className:S?"text-emerald-500":"text-amber-500",children:[t.bot.ping," ms"]})}),s.jsx(Et,{label:"Process uptime",value:fg(t.bot.uptime)}),s.jsx(Et,{label:"Connected servers",value:t.servers.toLocaleString()}),s.jsx(Et,{label:"Members tracked",value:t.users.toLocaleString()}),t.bot.inviteUrl?s.jsx(Et,{label:"Invite link",value:s.jsx("a",{href:t.bot.inviteUrl,target:"_blank",rel:"noreferrer",className:"text-primary underline-offset-4 hover:underline",children:"Open in Discord"})}):null]})]})]}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(dt,{className:"text-lg",children:"Host machine"}),s.jsx(Ot,{children:"Server resources running this instance"})]}),s.jsxs(Fn,{variant:w?"default":"outline",className:"text-xs",children:[s.jsx("span",{className:`mr-1.5 inline-block h-2 w-2 rounded-full ${w?"bg-emerald-500 animate-pulse":"bg-muted"}`}),w?"Live Stream":"Polling"]})]}),s.jsx(Qe,{children:s.jsxs("dl",{children:[s.jsx(Et,{label:"Memory used",value:v?`${(v.ram_used_mb/1024).toFixed(2)} GB / ${(v.ram_total_mb/1024).toFixed(2)} GB`:`${t.hosting.ram_used} / ${t.hosting.ram_total}`}),s.jsx(Et,{label:"Memory usage",value:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:(v?v.ram_percent:t.hosting.ram_percent)>85?"text-amber-500 font-bold":"text-foreground font-medium",children:[v?v.ram_percent:t.hosting.ram_percent,"%"]}),s.jsx("div",{className:"w-24 h-2 bg-secondary rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${v?v.ram_percent:t.hosting.ram_percent}%`}})})]})}),s.jsx(Et,{label:"CPU load (1 min avg)",value:v?String(v.cpu_load):t.hosting.cpu_load,mono:!0}),s.jsx(Et,{label:"Host uptime",value:t.hosting.uptime})]})})]}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Tickets"}),s.jsx(Ot,{children:"Database snapshot"})]}),s.jsx(Qe,{children:s.jsxs("dl",{children:[s.jsx(Et,{label:"Total tickets",value:t.tickets.total}),s.jsx(Et,{label:"Open",value:s.jsx("span",{className:"text-primary",children:t.tickets.open})}),s.jsx(Et,{label:"Closed",value:t.tickets.closed}),s.jsx(Et,{label:"Transcripts",value:s.jsx(Jt,{to:"/transcripts",className:"text-primary underline-offset-4 hover:underline",children:"Browse archive"})})]})})]}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Guild health"}),s.jsx(Ot,{children:"Configured server and membership"})]}),s.jsx(Qe,{children:c?s.jsxs("dl",{children:[s.jsx(Et,{label:"Status",value:s.jsx("span",{className:aP(c.status),children:rP[c.status]})}),s.jsx(Et,{label:"Configured guild ID",value:c.configuredGuildId||"Not set",mono:!0}),c.configuredGuild?s.jsx(Et,{label:"Configured server",value:`${c.configuredGuild.name} (${((E=c.configuredGuild.memberCount)==null?void 0:E.toLocaleString())??"?"} members)`}):null,c.message?s.jsx("div",{className:"mt-3 rounded-lg border border-border bg-secondary/30 px-3 py-2 text-sm text-muted-foreground",children:c.message}):null,c.extraGuilds.length>0?s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Extra servers"}),s.jsx("ul",{className:"space-y-1 text-sm",children:c.extraGuilds.map(k=>s.jsxs("li",{className:"font-mono text-xs",children:[k.name," · ",k.id]},k.id))})]}):null]}):s.jsx(Be,{className:"h-24 w-full"})})]})]}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Dashboard services"}),s.jsx(Ot,{children:"API and authentication"})]}),s.jsx(Qe,{children:d?s.jsxs("dl",{className:"max-w-xl",children:[s.jsx(Et,{label:"Dashboard UI",value:d.dashboard?"Available":"Missing build"}),s.jsx(Et,{label:"Bot connection",value:d.botReady?"Online":"Starting or offline"}),s.jsx(Et,{label:"Discord OAuth",value:d.oauthEnabled?"Configured":"Not configured"}),s.jsx(Et,{label:"Initial setup",value:d.setupComplete?"Complete":"Incomplete"}),s.jsx(Et,{label:"Software updates",value:s.jsx(Jt,{to:"/settings",className:"text-primary underline-offset-4 hover:underline",children:"Open settings"})}),s.jsx(Et,{label:"Logs",value:s.jsx(Jt,{to:"/logs",className:"text-primary underline-offset-4 hover:underline",children:"View log files"})})]}):s.jsx(Be,{className:"h-32 w-full max-w-xl"})})]}),t.modules?s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-lg",children:"Module setup status"}),s.jsx(Ot,{children:"Which features are configured and active"})]}),s.jsx(Qe,{children:s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:ii.map(k=>{const N=Kh(k.id,t.modules);return s.jsxs(Jt,{to:k.href,className:"flex items-start justify-between gap-3 rounded-xl border border-border bg-secondary/20 px-4 py-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium",children:k.title}),s.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:N.subtitle})]}),s.jsx("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:c5[N.status]})]},k.id)})})})]}):null]})}function oP(t){if(!t)return"—";const n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}const iP=[{id:"all",label:"All"},{id:"Output",label:"Output"},{id:"Warn",label:"Warn"},{id:"Error",label:"Error"}],lP=["Output","Warn","Error"],cP={Output:"text-foreground/90",Warn:"text-amber-400",Error:"text-rose-400"},uP={Output:"bg-muted text-muted-foreground",Warn:"bg-amber-500/15 text-amber-400",Error:"bg-rose-500/15 text-rose-400"},gd=2e3,dP=2e3;function Wh(t,n){return`${t.type}-${t.timestamp??"na"}-${n}-${t.message.slice(0,32)}`}function fP(t,n,a){const o=a?[]:t,c=new Set(o.map((m,p)=>Wh(m,p))),l=[];for(let m=0;mgd?d.slice(d.length-gd):d}function mP(){const[t,n]=f.useState([]),[a,o]=f.useState(!0),[c,l]=f.useState(""),[d,m]=f.useState(!1),[p,g]=f.useState(!0),[v,b]=f.useState("all"),[w,y]=f.useState(""),[C,S]=f.useState(!0),[E,k]=f.useState(""),N=f.useRef(null),T=f.useRef(null),M=f.useRef(d);M.current=d;const _=f.useMemo(()=>v==="all"?lP:[v],[v]),R=f.useCallback(I=>{M.current||v!=="all"&&I.type!==v||(n(G=>{const Y=[...G,I];return Y.length>gd?Y.slice(Y.length-gd):Y}),S(!0))},[v]);kx({onLog:R});const L=f.useCallback(async I=>{var ce,fe;const G=await Ne.getLogs({types:_,cursor:I?void 0:N.current??void 0,tail:I?500:0}),Y=((ce=G.data)==null?void 0:ce.entries)??[];return N.current=((fe=G.data)==null?void 0:fe.cursor)??{},n(se=>fP(se,Y,I)),Y.length},[_]),te=f.useCallback(async()=>{var I;o(!0),l(""),N.current=null;try{const ce=(((I=(await Ne.getLogsMeta()).data)==null?void 0:I.files)??[]).filter(fe=>fe.file).map(fe=>`${fe.type}: ${fe.file}`).join(" · ");k(ce||"No log files yet — output appears when the bot runs."),await L(!0),S(!0)}catch(G){l(G instanceof Error?G.message:"Failed to load logs"),S(!1)}finally{o(!1)}},[L]);f.useEffect(()=>{te()},[te]),f.useEffect(()=>{if(d||a)return;const I=window.setInterval(async()=>{if(!M.current)try{await L(!1),S(!0),l("")}catch(G){S(!1),l(G instanceof Error?G.message:"Live update failed")}},dP);return()=>window.clearInterval(I)},[d,a,L]),f.useEffect(()=>{if(!p||d)return;const I=T.current;I&&(I.scrollTop=I.scrollHeight)},[t,p,d]);const K=f.useMemo(()=>t.filter(I=>{var Y;if(v!=="all"&&I.type!==v)return!1;if(!w.trim())return!0;const G=w.toLowerCase();return I.message.toLowerCase().includes(G)||(((Y=I.timestamp)==null?void 0:Y.toLowerCase().includes(G))??!1)}),[t,v,w]);return s.jsxs("div",{className:"flex h-[calc(100svh-8rem)] min-h-[480px] flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Logs"}),s.jsx("p",{className:"text-muted-foreground",children:"Live bot output — updates every 2 seconds"}),E?s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:E}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:pe("size-2 rounded-full",C&&!d?"animate-pulse bg-emerald-500":"bg-muted-foreground")}),s.jsx("span",{className:"text-xs text-muted-foreground",children:d?"Paused":C?"Live":"Disconnected"})]})]}),c?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:c})}):null,s.jsxs(Ze,{className:"flex min-h-0 flex-1 flex-col border-border bg-card",children:[s.jsxs(ut,{className:"shrink-0 space-y-4 border-b border-border pb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs(dt,{className:"text-base font-medium",children:["Console",a?null:s.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[K.length," line",K.length===1?"":"s"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border px-2 py-1",children:[s.jsx(kt,{id:"auto-scroll",checked:p,onCheckedChange:g}),s.jsx(_e,{htmlFor:"auto-scroll",className:"text-xs font-normal",children:"Auto-scroll"})]}),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>m(I=>!I),children:[s.jsx(ve,{icon:d?k8:E8,size:16,className:"mr-1.5"}),d?"Resume":"Pause"]}),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>{n([]),te()},disabled:a,children:[s.jsx(ve,{icon:ur,size:16,className:"mr-1.5"}),"Refresh"]})]})]}),s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[s.jsx("div",{className:"flex flex-wrap gap-1 rounded-xl bg-secondary/50 p-1",children:iP.map(I=>s.jsx(ue,{type:"button",variant:v===I.id?"secondary":"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>b(I.id),children:I.label},I.id))}),s.jsxs("div",{className:"relative flex-1 sm:max-w-xs",children:[s.jsx(ve,{icon:ji,size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(De,{placeholder:"Filter lines…",value:w,onChange:I=>y(I.target.value),className:"h-9 pl-9"})]})]})]}),s.jsx(Qe,{className:"min-h-0 flex-1 p-0",children:a?s.jsx("div",{className:"space-y-2 p-4",children:Array.from({length:8}).map((I,G)=>s.jsx(Be,{className:"h-4 w-full"},G))}):s.jsx("div",{ref:T,className:"h-full max-h-[calc(100svh-18rem)] overflow-y-auto bg-[#0d0d12] p-4 font-mono text-[13px] leading-relaxed",children:K.length===0?s.jsx("p",{className:"text-muted-foreground",children:"No log lines yet. Start the bot and activity will appear here (also written to the Logs folder on disk)."}):s.jsx("ul",{className:"space-y-1",children:K.map((I,G)=>s.jsxs("li",{className:"flex gap-2 rounded px-1 py-0.5 hover:bg-white/[0.03]",children:[s.jsx("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:oP(I.timestamp)}),s.jsx("span",{className:pe("shrink-0 rounded px-1.5 py-0 text-[10px] font-semibold uppercase",uP[I.type]),children:I.type}),s.jsx("span",{className:pe("min-w-0 flex-1 whitespace-pre-wrap break-words",cP[I.type]),children:I.message||" "})]},Wh(I,G)))})})})]})]})}const pP=[{title:"Colors",description:"Theme colors used across the transcript page.",fields:[{path:"Theme.Background",label:"Page background",type:"color"},{path:"Theme.Panel",label:"Panel background",type:"color"},{path:"Theme.PanelSecondary",label:"Secondary panel",type:"color"},{path:"Theme.Border",label:"Borders",type:"color"},{path:"Theme.Text",label:"Main text",type:"color"},{path:"Theme.Muted",label:"Muted text",type:"color"},{path:"Theme.Accent",label:"Accent",type:"color"},{path:"Theme.Link",label:"Links",type:"color"},{path:"Theme.AttachmentLink",label:"Attachment links",type:"color"},{path:"Theme.CodeBackground",label:"Code blocks",type:"color"}]},{title:"Typography",fields:[{path:"Typography.FontFamily",label:"Font family",type:"googleFont",description:"Google Fonts are loaded automatically in saved transcripts."}]},{title:"Header",fields:[{path:"Header.Title",label:"Title",type:"text"},{path:"Header.Subtitle",label:"Subtitle",type:"textarea",description:"Placeholders: {{ticketName}} {{ticketId}} {{messageCount}} {{reason}}. Use **text** for bold."},{path:"Header.Badge",label:"Badge label",type:"text"},{path:"Header.ShowMetaCards",label:"Show info cards",type:"boolean"}]},{title:"Info card labels",fields:[{path:"Meta.ChannelLabel",label:"Channel label",type:"text"},{path:"Meta.TicketIdLabel",label:"Ticket ID label",type:"text"},{path:"Meta.MessageCountLabel",label:"Message count label",type:"text"},{path:"Meta.CloseReasonLabel",label:"Close reason label",type:"text"},{path:"Meta.DefaultCloseReason",label:"Default close reason",type:"text"}]},{title:"Messages section",fields:[{path:"Messages.SectionTitle",label:"Section heading",type:"text"},{path:"Messages.EmptyState",label:"Empty state text",type:"text"}]},{title:"Advanced CSS",description:"Optional extra CSS appended to the transcript stylesheet.",fields:[{path:"Advanced.CustomCss",label:"Custom CSS",type:"textarea",description:"Example: .badge { font-size: 1rem; }"}]}],hP=450;function gP(t,n){return n&&t!=="viewer"}function xP(){const{user:t,hasPermission:n}=qt(),a=!gP(t==null?void 0:t.role,n("transcripts")),[o,c]=f.useState(null),[l,d]=f.useState(null),[m,p]=f.useState(!0),[g,v]=f.useState(!1),[b,w]=f.useState(""),[y,C]=f.useState(""),[S,E]=f.useState(""),[k,N]=f.useState(!1),T=f.useRef(null),M=f.useCallback(async()=>{var K;p(!0),w(""),C("");try{const G=(await Ne.getTranscriptTemplate()).data??null;if(G){const Y={...G,Typography:{...G.Typography,FontFamily:kS((K=G.Typography)==null?void 0:K.FontFamily)}};c(Y),d(structuredClone(Y))}}catch(I){w(I instanceof Error?I.message:"Failed to load template")}finally{p(!1)}},[]);f.useEffect(()=>{M()},[M]);const _=f.useCallback(async K=>{N(!0);try{const I=await Ne.previewTranscriptTemplate(K);E(I)}catch{E("

Preview failed to load.

")}finally{N(!1)}},[]);f.useEffect(()=>{if(o)return T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{_(o)},hP),()=>{T.current&&clearTimeout(T.current)}},[o,_]);function R(K,I){c(G=>G&&Gn(G,K,I))}async function L(){if(!(a||!o)){v(!0),w(""),C("");try{const K=await Ne.saveTranscriptTemplate(o);C(K.message||"Saved."),d(structuredClone(o))}catch(K){w(K instanceof Error?K.message:"Save failed")}finally{v(!1)}}}const te=o&&l&&JSON.stringify(o)!==JSON.stringify(l);return m?s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Be,{className:"h-96 rounded-xl"}),s.jsx(Be,{className:"h-96 rounded-xl"})]}):o?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize how new ticket transcripts look. Existing saved transcripts are not changed."}),s.jsxs("div",{className:"flex items-center gap-2",children:[te?s.jsx("span",{className:"text-xs text-amber-500",children:"Unsaved changes"}):null,a?s.jsx("span",{className:"text-xs text-muted-foreground",children:"View only"}):s.jsxs(ue,{size:"sm",onClick:L,disabled:g||!te,children:[s.jsx(ve,{icon:Sd,size:16,className:"mr-1.5"}),g?"Saving…":"Save appearance"]})]})]}),b?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:b})}):null,y?s.jsx(Ye,{className:"border-primary/30 bg-primary/10 text-primary",children:s.jsx(qe,{children:y})}):null,s.jsxs("div",{className:"grid min-h-0 gap-4 xl:grid-cols-[minmax(320px,420px)_1fr]",children:[s.jsx(vP,{data:o,readOnly:a,onPatch:R}),s.jsxs(Ze,{className:"flex min-h-[520px] flex-col overflow-hidden border-border bg-card",children:[s.jsxs(ut,{className:"pb-2",children:[s.jsx(dt,{className:"text-base",children:"Live preview"}),s.jsxs(Ot,{children:["Sample ticket with your current settings",k?" · updating…":""]})]}),s.jsx(Qe,{className:"min-h-0 flex-1 p-4 pt-0",children:s.jsx("iframe",{title:"Transcript template preview",srcDoc:S,className:pe("h-[min(640px,calc(100svh-14rem))] w-full rounded-lg border border-border bg-background",k&&"opacity-60"),sandbox:"allow-same-origin"})})]})]})]}):s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:b||"Failed to load template"})})}function vP({data:t,readOnly:n,onPatch:a}){return s.jsx("div",{className:"max-h-[min(720px,calc(100svh-12rem))] space-y-4 overflow-y-auto pr-1",children:pP.map(o=>s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsx(dt,{className:"text-base",children:o.title}),o.description?s.jsx(Ot,{children:o.description}):null]}),s.jsx(Qe,{className:"grid gap-4 sm:grid-cols-2",children:o.fields.map(c=>s.jsx("div",{className:c.type==="textarea"?"sm:col-span-2":"",children:s.jsx(pd,{field:c,value:Fr(t,c.path),readOnly:n,onChange:l=>a(c.path,l)})},c.path))})]},o.title))})}function bP(t,n){return n&&t!=="viewer"}function yP(){const{user:t,hasPermission:n}=qt(),a=!bP(t==null?void 0:t.role,n("transcripts")),[o,c]=f.useState(null),[l,d]=f.useState(!0),[m,p]=f.useState(!1),[g,v]=f.useState(!1),[b,w]=f.useState(""),[y,C]=f.useState(""),S=f.useCallback(async()=>{var N,T,M;d(!0),w(""),C("");try{const R=(await Ne.getTranscriptSettings()).data;R&&c({autoDelete:{enabled:!!((N=R.autoDelete)!=null&&N.enabled),afterDays:((T=R.autoDelete)==null?void 0:T.afterDays)??30},publicAccess:{enabled:!!((M=R.publicAccess)!=null&&M.enabled)}})}catch(_){w(_ instanceof Error?_.message:"Failed to load settings")}finally{d(!1)}},[]);f.useEffect(()=>{S()},[S]);async function E(){if(!(!o||a)){p(!0),w(""),C("");try{const N=await Ne.updateTranscriptSettings(o);N.data&&c({autoDelete:{enabled:N.data.autoDelete.enabled,afterDays:N.data.autoDelete.afterDays},publicAccess:{enabled:N.data.publicAccess.enabled}}),C(N.message??"Settings saved.")}catch(N){w(N instanceof Error?N.message:"Failed to save settings")}finally{p(!1)}}}async function k(){var N,T;if(!a){v(!0),w(""),C("");try{const M=await Ne.purgeTranscripts();C(M.message??((N=M.data)!=null&&N.skipped?"Auto-delete is disabled.":`Removed ${((T=M.data)==null?void 0:T.deleted)??0} transcript(s).`))}catch(M){w(M instanceof Error?M.message:"Purge failed")}finally{v(!1)}}}return l?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Be,{className:"h-40 w-full rounded-xl"}),s.jsx(Be,{className:"h-40 w-full rounded-xl"})]}):o?s.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[a?s.jsx(Ye,{children:s.jsx(qe,{children:"You have view-only access. An admin or editor can change these settings."})}):null,b?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:b})}):null,y?s.jsx(Ye,{children:s.jsx(qe,{children:y})}):null,s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-base",children:"Auto-delete"}),s.jsx(Ot,{children:"Remove transcript files automatically after they reach a certain age. The server checks hourly and whenever you open the library."})]}),s.jsxs(Qe,{className:"space-y-4",children:[s.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 size-4 rounded border-border accent-primary",checked:o.autoDelete.enabled,disabled:a,onChange:N=>c(T=>T&&{...T,autoDelete:{...T.autoDelete,enabled:N.target.checked}})}),s.jsxs("span",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Enable auto-delete"}),s.jsx("span",{className:"mt-0.5 block text-muted-foreground",children:"Deletes HTML files in Data/Transcripts based on last modified time."})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",htmlFor:"transcript-after-days",children:"Delete after (days)"}),s.jsx(De,{id:"transcript-after-days",type:"number",min:1,max:3650,disabled:a||!o.autoDelete.enabled,value:o.autoDelete.afterDays,onChange:N=>c(T=>T&&{...T,autoDelete:{...T.autoDelete,afterDays:Math.min(3650,Math.max(1,parseInt(N.target.value,10)||1))}}),className:"max-w-[8rem]"})]}),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",disabled:a||g,onClick:()=>void k(),children:[s.jsx(ve,{icon:ur,size:16,className:pe(g&&"animate-spin")}),"Run cleanup now"]})]})]}),s.jsxs(Ze,{className:"border-border bg-card",children:[s.jsxs(ut,{children:[s.jsx(dt,{className:"text-base",children:"Public transcripts"}),s.jsxs(Ot,{children:["When enabled, anyone with the link can view a transcript at"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:typeof window<"u"?`${window.location.origin}/transcripts/:id`:"/transcripts/:id"})," ","without signing in. Channel IDs are numeric but not secret—only enable if you are comfortable sharing links."]})]}),s.jsx(Qe,{children:s.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 size-4 rounded border-border accent-primary",checked:o.publicAccess.enabled,disabled:a,onChange:N=>c(T=>T&&{...T,publicAccess:{enabled:N.target.checked}})}),s.jsxs("span",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Allow public transcript URLs"}),s.jsx("span",{className:"mt-0.5 block text-muted-foreground",children:"Dashboard preview and download still require login."})]})]})})]}),a?null:s.jsxs(ue,{type:"button",disabled:m,onClick:()=>void E(),children:[s.jsx(ve,{icon:Sd,size:16}),m?"Saving…":"Save settings"]})]}):s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:"Could not load transcript settings."})})}function wP(t,n){return n&&t!=="viewer"}function r2(t){return t==null?"":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function a2(t){const n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function jP(){var $;const{user:t,hasPermission:n}=qt(),a=wP(t==null?void 0:t.role,n("transcripts")),[o,c]=f.useState("browse"),[l,d]=f.useState([]),[m,p]=f.useState(null),[g,v]=f.useState(!0),[b,w]=f.useState(""),[y,C]=f.useState(""),[S,E]=f.useState(""),[k,N]=f.useState(0),[T,M]=f.useState(!1),[_,R]=f.useState(!1),[L,te]=f.useState(!1),[K,I]=f.useState(!1),G=f.useCallback(async()=>{v(!0),C("");try{const X=(await Ne.listTranscripts()).data??[];d(X),p(xe=>{var q;return xe&&X.some(ge=>ge.id===xe)?xe:((q=X[0])==null?void 0:q.id)??null})}catch(H){C(H instanceof Error?H.message:"Failed to load transcripts")}finally{v(!1)}},[]);f.useEffect(()=>{G()},[G]),f.useEffect(()=>{o==="browse"&&Ne.getTranscriptSettings().then(H=>{var X,xe;te(!!((xe=(X=H.data)==null?void 0:X.publicAccess)!=null&&xe.enabled))}).catch(()=>te(!1))},[o]);const Y=f.useMemo(()=>{if(!S.trim())return l;const H=S.toLowerCase();return l.filter(X=>X.id.includes(H)||X.filename.toLowerCase().includes(H)||X.ticketName&&X.ticketName.toLowerCase().includes(H))},[l,S]),ce=f.useMemo(()=>l.find(H=>H.id===m)??null,[l,m]),fe=m?`/api/system/transcripts/${encodeURIComponent(m)}/view`:null,se=m?`/api/system/transcripts/${encodeURIComponent(m)}/download`:null,P=m&&L?`${window.location.origin}/transcripts/${encodeURIComponent(m)}`:null;function Z(H){w(""),p(H),N(X=>X+1)}function ae(){fe&&window.open(fe,"_blank","noopener,noreferrer")}function re(){P&&window.open(P,"_blank","noopener,noreferrer")}async function V(){if(P)try{await navigator.clipboard.writeText(P),I(!0),window.setTimeout(()=>I(!1),2e3)}catch{w("Could not copy link to clipboard.")}}async function O(){var X;if(!m||!a)return;const H=((X=ce==null?void 0:ce.ticketName)==null?void 0:X.trim())||`channel ${m}`;if(window.confirm(`Delete the transcript for ${H}? This cannot be undone.`)){R(!0),w("");try{await Ne.deleteTranscript(m),await G()}catch(xe){w(xe instanceof Error?xe.message:"Failed to delete transcript")}finally{R(!1)}}}async function D(){if(!(!se||!ce)){M(!0),w("");try{const H=await fetch(se,{credentials:"include"});if(!H.ok){const ge=await H.json().catch(()=>({}));throw new Error(ge.error||`Download failed (${H.status})`)}const X=await H.blob(),xe=URL.createObjectURL(X),q=document.createElement("a");q.href=xe,q.download=ce.filename,q.click(),URL.revokeObjectURL(xe)}catch(H){w(H instanceof Error?H.message:"Failed to download transcript")}finally{M(!1)}}}return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Transcripts"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse saved transcripts or customize how new ones look when tickets close."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsx(ue,{type:"button",variant:o==="browse"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>c("browse"),children:"Library"}),s.jsx(ue,{type:"button",variant:o==="appearance"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>c("appearance"),children:"Appearance"}),s.jsx(ue,{type:"button",variant:o==="settings"?"secondary":"ghost",size:"sm",className:"h-8",onClick:()=>c("settings"),children:"Settings"})]}),o==="browse"?s.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>G(),disabled:g,children:[s.jsx(ve,{icon:ur,size:16,className:pe(g&&"animate-spin")}),"Refresh"]}):null]})]}),o==="appearance"?s.jsx(xP,{}):o==="settings"?s.jsx(yP,{}):s.jsxs(s.Fragment,{children:[y?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:y})}):null,s.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(240px,320px)_1fr]",children:[s.jsxs(Ze,{className:"flex min-h-[420px] flex-col border-border bg-card",children:[s.jsxs(ut,{className:"space-y-3 pb-3",children:[s.jsxs(dt,{className:"text-base font-medium",children:["Saved transcripts",!g&&l.length>0?s.jsxs("span",{className:"ml-2 font-normal text-muted-foreground",children:["(",l.length,")"]}):null]}),s.jsxs("div",{className:"relative",children:[s.jsx(ve,{icon:ji,size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(De,{placeholder:"Search by ticket name or channel ID…",value:S,onChange:H=>E(H.target.value),className:"pl-9"})]})]}),s.jsx(Qe,{className:"min-h-0 flex-1 p-0 pb-4",children:s.jsx(fc,{className:"h-[min(520px,calc(100svh-16rem))] px-4",children:g?s.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((H,X)=>s.jsx(Be,{className:"h-16 w-full rounded-lg"},X))}):Y.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-sm text-muted-foreground",children:[s.jsx(ve,{icon:Ul,size:32,className:"opacity-40"}),s.jsx("p",{children:l.length===0?"No transcripts yet. They appear when tickets are closed.":"No transcripts match your search."})]}):s.jsx("ul",{className:"space-y-1.5",children:Y.map(H=>{var q;const X=H.id===m,xe=((q=H.ticketName)==null?void 0:q.trim())||`Channel ${H.id}`;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>Z(H.id),className:pe("w-full rounded-lg border px-3 py-2.5 text-left transition-colors",X?"border-primary/50 bg-primary/10":"border-transparent bg-secondary/30 hover:bg-secondary/50"),children:[s.jsx("p",{className:"truncate text-sm font-medium",children:xe}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[a2(H.createdAt),H.size!=null?` · ${r2(H.size)}`:""]})]})},H.id)})})})})]}),s.jsxs(Ze,{className:"flex min-h-[420px] flex-col overflow-hidden border-border bg-card",children:[s.jsxs(ut,{className:"flex flex-row flex-wrap items-center justify-between gap-2 space-y-0 pb-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(dt,{className:"truncate text-base font-medium",children:ce?(($=ce.ticketName)==null?void 0:$.trim())||`Channel ${ce.id}`:"Preview"}),ce?s.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[a2(ce.createdAt),ce.size!=null?` · ${r2(ce.size)}`:""]}):null]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[P?s.jsxs(s.Fragment,{children:[s.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>void V(),children:[s.jsx(ve,{icon:R2,size:16}),K?"Copied":"Copy link"]}),s.jsxs(ue,{variant:"outline",size:"sm",onClick:re,children:[s.jsx(ve,{icon:Nd,size:16}),"Public page"]})]}):null,s.jsxs(ue,{variant:"outline",size:"sm",disabled:!fe,onClick:ae,children:[s.jsx(ve,{icon:p8,size:16}),"Open tab"]}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!se||T,onClick:()=>void D(),children:[s.jsx(ve,{icon:Cd,size:16}),T?"Saving…":"Download"]}),a?s.jsxs(ue,{variant:"outline",size:"sm",disabled:!m||_,className:"text-destructive hover:text-destructive",onClick:()=>void O(),children:[s.jsx(ve,{icon:wi,size:16}),_?"Deleting…":"Delete"]}):null]})]}),s.jsxs(Qe,{className:"flex min-h-0 flex-1 flex-col gap-2 p-4 pt-0",children:[b?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:b})}):null,ce&&fe?s.jsx("iframe",{title:`Transcript ${ce.id}`,src:fe,className:"min-h-[min(560px,calc(100svh-18rem))] w-full flex-1 rounded-lg border border-border bg-background",sandbox:"allow-same-origin"},k):s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border py-16 text-center text-sm text-muted-foreground",children:[s.jsx(ve,{icon:Ul,size:40,className:"opacity-30"}),s.jsx("p",{children:"Select a transcript from the list to preview it here."})]})]})]})]})]})]})}function CP(){const[t,n]=f.useState([]),[a,o]=f.useState(""),[c,l]=f.useState(!0),[d,m]=f.useState(""),[p,g]=f.useState(!0);f.useEffect(()=>{try{Ne.getConfigJson("supportbot").then(W=>{if(W&&W.data&&typeof W.data=="object"){const oe=Fr(W.data,"Ticket.DepartmentSystem.Enabled");typeof oe=="boolean"&&g(oe)}}).catch(()=>{})}catch{}},[]);const[v,b]=f.useState("all"),[w,y]=f.useState("all"),[C,S]=f.useState(""),E=f.useMemo(()=>{const W=new Set;return Array.isArray(t)&&t.forEach(oe=>{if(oe&&oe.department&&typeof oe.department=="string"){const Se=oe.department.trim().toLowerCase();Se&&W.add(Se)}}),Array.from(W).sort()},[t]),k=f.useMemo(()=>Array.isArray(t)?t.filter(W=>{var oe,Se,ye,Re,nt,mt;if(!W||p&&v!=="all"&&((oe=W.department)==null?void 0:oe.toLowerCase())!==v.toLowerCase()||w!=="all"&&((Se=W.priority)==null?void 0:Se.toLowerCase())!==w.toLowerCase())return!1;if(C.trim()){const bt=C.toLowerCase().trim(),Rr=(ye=W.subject)==null?void 0:ye.toLowerCase().includes(bt),xn=(Re=W.ticket_id)==null?void 0:Re.toLowerCase().includes(bt),mn=(nt=W.user_id)==null?void 0:nt.toLowerCase().includes(bt),Wr=p&&((mt=W.department)==null?void 0:mt.toLowerCase().includes(bt));if(!Rr&&!xn&&!mn&&!Wr)return!1}return!0}):[],[t,p,v,w,C]),[N,T]=f.useState(null),[M,_]=f.useState(!1),[R,L]=f.useState(!1),[te,K]=f.useState([]),[I,G]=f.useState(!1),[Y,ce]=f.useState(""),[fe,se]=f.useState([]),[P,Z]=f.useState(!1),[ae,re]=f.useState(null),[V,O]=f.useState(!1),[D,$]=f.useState(""),[H,X]=f.useState(null),[xe,q]=f.useState(""),[ge,me]=f.useState(!1),[B,ie]=f.useState(null),[we,Ce]=f.useState(""),[ze,Ke]=f.useState(null),[ft,Pt]=f.useState(!1),[gn,Yr]=f.useState("general"),[_n,wn]=f.useState(""),[Xn,Zn]=f.useState(""),[It,po]=f.useState(!1),nn=async()=>{if(!_n.trim()){Dt.error("Please enter a subject or reason for the ticket.");return}po(!0);try{const W=await Ne.createTicket({department:gn,subject:_n.trim(),userId:Xn.trim()||void 0});Dt.success(W.message||"Ticket opened successfully!"),Pt(!1),wn(""),Zn(""),qr()}catch(W){Dt.error(W instanceof Error?W.message:"Failed to open ticket.")}finally{po(!1)}},Dn=W=>{ie(W),Ce("Closed via Web Dashboard"),me(!0)},Da=async()=>{if(!B)return;const W=B.ticket_id;Ke(W);try{await Ne.closeTicket(W,we||"Closed via Web Dashboard"),Dt.success("Ticket closed and transcript saved."),n(oe=>oe.filter(Se=>Se.ticket_id!==W)),(N==null?void 0:N.ticket_id)===W&&(_(!1),L(!1),T(null)),me(!1),ie(null)}catch(oe){Dt.error(oe instanceof Error?oe.message:"Failed to close ticket.")}finally{Ke(null)}},ho=f.useRef(null),Qn=f.useRef(null),Es=()=>{var W;(W=ho.current)==null||W.scrollIntoView({behavior:"smooth"})},qr=f.useCallback(async()=>{l(!0),m("");try{const W=await Ne.listOpenTickets();W.data&&(o(W.data.guildId),n(W.data.tickets.sort((oe,Se)=>Se.created_at-oe.created_at)))}catch(W){m(W instanceof Error?W.message:"Failed to load open tickets")}finally{l(!1)}},[]);f.useEffect(()=>{qr()},[qr]),f.useEffect(()=>{Ne.getGuildResources().then(W=>{W.data&&re(W.data)}).catch(()=>{})},[]);const gr=f.useCallback(W=>{N&&W.ticketId===N.ticket_id&&(K(oe=>oe.some(Se=>Se.id===W.message.id)?oe:[...oe,W.message]),setTimeout(Es,100))},[N]),Tt=f.useCallback(W=>{N&&W.ticketId===N.ticket_id&&K(oe=>oe.filter(Se=>Se.id!==W.messageId))},[N]),On=f.useCallback(W=>{N&&W.ticketId===N.ticket_id&&K(oe=>oe.map(Se=>Se.id===W.messageId?{...Se,content:W.content}:Se))},[N]),Mt=f.useCallback(W=>{n(oe=>oe.some(Se=>Se.ticket_id===W.ticket_id)?oe:[W,...oe]),Dt.info("New Ticket Created",{description:`#${W.ticket_id} - ${W.subject||"No Subject"}`})},[]),Oi=f.useCallback(W=>{n(oe=>oe.filter(Se=>Se.ticket_id!==W.ticket_id)),(N==null?void 0:N.ticket_id)===W.ticket_id&&Dt.warning("Active ticket was closed in Discord.")},[N]);kx({onTicketMessage:gr,onTicketMessageDeleted:Tt,onTicketMessageUpdated:On,onTicketCreated:Mt,onTicketClosed:Oi});const Li=async W=>{var oe;T(W),_(!0),G(!0),K([]),se([]),X(null);try{const Se=await Ne.getTicketMessages(W.ticket_id);(oe=Se.data)!=null&&oe.messages&&(K(Se.data.messages),setTimeout(Es,150))}catch(Se){Dt.error(Se instanceof Error?Se.message:"Failed to fetch messages")}finally{G(!1)}},go=W=>{const oe=Array.from(W.target.files||[]);oe.length&&(oe.forEach(Se=>{const ye=new FileReader;ye.onload=Re=>{var mt;const nt=(mt=Re.target)==null?void 0:mt.result;se(bt=>[...bt,{filename:Se.name,data:nt,previewUrl:Se.type.startsWith("image/")?nt:void 0,sizeMb:(Se.size/1024/1024).toFixed(2)}])},ye.readAsDataURL(Se)}),Qn.current&&(Qn.current.value=""))},Kr=W=>{se(oe=>oe.filter((Se,ye)=>ye!==W))},Oa=async W=>{var ye;if(W.preventDefault(),!Y.trim()&&!fe.length||!N||P)return;const oe=Y.trim(),Se=[...fe];Z(!0),ce(""),se([]),O(!1);try{const Re=await Ne.me().catch(()=>null),nt=((ye=Re==null?void 0:Re.data)==null?void 0:ye.username)||"Staff",mt=await Ne.sendTicketReply(N.ticket_id,oe,nt,Se.map(bt=>({filename:bt.filename,data:bt.data})));mt.data&&(K(bt=>bt.some(Rr=>Rr.id===mt.data.id)?bt:[...bt,{id:mt.data.id,author:mt.data.author,content:mt.data.content,attachments:mt.data.attachments||[],createdAt:mt.data.createdAt}]),setTimeout(Es,100))}catch(Re){Dt.error(Re instanceof Error?Re.message:"Failed to send reply to Discord."),ce(oe),se(Se)}finally{Z(!1)}},Mr=async W=>{if(N)try{await Ne.deleteTicketMessage(N.ticket_id,W),K(oe=>oe.filter(Se=>Se.id!==W)),Dt.success("Message deleted in Discord.")}catch(oe){Dt.error(oe instanceof Error?oe.message:"Failed to delete message.")}},Kt=W=>{X(W.id),q(W.content)},La=()=>{X(null),q("")},Oe=async W=>{if(!(!N||!xe.trim()))try{await Ne.editTicketMessage(N.ticket_id,W,xe.trim()),K(oe=>oe.map(Se=>Se.id===W?{...Se,content:xe.trim()}:Se)),X(null),Dt.success("Message updated in Discord.")}catch(oe){Dt.error(oe instanceof Error?oe.message:"Failed to edit message.")}},tt=W=>{const oe=W.target.value;ce(oe);const Se=W.target.selectionStart||oe.length,ye=oe.slice(0,Se),Re=ye.lastIndexOf("@");if(Re!==-1&&!ye.slice(Re).includes(" ")){const nt=ye.slice(Re+1).toLowerCase();$(nt),O(!0)}else O(!1)},it=(W,oe,Se)=>{const ye=Y.lastIndexOf("@"),Re=Y.slice(0,ye),nt=Se?`<@&${oe}>`:`<@${oe}>`;ce(`${Re}${nt} `),O(!1)},rn=W=>{const oe=Math.floor((Date.now()-W)/1e3);return fg(oe)},Ft=W=>new Date(W).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),Rt=W=>{if(!W)return null;const oe=/(```[\s\S]*?```|`[^`]+`|\*\*\*[\s\S]+?\*\*\*|\*\*[\s\S]+?\*\*|__[\s\S]+?__|~~[\s\S]+?~~|\|\|[\s\S]+?\|\||<@!?&?\d+>|^###\s[^\n]+|^##\s[^\n]+|^-#\s[^\n]+|\[[^\]]+\]\(https?:\/\/[^\s)]+\)|https?:\/\/[^\s]+)/gm;return W.split(oe).map((ye,Re)=>{var Rr;if(!ye)return null;if(ye.startsWith("-# "))return s.jsx("span",{className:"text-xs text-muted-foreground font-medium block my-0.5 opacity-80",children:Rt(ye.slice(3))},Re);if(ye.startsWith("## "))return s.jsx("span",{className:"text-base font-bold text-foreground block my-1 tracking-tight",children:Rt(ye.slice(3))},Re);if(ye.startsWith("### "))return s.jsx("span",{className:"text-sm font-bold text-foreground block my-0.5",children:Rt(ye.slice(4))},Re);if(ye.startsWith("```")&&ye.endsWith("```")&&ye.length>=6){const xn=ye.slice(3,-3).replace(/^[a-z0-9_-]+\n/i,"");return s.jsx("pre",{className:"bg-black/60 p-2.5 rounded-lg text-xs font-mono my-1.5 border border-border overflow-x-auto text-emerald-400 font-mono",children:s.jsx("code",{children:xn})},Re)}if(ye.startsWith("`")&&ye.endsWith("`")&&ye.length>2)return s.jsx("code",{className:"bg-black/50 px-1.5 py-0.5 rounded text-xs font-mono text-emerald-300 border border-border/40",children:ye.slice(1,-1)},Re);if(ye.startsWith("***")&&ye.endsWith("***")&&ye.length>6)return s.jsx("strong",{className:"font-bold italic",children:Rt(ye.slice(3,-3))},Re);if(ye.startsWith("**")&&ye.endsWith("**")&&ye.length>4)return s.jsx("strong",{className:"font-bold",children:Rt(ye.slice(2,-2))},Re);if(ye.startsWith("__")&&ye.endsWith("__")&&ye.length>4)return s.jsx("span",{className:"underline underline-offset-2",children:Rt(ye.slice(2,-2))},Re);if(ye.startsWith("~~")&&ye.endsWith("~~")&&ye.length>4)return s.jsx("span",{className:"line-through opacity-80",children:Rt(ye.slice(2,-2))},Re);if(ye.startsWith("||")&&ye.endsWith("||")&&ye.length>4)return s.jsx("span",{className:"bg-secondary text-transparent hover:text-foreground hover:bg-secondary/50 px-1.5 py-0.5 rounded transition-all cursor-pointer select-none border border-border/30",title:"Click to reveal spoiler",children:ye.slice(2,-2)},Re);const nt=ye.match(/^<@!?(\d+)>$/);if(nt){const xn=nt[1],mn=new Map;N&&mn.set(N.user_id,"Ticket Author"),te.forEach(xr=>{var Xr;(Xr=xr.author)!=null&&Xr.id&&mn.set(xr.author.id,xr.author.globalName||xr.author.username)});const Wr=mn.get(xn);return s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded font-semibold text-xs bg-primary/20 text-primary mx-0.5",title:`User ID: ${xn}`,children:["@",Wr||"User"]},Re)}const mt=ye.match(/^<@&(\d+)>$/);if(mt){const xn=mt[1],mn=(Rr=ae==null?void 0:ae.roles)==null?void 0:Rr.find(Wr=>Wr.id===xn);return s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded font-semibold text-xs bg-amber-500/20 text-amber-400 mx-0.5",children:["@",mn?mn.name:`Role (${xn})`]},Re)}const bt=ye.match(/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/);if(bt){const xn=bt[1],mn=bt[2];return s.jsx("a",{href:mn,target:"_blank",rel:"noreferrer",className:"text-primary underline hover:opacity-80 break-all",children:xn},Re)}return/^https?:\/\/[^\s]+$/i.test(ye)?/\.(gif|jpe?g|png|webp)(\?[^\s]*)?$/i.test(ye)||/cdn\.discordapp\.com\/(emojis|attachments)\//i.test(ye)||/images\.discordapp\.net\//i.test(ye)||/media\d*\.giphy\.com\//i.test(ye)?s.jsx("span",{className:"block my-1",children:s.jsx("img",{src:ye,alt:"GIF/Image",className:"max-h-64 rounded-lg border border-border object-contain hover:opacity-95 transition-opacity",loading:"lazy"})},Re):s.jsx("a",{href:ye,target:"_blank",rel:"noreferrer",className:"text-primary underline hover:opacity-80 break-all",children:ye},Re):ye})},Jn=W=>!W||W.length===0?null:s.jsx("div",{className:"space-y-2 mt-1",children:W.map(oe=>{var nt,mt,bt;const Se=((nt=oe.contentType)==null?void 0:nt.startsWith("image/"))||/\.(png|jpe?g|gif|webp|svg)$/i.test(oe.name),ye=((mt=oe.contentType)==null?void 0:mt.startsWith("video/"))||/\.(mp4|webm|mov|mkv)$/i.test(oe.name),Re=((bt=oe.contentType)==null?void 0:bt.startsWith("audio/"))||/\.(mp3|wav|ogg|m4a)$/i.test(oe.name);return Se?s.jsx("div",{className:"rounded-lg overflow-hidden border border-border bg-black/40",children:s.jsx("a",{href:oe.url,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:oe.url,alt:oe.name,className:"max-h-80 max-w-full object-contain hover:opacity-95 transition-opacity",loading:"lazy"})})},oe.id):ye?s.jsx("div",{className:"rounded-lg overflow-hidden border border-border bg-black",children:s.jsx("video",{src:oe.url,controls:!0,className:"max-h-80 max-w-full"})},oe.id):Re?s.jsx("div",{className:"p-2 border border-border rounded-lg bg-secondary/20",children:s.jsx("audio",{src:oe.url,controls:!0,className:"w-full h-8"})},oe.id):s.jsxs("div",{className:"p-2.5 rounded-lg border border-border bg-secondary/20 flex items-center justify-between text-xs gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 truncate",children:[s.jsx(ve,{icon:Uy,size:16,className:"text-primary shrink-0"}),s.jsx("span",{className:"truncate font-medium",children:oe.name})]}),s.jsx(ue,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 px-2 text-xs",children:s.jsx("a",{href:oe.url,target:"_blank",rel:"noreferrer",download:!0,children:"Download"})})]},oe.id)})}),fn=W=>!W||W.length===0?null:s.jsx("div",{className:"space-y-3 mt-1.5 w-full",children:W.map((oe,Se)=>{var ye,Re,nt,mt;return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-secondary/30 p-3.5 text-xs space-y-2 border-l-4 shadow-sm relative overflow-hidden max-w-xl",style:{borderLeftColor:oe.color||"#5865F2"},children:[oe.author&&s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-foreground",children:[oe.author.iconURL&&s.jsx("img",{src:oe.author.iconURL,alt:"",className:"h-4 w-4 rounded-full"}),s.jsx("span",{children:oe.author.name})]}),((ye=oe.thumbnail)==null?void 0:ye.url)&&s.jsx("img",{src:oe.thumbnail.url,alt:"",className:"h-12 w-12 rounded object-cover absolute top-3 right-3 border border-border"}),oe.title&&s.jsx("h4",{className:"font-bold text-sm text-foreground tracking-tight pr-12",children:Rt(oe.title)}),oe.description&&s.jsx("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed pr-12",children:Rt(oe.description)}),oe.fields&&oe.fields.length>0&&s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2.5 pt-2 border-t border-border/30",children:oe.fields.map((bt,Rr)=>s.jsxs("div",{className:`space-y-0.5 ${bt.inline?"":"sm:col-span-2"}`,children:[s.jsx("p",{className:"font-semibold text-foreground text-[11px] uppercase tracking-wider",children:bt.name}),s.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:Rt(bt.value)})]},Rr))}),((Re=oe.image)==null?void 0:Re.url)&&s.jsx("div",{className:"rounded-md overflow-hidden border border-border mt-2",children:s.jsx("img",{src:oe.image.url,alt:"",className:"max-h-64 w-full object-cover"})}),(oe.footer||oe.timestamp)&&s.jsxs("div",{className:"flex items-center gap-2 pt-1 border-t border-border/20 text-[10px] text-muted-foreground",children:[((nt=oe.footer)==null?void 0:nt.iconURL)&&s.jsx("img",{src:oe.footer.iconURL,alt:"",className:"h-3.5 w-3.5 rounded-full"}),((mt=oe.footer)==null?void 0:mt.text)&&s.jsx("span",{children:oe.footer.text}),oe.timestamp&&s.jsxs("span",{children:[new Date(oe.timestamp).toLocaleDateString()," ",new Date(oe.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})]},Se)})}),Ln=W=>{if(!W||W.length===0)return null;const oe=W.map(Se=>({...Se,components:(Se.components||[]).filter(ye=>ye.customId||ye.url||ye.type===2||ye.type===3||ye.type==="BUTTON"||ye.type==="STRING_SELECT")})).filter(Se=>Se.components&&Se.components.length>0);return oe.length===0?null:s.jsx("div",{className:"space-y-2 mt-2.5 w-full",children:oe.map((Se,ye)=>{var Re;return s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:(Re=Se.components)==null?void 0:Re.map((nt,mt)=>s.jsxs("div",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-secondary/80 text-secondary-foreground text-xs font-semibold border border-border/80 shadow-sm hover:bg-secondary transition-colors cursor-pointer",children:[nt.emoji&&s.jsx("span",{children:nt.emoji}),s.jsx("span",{children:nt.label||nt.customId||"Button"})]},mt))},ye)})})},xo=()=>s.jsx(fc,{className:"flex-1 p-4 sm:p-6",children:s.jsxs("div",{className:"max-w-4xl mx-auto w-full space-y-4",children:[I?s.jsxs("div",{className:"space-y-4 p-4",children:[s.jsx(Be,{className:"h-10 w-3/4"}),s.jsx(Be,{className:"h-10 w-1/2 ml-auto"}),s.jsx(Be,{className:"h-10 w-2/3"})]}):te.length===0?s.jsx("div",{className:"p-12 text-center text-muted-foreground text-sm",children:"No recent messages in this ticket channel."}):te.map(W=>{var oe;return s.jsxs("div",{className:`group flex items-start gap-3 ${W.author.isDashboard?"flex-row-reverse":""}`,children:[s.jsxs(bs,{className:"h-8 w-8 shrink-0",children:[s.jsx(eo,{src:W.author.avatar,alt:W.author.username}),s.jsx(ys,{children:s.jsx(ve,{icon:L8,size:16})})]}),s.jsxs("div",{className:`flex flex-col space-y-1 max-w-[80%] ${W.author.isDashboard?"items-end":"items-start"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-semibold text-foreground",children:W.author.globalName||W.author.username}),W.author.bot&&s.jsx(Fn,{variant:"secondary",className:"px-1 py-0 text-[10px]",children:"BOT"}),W.author.isDashboard&&s.jsx(Fn,{variant:"default",className:"px-1 py-0 text-[10px]",children:"STAFF"}),s.jsx("span",{children:Ft(W.createdAt)}),s.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-1",children:[s.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5 text-muted-foreground hover:text-foreground",onClick:()=>Kt(W),title:"Edit Message",children:s.jsx(ve,{icon:D2,size:12})}),s.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5 text-muted-foreground hover:text-destructive",onClick:()=>Mr(W.id),title:"Delete Message",children:s.jsx(ve,{icon:wi,size:12})})]})]}),H===W.id?s.jsxs("div",{className:"flex items-center gap-2 w-full mt-1",children:[s.jsx(De,{value:xe,onChange:Se=>q(Se.target.value),className:"h-8 text-sm",autoFocus:!0}),s.jsx(ue,{size:"sm",className:"h-8 px-2 bg-primary",onClick:()=>Oe(W.id),children:s.jsx(ve,{icon:_8,size:14})}),s.jsx(ue,{size:"sm",variant:"ghost",className:"h-8 px-2",onClick:La,children:s.jsx(ve,{icon:va,size:14})})]}):W.content?s.jsx("div",{className:`rounded-lg px-3.5 py-2.5 text-sm whitespace-pre-wrap ${W.author.isDashboard?"bg-primary text-primary-foreground":"bg-secondary/40 text-secondary-foreground border border-border/50"}`,style:W.containerColor||W.author.bot&&!((oe=W.embeds)!=null&&oe.length)?{borderLeftWidth:"4px",borderLeftColor:W.containerColor||"#5865F2"}:void 0,children:Rt(W.content)}):null,Jn(W.attachments),fn(W.embeds),Ln(W.components)]})]},W.id)}),s.jsx("div",{ref:ho})]})}),vo=()=>{var W;return s.jsxs("div",{className:"p-4 border-t border-border bg-secondary/10 flex flex-col gap-2 relative",children:[fe.length>0&&s.jsx("div",{className:"max-w-4xl mx-auto w-full flex items-center gap-2 flex-wrap mb-1",children:fe.map((oe,Se)=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 px-3 rounded-lg border border-border bg-secondary text-xs",children:[oe.previewUrl?s.jsx("img",{src:oe.previewUrl,alt:"",className:"h-6 w-6 rounded object-cover"}):s.jsx(ve,{icon:Uy,size:14,className:"text-primary"}),s.jsx("span",{className:"font-medium max-w-[120px] truncate",children:oe.filename}),s.jsxs("span",{className:"text-muted-foreground text-[10px]",children:[oe.sizeMb,"MB"]}),s.jsx("button",{type:"button",onClick:()=>Kr(Se),className:"text-muted-foreground hover:text-destructive ml-1",children:s.jsx(ve,{icon:va,size:12})})]},Se))}),V&&s.jsxs("div",{className:"max-w-4xl mx-auto w-full absolute bottom-full mb-2 z-50 bg-popover text-popover-foreground border border-border rounded-xl shadow-xl overflow-hidden max-h-48 overflow-y-auto",children:[s.jsx("div",{className:"p-2 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider border-b",children:"Mentions (@)"}),N&&s.jsxs("button",{type:"button",onClick:()=>it("Ticket Author",N.user_id,!1),className:"w-full text-left p-2 hover:bg-secondary flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bs,{className:"h-5 w-5",children:s.jsx(ys,{children:"U"})}),s.jsx("span",{className:"font-medium",children:"Ticket Author"})]}),s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["@",N.user_id]})]}),(W=ae==null?void 0:ae.roles)==null?void 0:W.filter(oe=>oe.name.toLowerCase().includes(D)).slice(0,5).map(oe=>s.jsxs("button",{type:"button",onClick:()=>it(oe.name,oe.id,!0),className:"w-full text-left p-2 hover:bg-secondary flex items-center justify-between text-xs",children:[s.jsxs("span",{className:"font-medium text-amber-400",children:["@",oe.name]}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"Role"})]},oe.id))]}),s.jsxs("form",{onSubmit:Oa,className:"max-w-4xl mx-auto w-full flex items-center gap-2",children:[s.jsx("input",{type:"file",ref:Qn,multiple:!0,onChange:go,className:"hidden",accept:"image/*,video/*,audio/*,.pdf,.zip,.txt,.json"}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>{var oe;return(oe=Qn.current)==null?void 0:oe.click()},title:"Attach files or media",className:"h-9 px-2.5",children:s.jsx(ve,{icon:b8,size:16})}),s.jsx(De,{value:Y,onChange:tt,placeholder:"Type a reply... Use @ to tag roles or users",disabled:P||I,className:"flex-1"}),s.jsx(ue,{type:"submit",size:"sm",disabled:P||!Y.trim()&&!fe.length||I,children:P?s.jsx(ve,{icon:ur,size:16,className:"animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(ve,{icon:R8,size:16,className:"mr-1.5"}),"Send"]})})]})]})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Open Tickets"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage open support tickets & reply live to Discord channels from the web dashboard."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ue,{onClick:()=>Pt(!0),className:"gap-2 bg-primary font-semibold text-xs h-9",children:[s.jsx(ve,{icon:is,size:15})," Open Ticket"]}),s.jsxs(ue,{onClick:()=>void qr(),disabled:c,variant:"outline",size:"sm",children:[s.jsx(ve,{icon:ur,size:16,className:c?"animate-spin mr-2":"mr-2"}),"Refresh"]})]})]}),s.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-3 bg-card/60 p-3.5 rounded-xl border border-border/80 shadow-sm",children:[s.jsxs("div",{className:"relative w-full md:w-80",children:[s.jsx(ve,{icon:ji,size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(De,{placeholder:"Search tickets by ID, user, subject...",value:C,onChange:W=>S(W.target.value),className:"pl-9 text-xs h-9 bg-secondary/30 border-border"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 w-full md:w-auto justify-end",children:[p&&s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Department:"}),s.jsxs(Ca,{value:v,onValueChange:b,children:[s.jsx(Br,{className:"text-xs h-9 w-[160px] bg-secondary/30 border-border capitalize",children:s.jsx(Sa,{placeholder:"All Departments"})}),s.jsxs($r,{children:[s.jsx(vt,{value:"all",children:"All Departments"}),E.map(W=>s.jsx(vt,{value:W,className:"capitalize",children:W},W))]})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Priority:"}),s.jsxs(Ca,{value:w,onValueChange:y,children:[s.jsx(Br,{className:"text-xs h-9 w-[140px] bg-secondary/30 border-border capitalize",children:s.jsx(Sa,{placeholder:"All Priorities"})}),s.jsxs($r,{children:[s.jsx(vt,{value:"all",children:"All Priorities"}),s.jsx(vt,{value:"low",children:"Low"}),s.jsx(vt,{value:"medium",children:"Medium / Normal"}),s.jsx(vt,{value:"high",children:"High"}),s.jsx(vt,{value:"urgent",children:"Urgent"})]})]})]}),(v!=="all"||w!=="all"||C.trim())&&s.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>{b("all"),y("all"),S("")},className:"h-9 text-xs text-muted-foreground hover:text-foreground px-2",children:"Reset"})]})]}),s.jsx(Ze,{className:"border-border bg-card",children:s.jsx(Qe,{className:"p-0",children:c?s.jsxs("div",{className:"space-y-4 p-6",children:[s.jsx(Be,{className:"h-12 w-full"}),s.jsx(Be,{className:"h-12 w-full"}),s.jsx(Be,{className:"h-12 w-full"})]}):d?s.jsx("div",{className:"p-6",children:s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:d})})}):k.length===0?s.jsxs("div",{className:"p-12 text-center text-muted-foreground space-y-2",children:[s.jsx("p",{children:"No open tickets found matching your filter criteria."}),(v!=="all"||w!=="all"||C.trim())&&s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>{b("all"),y("all"),S("")},className:"text-xs mt-2",children:"Clear Filters"})]}):s.jsx("div",{className:"divide-y divide-border",children:k.map(W=>s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between p-4 hover:bg-secondary/10 transition-colors gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"font-medium text-primary",children:W.subject||"Untitled Ticket"}),s.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",W.ticket_id]}),p&&W.department&&s.jsx(Fn,{variant:"outline",className:"text-xs capitalize",children:W.department}),s.jsxs(Fn,{variant:W.priority==="high"?"destructive":W.priority==="medium"?"secondary":"outline",className:"text-xs capitalize",children:[W.priority," priority"]})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["User ID: ",s.jsx("span",{className:"font-mono",children:W.user_id}),W.description&&` • ${W.description}`]})]}),s.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto justify-end",children:[s.jsxs("div",{className:"text-sm text-muted-foreground flex items-center whitespace-nowrap mr-2",children:[s.jsx(ve,{icon:h8,size:14,className:"mr-1.5"}),rn(W.created_at)]}),s.jsxs(ue,{variant:"default",size:"sm",onClick:()=>Li(W),className:"bg-primary text-primary-foreground hover:bg-primary/90",children:[s.jsx(ve,{icon:g8,size:16,className:"mr-2"}),"Live Chat"]}),s.jsxs(ue,{variant:"destructive",size:"sm",onClick:()=>Dn(W),disabled:ze===W.ticket_id,children:[ze===W.ticket_id?s.jsx(ve,{icon:ur,size:14,className:"animate-spin mr-1.5"}):s.jsx(ve,{icon:va,size:14,className:"mr-1.5"}),"Close"]}),a&&s.jsx(ue,{variant:"secondary",size:"sm",asChild:!0,children:s.jsx("a",{href:`https://discord.com/channels/${a}/${W.ticket_id}`,target:"_blank",rel:"noreferrer",children:s.jsx(ve,{icon:Nd,size:16})})})]})]},W.ticket_id))})})}),M&&R&&s.jsx("div",{className:"fixed inset-0 z-50 bg-black/65 backdrop-blur-sm flex items-center justify-center p-4 sm:p-6 lg:p-8 animate-in fade-in-0",onClick:W=>{W.target===W.currentTarget&&L(!1)},children:s.jsxs("div",{className:"bg-card text-card-foreground border border-border rounded-2xl shadow-2xl flex flex-col w-full max-w-5xl h-[88vh] overflow-hidden animate-in zoom-in-95",children:[s.jsxs("div",{className:"p-4 border-b border-border bg-secondary/20 flex flex-col space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[s.jsx("h2",{className:"text-lg font-bold tracking-tight truncate",children:(N==null?void 0:N.subject)||"Ticket Live Chat"}),s.jsxs(Fn,{variant:"outline",className:"font-mono text-xs shrink-0",children:["#",N==null?void 0:N.ticket_id]}),(N==null?void 0:N.department)&&s.jsx(Fn,{variant:"secondary",className:"text-xs capitalize shrink-0",children:N.department})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[N&&s.jsxs(ue,{variant:"destructive",size:"sm",onClick:()=>Dn(N),disabled:ze===N.ticket_id,className:"h-8 px-2.5 text-xs",children:[ze===N.ticket_id?s.jsx(ve,{icon:ur,size:14,className:"animate-spin mr-1.5"}):s.jsx(ve,{icon:va,size:14,className:"mr-1.5"}),"Close Ticket"]}),s.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>L(!1),className:"h-8 px-3 text-xs flex items-center gap-1.5",children:[s.jsx(ve,{icon:S8,size:14}),s.jsx("span",{children:"Collapse"})]}),s.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>{_(!1),L(!1)},className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:s.jsx(ve,{icon:va,size:18})})]})]}),(N==null?void 0:N.description)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]}),xo(),vo()]})}),M&&!R&&s.jsx(Yj,{open:M,onOpenChange:_,children:s.jsxs(Hg,{side:"right",className:"w-full sm:max-w-xl p-0 flex flex-col h-full bg-card",children:[s.jsxs(Gg,{className:"p-4 border-b border-border space-y-1 bg-secondary/20",children:[s.jsxs("div",{className:"flex items-center justify-between pr-8",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[s.jsx(Vg,{className:"text-base font-bold truncate",children:(N==null?void 0:N.subject)||"Ticket Live Chat"}),s.jsxs(Fn,{variant:"outline",className:"font-mono text-xs shrink-0",children:["#",N==null?void 0:N.ticket_id]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[N&&s.jsxs(ue,{variant:"destructive",size:"sm",onClick:()=>Dn(N),disabled:ze===N.ticket_id,className:"h-7 px-2 text-xs",children:[ze===N.ticket_id?s.jsx(ve,{icon:ur,size:13,className:"animate-spin mr-1"}):s.jsx(ve,{icon:va,size:13,className:"mr-1"}),"Close"]}),s.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>L(!0),className:"h-7 px-2 text-xs flex items-center gap-1",title:"Open in Full View",children:[s.jsx(ve,{icon:C8,size:13}),s.jsx("span",{children:"Full View"})]})]})]}),(N==null?void 0:N.description)&&s.jsx(Fg,{className:"text-xs text-muted-foreground truncate",children:N.description})]}),xo(),vo()]})}),s.jsx(Qs,{open:ge,onOpenChange:me,children:s.jsxs(hs,{className:"sm:max-w-md bg-card border-border rounded-xl",children:[s.jsxs(gs,{children:[s.jsxs(xs,{className:"text-lg font-bold flex items-center gap-2",children:[s.jsx(ve,{icon:va,className:"text-destructive",size:20}),"Close Ticket #",B==null?void 0:B.ticket_id]}),s.jsx(vs,{className:"text-xs text-muted-foreground pt-1",children:"Are you sure you want to close this ticket? A transcript will be created and the channel will be deleted in Discord."})]}),s.jsxs("div",{className:"space-y-2 py-2",children:[s.jsx("label",{className:"text-xs font-semibold text-foreground",children:"Reason for closing (Optional)"}),s.jsx(De,{value:we,onChange:W=>Ce(W.target.value),placeholder:"e.g. Issue resolved by support team",className:"text-sm"})]}),s.jsxs(Js,{className:"gap-2 sm:gap-0 mt-2",children:[s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>me(!1),disabled:!!ze,children:"Cancel"}),s.jsxs(ue,{variant:"destructive",size:"sm",onClick:Da,disabled:!!ze,children:[ze?s.jsx(ve,{icon:ur,size:14,className:"animate-spin mr-1.5"}):s.jsx(ve,{icon:va,size:14,className:"mr-1.5"}),"Confirm Close"]})]})]})}),s.jsx(Qs,{open:ft,onOpenChange:Pt,children:s.jsxs(hs,{className:"sm:max-w-[450px]",children:[s.jsxs(gs,{children:[s.jsxs(xs,{className:"text-base flex items-center gap-2",children:[s.jsx(ve,{icon:is,size:18,className:"text-primary"}),"Open Direct Ticket"]}),s.jsx(vs,{className:"text-xs",children:"Select a support department to create a new ticket channel in Discord immediately."})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{className:"text-xs font-semibold",children:"Department"}),s.jsxs(Ca,{value:gn,onValueChange:Yr,children:[s.jsx(Br,{className:"text-xs border-border bg-secondary/30",children:s.jsx(Sa,{})}),s.jsxs($r,{children:[s.jsx(vt,{value:"general",children:"🎫 General Support"}),s.jsx(vt,{value:"purchase",children:"💳 Purchase & Billing Support"}),s.jsx(vt,{value:"reports",children:"🚨 Player Report"}),s.jsx(vt,{value:"appeals",children:"⚖️ Ban Appeals"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{className:"text-xs font-semibold",children:"Ticket Subject / Reason"}),s.jsx(De,{value:_n,onChange:W=>wn(W.target.value),placeholder:"e.g. Assistance with server permissions",className:"text-xs border-border bg-secondary/30"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{className:"text-xs font-semibold",children:"Discord User ID (Optional)"}),s.jsx(De,{value:Xn,onChange:W=>Zn(W.target.value),placeholder:"e.g. 123456789012345678 (Leave blank for yourself)",className:"text-xs font-mono border-border bg-secondary/30"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"If specified, the ticket channel will be created for this user."})]})]}),s.jsxs(Js,{className:"gap-2 sm:gap-0",children:[s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>Pt(!1),disabled:It,className:"text-xs",children:"Cancel"}),s.jsxs(ue,{size:"sm",onClick:nn,disabled:It||!_n.trim(),className:"gap-1.5 text-xs bg-primary font-semibold",children:[It?s.jsx(ve,{icon:ur,size:14,className:"animate-spin"}):s.jsx(ve,{icon:is,size:14}),It?"Opening Ticket...":"Open Ticket"]})]})]})})]})}const SP=["admin","moderator","editor","viewer","custom"];function NP(){return{mode:"add",id:"",username:"",globalName:"",role:"viewer",enabled:!0,permissions:ls("viewer"),yamlOwner:!1}}function EP({permissions:t,onChange:n,disabled:a}){const o=d=>n({...t,...d}),c=[{key:"overview",title:"Dashboard Overview",description:"Access to system metrics, bot health status, and main dashboard stats."},{key:"tickets",title:"Support Tickets",description:"View open support tickets, live web chat, send staff replies, and close tickets."},{key:"transcripts",title:"Ticket Transcripts",description:"Access saved ticket HTML transcripts and configure public transcript options."},{key:"logs",title:"Console Terminal Logs",description:"View real-time bot terminal output, system logs, and runtime error traces."}],l=[["supportbot","Bot config","Main bot token, prefix, channels, categories, and core settings."],["ticket-panel","Ticket panel","Ticket home embed, button labels, dropdown options, and panel styling."],["commands","Commands","Enable/disable slash commands, descriptions, and custom names."],["messages","Messages","Custom bot response messages, welcome embeds, and embed colors."],["supportbot-ai","AI assistant","Configure AI support rules, model API keys, and auto-response channels."]];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"General & Modules Access"}),s.jsx("div",{className:"grid gap-2.5",children:c.map(({key:d,title:m,description:p})=>s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsx(kt,{checked:t[d]??(d==="tickets"?t.overview:!1),disabled:a,onCheckedChange:g=>o({[d]:g}),className:"shrink-0"})]},d))})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Administration & Settings"}),s.jsxs("div",{className:"grid gap-2.5",children:[s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View system branding, OAuth configurations, and system health details."})]}),s.jsx(kt,{checked:t.settings.view,disabled:a,onCheckedChange:d=>o({settings:{...t.settings,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (Install Updates)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Perform 1-click bot system updates and trigger bot server restarts."})]}),s.jsx(kt,{checked:t.settings.update,disabled:a,onCheckedChange:d=>o({settings:{...t.settings,update:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View dashboard staff accounts and permission group listings."})]}),s.jsx(kt,{checked:t.users.view,disabled:a,onCheckedChange:d=>o({users:{...t.users,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (Manage)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Create, edit, assign, and delete staff accounts and permission groups."})]}),s.jsx(kt,{checked:t.users.manage,disabled:a,onCheckedChange:d=>o({users:{...t.users,manage:d}}),className:"shrink-0"})]})]})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Configuration Files Access"}),s.jsxs("div",{className:"grid gap-2.5",children:[l.map(([d,m,p])=>{var v;const g=((v=t.configs)==null?void 0:v[d])??{view:!1,edit:!1};return s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsxs("div",{className:"flex items-center gap-4 shrink-0",children:[s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"View"}),s.jsx(kt,{checked:g.view,disabled:a,onCheckedChange:b=>o({configs:{...t.configs,[d]:{...g,view:b}}})})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Edit"}),s.jsx(kt,{checked:g.edit,disabled:a,onCheckedChange:b=>o({configs:{...t.configs,[d]:{...g,edit:b,view:b?!0:g.view}}})})]})]})]},d)}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Raw YAML Code Editor"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Access the raw YAML code editor tab to view or edit full raw configuration files."})]}),s.jsx("div",{className:"flex items-center gap-4 shrink-0",children:s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Access"}),s.jsx(kt,{checked:t.rawYaml??!1,disabled:a,onCheckedChange:d=>o({rawYaml:d})})]})})]})]})]})]})}function kP(t){return t.permissions.users.manage?"Full + user management":t.permissions.settings.update?"Configs + settings updates":Object.values(t.permissions.configs).some(n=>n.edit)?"Can edit configs":"View only"}function TP(){const{user:t,hasPermission:n}=qt(),a=n("users.manage"),[o,c]=f.useState([]),[l,d]=f.useState([]),[m,p]=f.useState(!0),[g,v]=f.useState(""),[b,w]=f.useState(null),[y,C]=f.useState(!1),S=f.useCallback(async()=>{p(!0),v("");try{const[R,L]=await Promise.all([Ne.listDashboardUsers(),Ne.listGroups().catch(()=>({data:{groups:[]}}))]);R.data&&c(R.data.users),L.data&&d(L.data.groups)}catch(R){v(R instanceof Error?R.message:"Failed to load users")}finally{p(!1)}},[]);f.useEffect(()=>{S()},[S]);const E=f.useMemo(()=>[...o].sort((R,L)=>R.yamlOwner!==L.yamlOwner?R.yamlOwner?-1:1:(R.username||R.id).localeCompare(L.username||L.id)),[o]);function k(){w(NP())}function N(R){w({mode:"edit",id:R.id,username:R.username||"",globalName:R.globalName||"",role:R.yamlOwner?"owner":R.role,enabled:R.enabled,permissions:R.role==="custom"?R.permissions:ls(R.role),yamlOwner:R.yamlOwner})}function T(R){b&&w({...b,role:R,permissions:ls(R,b.permissions)})}async function M(){if(!(!b||!a)){C(!0),v("");try{b.mode==="add"?await Ne.addDashboardUser({id:b.id.trim(),role:b.role,username:b.username||void 0,globalName:b.globalName||void 0,enabled:b.enabled,permissions:b.role==="custom"?b.permissions:void 0}):await Ne.updateDashboardUser(b.id,{role:b.yamlOwner?void 0:b.role,enabled:b.enabled,username:b.username||void 0,globalName:b.globalName||void 0,permissions:b.role==="custom"?b.permissions:void 0}),w(null),await S()}catch(R){v(R instanceof Error?R.message:"Could not save user")}finally{C(!1)}}}async function _(R){if(a&&window.confirm("Remove this user from the dashboard?")){v("");try{await Ne.removeDashboardUser(R),await S()}catch(L){v(L instanceof Error?L.message:"Could not remove user")}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Users"}),s.jsxs("p",{className:"text-muted-foreground",children:["Control who can sign in and what they can view or edit. Owners in"," ",s.jsx("code",{className:"rounded bg-primary/10 px-1 text-xs text-primary",children:"api.yml"})," ","always have full access."]})]}),a?s.jsxs(ue,{onClick:k,children:[s.jsx(ve,{icon:sg,size:16,className:"mr-2"}),"Add user"]}):null]}),g?s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:g})}):null,s.jsx(Ze,{className:"border-border bg-card overflow-hidden",children:s.jsx(Qe,{className:"p-0",children:m?s.jsxs("div",{className:"p-4 space-y-2",children:[s.jsx(Be,{className:"h-8 w-full rounded-md"}),s.jsx(Be,{className:"h-8 w-full rounded-md"})]}):E.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-muted-foreground",children:"No users found."}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/80 bg-secondary/30 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-2.5",children:"User"}),s.jsx("th",{className:"px-4 py-2.5",children:"Group"}),s.jsx("th",{className:"px-4 py-2.5",children:"Access Summary"}),s.jsx("th",{className:"px-4 py-2.5",children:"Status"}),a&&s.jsx("th",{className:"px-4 py-2.5 text-right",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-border/40",children:E.map(R=>{const L=l.find(I=>I.id===R.groupId||I.id===R.role),te=(L==null?void 0:L.color)||"#10B981",K=(L==null?void 0:L.name)||$y[R.yamlOwner?"owner":R.role]||R.role;return s.jsxs("tr",{className:"transition-colors hover:bg-secondary/25",children:[s.jsx("td",{className:"px-4 py-2.5 font-medium whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsxs(bs,{className:"size-7",children:[s.jsx(eo,{src:R.avatar,alt:R.username}),s.jsx(ys,{className:"text-[10px]",children:(R.username||R.id).slice(0,2).toUpperCase()})]}),s.jsxs("div",{className:"min-w-0 leading-tight",children:[s.jsxs("p",{className:"truncate font-semibold text-foreground text-xs",children:[P2(R),R.id===(t==null?void 0:t.id)?s.jsx("span",{className:"text-[11px] text-primary font-normal ml-1",children:"(you)"}):""]}),s.jsx("p",{className:"truncate text-[10px] text-muted-foreground font-mono",children:R.id})]})]})}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full shrink-0 shadow-sm",style:{backgroundColor:te}}),s.jsx("span",{className:"font-medium text-xs text-foreground",children:K}),R.yamlOwner&&s.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20",children:"Config Owner"})]})}),s.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground max-w-xs truncate",children:kP(R)}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:R.enabled?s.jsx(Fn,{className:"text-[10px] px-2 py-0.5 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/15 border-emerald-500/20",children:"Active"}):s.jsx(Fn,{variant:"outline",className:"text-[10px] px-2 py-0.5",children:"Disabled"})}),a&&s.jsx("td",{className:"px-4 py-2.5 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsxs(ue,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-foreground",onClick:()=>N(R),children:[s.jsx(ve,{icon:v8,size:13}),"Edit"]}),!R.yamlOwner&&s.jsxs(ue,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-destructive",onClick:()=>_(R.id),children:[s.jsx(ve,{icon:wi,size:13}),"Remove"]})]})})]},R.id)})})]})})})}),s.jsx(Qs,{open:!!b,onOpenChange:R=>!R&&w(null),children:s.jsxs(hs,{className:"max-h-[90vh] max-w-lg overflow-y-auto",children:[s.jsxs(gs,{children:[s.jsx(xs,{children:(b==null?void 0:b.mode)==="add"?"Add dashboard user":"Edit user"}),s.jsx(vs,{children:b!=null&&b.yamlOwner?"This user is an owner in api.yml. Role and removal are managed in the config file.":P8[(b==null?void 0:b.role)??"viewer"]})]}),b?s.jsxs("div",{className:"space-y-4",children:[b.mode==="add"?s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"discord-id",children:"Discord user ID"}),s.jsx(De,{id:"discord-id",value:b.id,onChange:R=>w({...b,id:R.target.value}),placeholder:"829112572816130058"})]}):null,s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Display name (optional)"}),s.jsx(De,{value:b.globalName,onChange:R=>w({...b,globalName:R.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Username (optional)"}),s.jsx(De,{value:b.username,onChange:R=>w({...b,username:R.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{children:"Permission Group"}),s.jsxs(Ca,{value:b.role,disabled:b.yamlOwner,onValueChange:R=>{const L=l.find(te=>te.id===R);L?w({...b,role:R,permissions:L.permissions}):T(R)},children:[s.jsx(Br,{children:s.jsx(Sa,{})}),s.jsx($r,{children:b.yamlOwner?s.jsx(vt,{value:"owner",children:"Owner"}):l.length>0?l.map(R=>s.jsx(vt,{value:R.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-2.5 rounded-full shrink-0",style:{backgroundColor:R.color||"#10B981"}}),s.jsx("span",{children:R.name})]})},R.id)):SP.map(R=>s.jsx(vt,{value:R,children:$y[R]},R))})]})]}),s.jsxs("label",{className:"flex items-center justify-between rounded-lg border border-border px-3 py-2",children:[s.jsx("span",{className:"text-sm",children:"Account enabled"}),s.jsx(kt,{checked:b.enabled,disabled:b.yamlOwner,onCheckedChange:R=>w({...b,enabled:R})})]}),b.role==="custom"&&!b.yamlOwner?s.jsx(EP,{permissions:b.permissions,onChange:R=>w({...b,permissions:R})}):null]}):null,s.jsxs(Js,{children:[s.jsx(ue,{variant:"outline",onClick:()=>w(null),children:"Cancel"}),s.jsx(ue,{disabled:y||!a||(b==null?void 0:b.mode)==="add"&&!/^\d{17,20}$/.test(b.id.trim()),onClick:()=>void M(),children:y?"Saving…":"Save"})]})]})})]})}const MP=[{name:"Emerald",hex:"#10B981"},{name:"Blue",hex:"#3B82F6"},{name:"Purple",hex:"#8B5CF6"},{name:"Amber",hex:"#F59E0B"},{name:"Red",hex:"#EF4444"},{name:"Cyan",hex:"#06B6D4"},{name:"Gray",hex:"#6B7280"}];function RP({permissions:t,onChange:n,disabled:a}){const o=d=>n({...t,...d}),c=[{key:"overview",title:"Dashboard Overview",description:"Access to system metrics, bot health status, and main dashboard stats."},{key:"tickets",title:"Support Tickets",description:"View open support tickets, live web chat, send staff replies, and close tickets."},{key:"transcripts",title:"Ticket Transcripts",description:"Access saved ticket HTML transcripts and configure public transcript options."},{key:"logs",title:"Console Terminal Logs",description:"View real-time bot terminal output, system logs, and runtime error traces."}],l=[["supportbot","Bot config","Main bot token, prefix, channels, categories, and core settings."],["ticket-panel","Ticket panel","Ticket home embed, button labels, dropdown options, and panel styling."],["commands","Commands","Enable/disable slash commands, descriptions, and custom names."],["messages","Messages","Custom bot response messages, welcome embeds, and embed colors."],["supportbot-ai","AI assistant","Configure AI support rules, model API keys, and auto-response channels."]];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"General & Modules Access"}),s.jsx("div",{className:"grid gap-2.5",children:c.map(({key:d,title:m,description:p})=>s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsx(kt,{checked:t[d]??(d==="tickets"?t.overview:!1),disabled:a,onCheckedChange:g=>o({[d]:g}),className:"shrink-0"})]},d))})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Administration & Settings"}),s.jsxs("div",{className:"grid gap-2.5",children:[s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View system branding, OAuth configurations, and system health details."})]}),s.jsx(kt,{checked:t.settings.view,disabled:a,onCheckedChange:d=>o({settings:{...t.settings,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings (Install Updates)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Perform 1-click bot system updates and trigger bot server restarts."})]}),s.jsx(kt,{checked:t.settings.update,disabled:a,onCheckedChange:d=>o({settings:{...t.settings,update:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (View)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"View dashboard staff accounts and permission group listings."})]}),s.jsx(kt,{checked:t.users.view,disabled:a,onCheckedChange:d=>o({users:{...t.users,view:d}}),className:"shrink-0"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Users & Groups (Manage)"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Create, edit, assign, and delete staff accounts and permission groups."})]}),s.jsx(kt,{checked:t.users.manage,disabled:a,onCheckedChange:d=>o({users:{...t.users,manage:d}}),className:"shrink-0"})]})]})]}),s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Configuration Files Access"}),s.jsxs("div",{className:"grid gap-2.5",children:[l.map(([d,m,p])=>{var v;const g=((v=t.configs)==null?void 0:v[d])??{view:!1,edit:!1};return s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:p})]}),s.jsxs("div",{className:"flex items-center gap-4 shrink-0",children:[s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"View"}),s.jsx(kt,{checked:g.view,disabled:a,onCheckedChange:b=>o({configs:{...t.configs,[d]:{...g,view:b}}})})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Edit"}),s.jsx(kt,{checked:g.edit,disabled:a,onCheckedChange:b=>o({configs:{...t.configs,[d]:{...g,edit:b,view:b?!0:g.view}}})})]})]})]},d)}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border bg-secondary/20 p-3 transition-colors hover:bg-secondary/40",children:[s.jsxs("div",{className:"space-y-0.5 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Raw YAML Code Editor"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:"Access the raw YAML code editor tab to view or edit full raw configuration files."})]}),s.jsx("div",{className:"flex items-center gap-4 shrink-0",children:s.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground cursor-pointer",children:[s.jsx("span",{children:"Access"}),s.jsx(kt,{checked:t.rawYaml??!1,disabled:a,onCheckedChange:d=>o({rawYaml:d})})]})})]})]})]})]})}function AP(){const{permissions:t,impersonateGroup:n,impersonatedGroup:a,stopImpersonation:o}=qt(),c=Mn(t,"users.manage"),[l,d]=f.useState([]),[m,p]=f.useState(!0),[g,v]=f.useState(null),[b,w]=f.useState(null),[y,C]=f.useState(!1),[S,E]=f.useState("add"),[k,N]=f.useState(!1),[T,M]=f.useState(""),[_,R]=f.useState(""),[L,te]=f.useState(""),[K,I]=f.useState("#10B981"),[G,Y]=f.useState(""),[ce,fe]=f.useState(ls("viewer")),se=async()=>{var V;p(!0),v(null);try{const O=await Ne.listGroups();d(((V=O.data)==null?void 0:V.groups)||[])}catch(O){v(O instanceof Error?O.message:"Failed to load groups")}finally{p(!1)}};f.useEffect(()=>{se()},[]);const P=()=>{E("add"),M(""),R(""),te(""),I("#10B981"),Y(""),fe(ls("viewer")),C(!0)},Z=V=>{E("edit"),M(V.id),R(V.name),te(V.description||""),I(V.color||"#10B981"),Y(V.discordRoleId||""),fe(V.permissions||ls("viewer")),C(!0)},ae=async()=>{if(!_.trim()){v("Group name is required");return}N(!0),v(null);try{S==="add"?(await Ne.createGroup({name:_.trim(),description:L.trim(),color:K,discordRoleId:G.trim()||null,permissions:ce}),w(`Group "${_}" created successfully.`)):(await Ne.updateGroup(T,{name:_.trim(),description:L.trim(),color:K,discordRoleId:G.trim()||null,permissions:ce}),w(`Group "${_}" updated successfully.`)),C(!1),await se()}catch(V){v(V instanceof Error?V.message:"Failed to save group")}finally{N(!1)}},re=async V=>{if(!V.isSystem&&confirm(`Are you sure you want to delete the group "${V.name}"?`))try{await Ne.deleteGroup(V.id),w(`Group "${V.name}" deleted.`),await se()}catch(O){v(O instanceof Error?O.message:"Failed to delete group")}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Permission Groups"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Create custom permission groups, assign staff members, and optionally sync with Discord Role IDs."})]}),c&&s.jsxs(ue,{onClick:P,className:"shrink-0 gap-2 bg-primary",children:[s.jsx(ve,{icon:sg,size:18}),"Create Group"]})]}),g&&s.jsx(Ye,{variant:"destructive",children:s.jsx(qe,{children:g})}),b&&s.jsx(Ye,{className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",children:s.jsxs(qe,{className:"flex items-center justify-between",children:[s.jsx("span",{children:b}),s.jsx(ue,{size:"sm",variant:"ghost",className:"h-6 px-2 text-xs",onClick:()=>w(null),children:"Dismiss"})]})}),s.jsx(Ze,{className:"border-border bg-card overflow-hidden",children:s.jsx(Qe,{className:"p-0",children:m?s.jsxs("div",{className:"p-4 space-y-2",children:[s.jsx(Be,{className:"h-8 w-full rounded-md"}),s.jsx(Be,{className:"h-8 w-full rounded-md"})]}):l.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-muted-foreground",children:'No permission groups found. Click "Create Group" to add one.'}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/80 bg-secondary/30 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:[s.jsx("th",{className:"px-4 py-2.5",children:"Group"}),s.jsx("th",{className:"px-4 py-2.5",children:"Description"}),s.jsx("th",{className:"px-4 py-2.5",children:"Discord Role ID"}),s.jsx("th",{className:"px-4 py-2.5",children:"Enabled Permissions"}),s.jsx("th",{className:"px-4 py-2.5 text-right",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-border/40",children:l.map(V=>{var O,D,$,H,X,xe,q;return s.jsxs("tr",{className:"transition-colors hover:bg-secondary/25",children:[s.jsx("td",{className:"px-4 py-2.5 font-medium whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-2.5 rounded-full shrink-0 shadow-sm",style:{backgroundColor:V.color||"#10B981"}}),s.jsx("span",{className:"text-foreground font-semibold text-xs",children:V.name}),V.isSystem&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold px-1.5 py-0.5 rounded-full bg-secondary text-secondary-foreground border border-border/80",children:[s.jsx(ve,{icon:qu,size:10}),"System"]})]})}),s.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground max-w-xs truncate",children:V.description||"—"}),s.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:V.discordRoleId?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground font-mono bg-secondary/50 px-2 py-0.5 rounded border border-border/50",children:[s.jsx(ve,{icon:qu,size:12,className:"text-primary"}),V.discordRoleId]}):s.jsx("span",{className:"text-xs text-muted-foreground/60",children:"—"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsxs("div",{className:"flex flex-wrap gap-1 max-w-md",children:[((O=V.permissions)==null?void 0:O.overview)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20",children:"Overview"}),(((D=V.permissions)==null?void 0:D.tickets)??(($=V.permissions)==null?void 0:$.overview))&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"Tickets"}),((H=V.permissions)==null?void 0:H.transcripts)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20",children:"Transcripts"}),((X=V.permissions)==null?void 0:X.logs)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400 border border-blue-500/20",children:"Logs"}),((q=(xe=V.permissions)==null?void 0:xe.users)==null?void 0:q.manage)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20",children:"User Mgmt"})]})}),s.jsx("td",{className:"px-4 py-2.5 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsxs(ue,{size:"sm",variant:"ghost",className:`h-7 px-2 text-xs gap-1 ${(a==null?void 0:a.id)===V.id?"text-amber-400 font-bold bg-amber-500/15 border border-amber-500/30":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,onClick:()=>(a==null?void 0:a.id)===V.id?o():n(V.id),children:[s.jsx(ve,{icon:qu,size:13}),(a==null?void 0:a.id)===V.id?"Active Preview":"View as Group"]}),c&&V.id!=="owner"&&s.jsxs(ue,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-foreground",onClick:()=>Z(V),children:[s.jsx(ve,{icon:D2,size:13}),"Edit"]}),c&&!V.isSystem&&s.jsxs(ue,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1 text-muted-foreground hover:text-destructive",onClick:()=>re(V),children:[s.jsx(ve,{icon:wi,size:13}),"Delete"]})]})})]},V.id)})})]})})})}),s.jsx(Qs,{open:y,onOpenChange:C,children:s.jsxs(hs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(gs,{children:[s.jsx(xs,{children:S==="add"?"Create Permission Group":`Edit Group: ${_}`}),s.jsx(vs,{children:"Configure group metadata, custom color badge, Discord role sync, and permission rules."})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"group-name",children:"Group Name"}),s.jsx(De,{id:"group-name",placeholder:"e.g. Support Staff",value:_,onChange:V=>R(V.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"group-color",children:"Color Badge"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tf,{value:K,onChange:I}),s.jsx(De,{value:K,onChange:V=>I(V.target.value),placeholder:"#10B981",className:"w-28 font-mono text-sm uppercase"}),s.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:MP.map(V=>s.jsx("button",{type:"button",className:"size-6 rounded-full border border-white/20 transition-transform hover:scale-110",style:{backgroundColor:V.hex},onClick:()=>I(V.hex),title:V.name},V.hex))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(_e,{htmlFor:"group-desc",children:"Description"}),s.jsx(De,{id:"group-desc",placeholder:"Brief description of what members in this group can access...",value:L,onChange:V=>te(V.target.value)})]}),s.jsx(TS,{id:"discord-role-id",label:"Discord Role ID (Optional Auto-Sync)",description:"If provided, Discord users with this Role ID will automatically inherit this group upon login.",kind:"role",value:G,onChange:V=>Y(String(V??""))}),s.jsxs("div",{className:"pt-2",children:[s.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Group Permission Matrix"}),s.jsx(RP,{permissions:ce,onChange:fe})]})]}),s.jsxs(Js,{className:"gap-2 sm:gap-0",children:[s.jsx(ue,{variant:"outline",onClick:()=>C(!1),disabled:k,children:"Cancel"}),s.jsx(ue,{onClick:ae,disabled:k,className:"bg-primary",children:k?"Saving...":S==="add"?"Create Group":"Save Changes"})]})]})})]})}function _P({children:t}){const{isAuthenticated:n,loading:a}=qt();return a?s.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading…"}):n?s.jsx(s.Fragment,{children:t}):s.jsx(ya,{to:"/login",replace:!0})}function DP(){const{complete:t,loading:n}=fS(),a=Kn();return n?s.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading…"}):t?a.pathname==="/setup"?s.jsx(ya,{to:"/login",replace:!0}):s.jsxs(Py,{children:[s.jsx(cn,{path:"/login",element:s.jsx(bz,{})}),s.jsxs(cn,{element:s.jsx(_P,{children:s.jsx(TA,{})}),children:[s.jsx(cn,{index:!0,element:s.jsx(Vz,{})}),s.jsx(cn,{path:"system",element:s.jsx(ga,{permission:"overview",children:s.jsx(sP,{})})}),s.jsx(cn,{path:"settings",element:s.jsx(ga,{permission:"settings.view",children:s.jsx(nP,{})})}),s.jsx(cn,{path:"configs",element:s.jsx(gz,{})}),s.jsx(cn,{path:"logs",element:s.jsx(ga,{permission:"logs",children:s.jsx(mP,{})})}),s.jsx(cn,{path:"tickets",element:s.jsx(ga,{permission:"transcripts",children:s.jsx(CP,{})})}),s.jsx(cn,{path:"transcripts",element:s.jsx(ga,{permission:"transcripts",children:s.jsx(jP,{})})}),s.jsx(cn,{path:"users",element:s.jsx(ga,{permission:"users.view",children:s.jsx(TP,{})})}),s.jsx(cn,{path:"groups",element:s.jsx(ga,{permission:"users.view",children:s.jsx(AP,{})})}),s.jsx(cn,{path:"addons",element:s.jsx(ga,{permission:"settings.view",children:s.jsx(Fz,{})})}),s.jsx(cn,{path:"addons/builder",element:s.jsx(ga,{permission:"settings.update",children:s.jsx(Yz,{})})})]}),s.jsx(cn,{path:"*",element:s.jsx(ya,{to:"/",replace:!0})})]}):s.jsxs(Py,{children:[s.jsx(cn,{path:"/setup",element:s.jsx(Lz,{})}),s.jsx(cn,{path:"*",element:s.jsx(ya,{to:"/setup",replace:!0})})]})}function OP({...t}){return s.jsx(KO,{theme:"dark",position:"bottom-right",richColors:!0,closeButton:!0,style:{fontFamily:'"Poppins", system-ui, sans-serif'},toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground"}},...t})}Zz();_3.createRoot(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(a8,{children:s.jsx(aC,{children:s.jsx(B8,{children:s.jsx(MA,{children:s.jsxs(U8,{children:[s.jsx(DP,{}),s.jsx(OP,{})]})})})})})})); diff --git a/public/dashboard/index.html b/public/dashboard/index.html index 1bedc17..823007d 100644 --- a/public/dashboard/index.html +++ b/public/dashboard/index.html @@ -10,8 +10,8 @@ href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet" /> - - + +