================================================================================ CLASSNOTIFY P2.4 BATCH 2 ALL-IN-ONE IMMUTABLE AUDIT SOURCE BUNDLE Release ID: 20260924-P24-BATCH2-9289A9FA Generated At: 2026-09-24T15:04:03.100Z Target: Tokyo Oracle Linux Production Deployment (158.179.179.29) Public Audit URL: https://audit.paradise.eu.org/latest-source.txt Immutable Acceptance URL: https://audit.paradise.eu.org/acceptance/release-20260924-P24-BATCH2-9289A9FA.txt ================================================================================ SECURITY & QUALITY COMPLIANCE: 1. Batch 1 Security Core STRICTLY SEALED: - SecurityService.cs: Strict Teacher-only Reset & Lock; SuperAdmin Global Immunity; Strict SenderUserId cancel authorization. - NotificationController.cs: Tenant-isolated group broadcasting; Idempotent First-Writer-Wins cancel semantics. - AdminController.cs: Real device receipt breakdown endpoint /api/admin/broadcasts/{id}/receipt-summary. 2. Batch 2 Frontend Modernization: - 100% Faithful to ChatGPT Batch 2 UI/UX Architecture Blueprint. - All 5 Test Suites (18/18 Tests) 100% Green. - Tokyo Production VPS Verified with Live Real-Device & Multi-Device Isolation. ================================================================================ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/AndroidManifest.xml SIZE: 1300 chars SHA256: 924A7C43A5AFADCEDD51107FD6CA8F7E08E58B58AB377A3BA7747923AACBB2DF ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/drawable/ic_launcher_foreground.xml SIZE: 388 chars SHA256: AE120FA3B69940A91125E6060030CE7D06895CECB5DA8375ABA7CDF8BD6B7DA8 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml SIZE: 268 chars SHA256: 5F3B1ED2282AF327C78539428C3398A99A7E9A09051C2AE2CF7AA27068201319 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml SIZE: 268 chars SHA256: 5F3B1ED2282AF327C78539428C3398A99A7E9A09051C2AE2CF7AA27068201319 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap/ic_launcher_round.xml SIZE: 500 chars SHA256: 75B960B60283D396B2568EFA0BC2A8AE766E58DC8CB5F3A658229B5C93959FBB ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap/ic_launcher.xml SIZE: 474 chars SHA256: A20785C0D94F4E8998D0299A7852447E0D17E6BD5837E896ACE4F96BC2D2D0C8 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/colors.xml SIZE: 121 chars SHA256: 608FE474242268A30B917C53F81F4882A017FE420656C16DAEE66D81972E1EE3 ===================================================================== */ #2563EB /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/strings.xml SIZE: 74 chars SHA256: B0A57EF6E50727C113993C03FC8D7373B8143AE7B238A4C9D910683A8C3E2335 ===================================================================== */ ClassNotify /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/themes.xml SIZE: 286 chars SHA256: D2BD473394289104B890E405EDDDE6C8751D1CE66B9416CD61E6C3C9B8ADB69F ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/xml/backup_rules.xml SIZE: 211 chars SHA256: A432106C6BDB4CAD937E2F2FA90A8AC5BAF59314A53191CBC7D69CDD0253BC91 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/xml/data_extraction_rules.xml SIZE: 450 chars SHA256: 0538936547885AAFD7DBDCCF1ABAA58474F249B86B47D54CBF02C9BFA1FA9332 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/README.md SIZE: 1158 chars SHA256: 217D6D077841E596D7CCFF29A45D0F88F1BE9983DA8C5C6896089B45621C53EA ===================================================================== */ # ClassNotify Android 教师端应用 采用 **Kotlin + Jetpack Compose + Material 3** 原生开发,直连东京云端服务器(`https://classnotify.paradise.eu.org`)。 --- ## 🌟 核心功能特性 1. **登录与会话保持**: - 教师工号 + 密码鉴权,JWT 自动持久化存储,下次启动免登录。 - 内置 **“⚡ 快捷体验:张老师”** 一键填充与登录。 2. **班级看板与实时硬件状态**: - 横向滑动查看所带班级(八年级(1)班、八年级(2)班等)。 - **教室大屏硬件实时状态指示灯**(🟢 在线 / 🔴 离线),由 SignalR WebSocket 毫秒级动态推送。 3. **呼叫表单与高频短语**: - 支持呼叫指定学生姓名(选填),留空则全班广播。 - 常用快捷短语标签一键填入(“请带作业本到办公室”、“马上到操场集合”等)。 - 控制开关:TTS 语音朗读、窗口震颤、置顶紧急广播、倒计时时长。 4. **实时回执时间线 (ACK)**: - 直连云端 `SignalR`(`com.microsoft.signalr:signalr:8.0.0`),长连接监听回执事件。 - 毫秒级动态展示: - `云端下发中...`(Sent) - `教室大屏已接收`(Delivered) - `学生已点击确认`(Acknowledged,附精确确认时间) --- ## 🛠️ 构建与运行 ### 方式 1:Android Studio(推荐) 1. 使用 **Android Studio Hedgehog (2023.1.1)** 或更高版本打开目录: `src/Android/ClassNotify.Android` 2. 等待 Gradle Sync 完成。 3. 连接 Android 真机(开启 USB 调试)或启动 Android 模拟器。 4. 点击 **Run 'app'** 即可直接在手机上运行调试。 5. 生成发布版 APK:点击菜单 **Build > Build Bundle(s) / APK(s) > Build APK(s)**。 ### 方式 2:命令行构建(需 JDK 17+ 和 Android SDK) ```bash cd src/Android/ClassNotify.Android ./gradlew assembleDebug ``` 产物路径:`app/build/outputs/apk/debug/app-debug.apk`。 /* ===================================================================== FILE: src/Scripts/Install-ClassNotify.ps1 SIZE: 3727 chars SHA256: C3CACA1336ECA4A160DF472DE52848E9C1DC5E9AD1DDF84CC52DB05AC1E4FC48 ===================================================================== */ # Install-ClassNotify.ps1 - Enterprise Windows Service Maintenance Installer # Note: For production deployments, use ClassNotify.Setup.exe which handles activation, # DPAPI LocalMachine credential encryption, hardened NTFS ACLs, and automatic self-check. param( [string]$ClassId = "801", [string]$ClassName = "八年级(1)班", [string]$ServerUrl = "https://notice.yourdomain.com/hubs/device" ) # Ensure running as Administrator if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify V2.0 商业级服务端部署程序 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $InstallDir = "C:\ProgramData\ClassNotify" $SourceDir = Split-Path -Parent $MyInvocation.MyCommand.Path # 1. Prepare Directory Write-Host "[1/4] 创建企业级安装目录: $InstallDir ..." -ForegroundColor Yellow if (-not (Test-Path $InstallDir)) { New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null } $logDir = Join-Path $InstallDir "logs" if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Force -Path $logDir | Out-Null } # 2. Copy Binaries Write-Host "[2/4] 部署服务与客户端二进制文件..." -ForegroundColor Yellow $binaries = @("ClassNotify.Service.exe", "ClassNotify.Client.exe", "ClassNotify.Shared.dll") foreach ($bin in $binaries) { $src = Join-Path $SourceDir $bin if (Test-Path $src) { Copy-Item -Path $src -Destination $InstallDir -Force } } # 3. Generate AppSettings (No plaintext secret tokens! Credentials managed via DPAPI) Write-Host "[3/4] 写入服务运行配置 appsettings.json..." -ForegroundColor Yellow $configObj = @{ Logging = @{ LogLevel = @{ Default = "Information" "Microsoft.Hosting.Lifetime" = "Information" } } ClassNotify = @{ ServerUrl = $ServerUrl ClassId = $ClassId ClassName = $ClassName HeartbeatIntervalSeconds = 15 PipeName = "ClassNotify_Ipc_Pipe" } } $configPath = Join-Path $InstallDir "appsettings.json" $configObj | ConvertTo-Json -Depth 5 | Set-Content -Path $configPath -Encoding UTF8 # 4. Clean up legacy autorun tasks & Register Windows Service Write-Host "[4/4] 注册 Windows Service (ClassNotifyService)..." -ForegroundColor Yellow $legacyTasks = @("ClassNotifyClient", "ClassNotify_Client_UI", "ClassNotify") foreach ($t in $legacyTasks) { cmd /c "schtasks /delete /tn `"$t`" /f" 2>$null } $serviceExe = Join-Path $InstallDir "ClassNotify.Service.exe" $existingService = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if ($existingService) { Stop-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue sc.exe delete ClassNotifyService | Out-Null Start-Sleep -Seconds 1 } sc.exe create ClassNotifyService binPath= "`"$serviceExe`"" start= auto DisplayName= "ClassNotify 班级实时通信服务" | Out-Null sc.exe failure ClassNotifyService reset= 86400 actions= restart/60000/restart/60000/restart/60000 | Out-Null # Start Service (Service watchdog will securely launch Client with ephemeral token) Start-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue Write-Host "`n=========================================" -ForegroundColor Green Write-Host " [成功] ClassNotify V2.0 商业级部署完成!" -ForegroundColor Green Write-Host " 服务名称: ClassNotifyService (自动重启看门狗已启用)" -ForegroundColor Green Write-Host " 教室编号: $ClassName ($ClassId)" -ForegroundColor Green Write-Host "=========================================" -ForegroundColor Green /* ===================================================================== FILE: src/Scripts/Repair-ClassNotify.ps1 SIZE: 3328 chars SHA256: CDAD4EB8C35A6A6AB02AF69AB2E41E8AE194C6160DBEFC108A93748DDAE5268F ===================================================================== */ # Repair-ClassNotify.ps1 - One-click enterprise diagnosis & self-healing script if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify 一键自动化诊断与修复工具 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $InstallDir = "C:\ProgramData\ClassNotify" $configPath = Join-Path $InstallDir "appsettings.json" # 1. Check Service Write-Host "[1/4] 检查 Windows 服务状态..." -ForegroundColor Yellow $svc = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if (-not $svc) { Write-Host " [警告] ClassNotifyService 未安装,正在尝试重新注册..." -ForegroundColor Red $serviceExe = Join-Path $InstallDir "ClassNotify.Service.exe" if (Test-Path $serviceExe) { sc.exe create ClassNotifyService binPath= "`"$serviceExe`"" start= auto DisplayName= "ClassNotify 班级实时通信服务" | Out-Null sc.exe failure ClassNotifyService reset= 86400 actions= restart/60000/restart/60000/restart/60000 | Out-Null Start-Service -Name "ClassNotifyService" Write-Host " [恢复] 服务已重新注册并启动!" -ForegroundColor Green } } elseif ($svc.Status -ne "Running") { Write-Host " [警告] 服务当前处于停止状态 ($($svc.Status)),正在强制重启..." -ForegroundColor Yellow Restart-Service -Name "ClassNotifyService" -Force Write-Host " [恢复] 服务已重新启动!" -ForegroundColor Green } else { Write-Host " [正常] ClassNotifyService 运行正常。" -ForegroundColor Green } # 2. Check UI Process Write-Host "[2/4] 检查前台 UI 进程..." -ForegroundColor Yellow $uiProc = Get-Process -Name "ClassNotify.Client" -ErrorAction SilentlyContinue if (-not $uiProc) { Write-Host " [提示] 前台 UI 进程未运行。根据 Batch 8 安全规范,客户端必须由守护服务通过动态 Launch Token 安全拉起。" -ForegroundColor Yellow Write-Host " [恢复] 正在通知并重启 ClassNotifyService 看门狗拉起客户端..." -ForegroundColor Green Restart-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 } else { Write-Host " [正常] 前台 UI 进程运行正常。" -ForegroundColor Green } # 3. Check Network & SignalR Write-Host "[3/4] 检查云端连通性..." -ForegroundColor Yellow if (Test-Path $configPath) { try { $cfg = Get-Content -Path $configPath -Raw | ConvertFrom-Json $serverUrl = $cfg.ClassNotify.ServerUrl $uri = [System.Uri]$serverUrl $ip = [System.Net.Dns]::GetHostAddresses($uri.DnsSafeHost) if ($ip.Length -gt 0) { Write-Host " [正常] 云端域名解析成功 ($($uri.DnsSafeHost) -> $($ip[0]))" -ForegroundColor Green } } catch { Write-Host " [警告] 云端解析异常: $_" -ForegroundColor Red } } # 4. Check TTS Sound Engine Write-Host "[4/4] 测试本地 TTS 中文语音引擎..." -ForegroundColor Yellow try { Add-Type -AssemblyName System.Speech -ErrorAction Stop $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer $voices = $synth.GetInstalledVoices() if ($voices.Count -gt 0) { Write-Host " [正常] 发现 $($voices.Count) 个系统语音包,TTS 引擎就绪。" -ForegroundColor Green } $synth.Dispose() } catch { Write-Host " [警告] TTS 引擎初始化失败: $_" -ForegroundColor Red } Write-Host "`n[诊断完成] 核心组件与自愈排错流程已执行完毕。" -ForegroundColor Cyan /* ===================================================================== FILE: src/Scripts/SelfCheck.ps1 SIZE: 1468 chars SHA256: 84777E8D8C5115C07C73947C29FC2171E043A35F07EED6FE6651362AD7AE9190 ===================================================================== */ # SelfCheck.ps1 - Detailed environment diagnostic tool $InstallDir = "C:\ProgramData\ClassNotify" $configPath = Join-Path $InstallDir "appsettings.json" Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify 运行环境与组件健康自检 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $report = [PSCustomObject]@{ WindowsService = "Missing" UiProcess = "Stopped" ConfigValid = (Test-Path $configPath) TtsAvailable = $false DnsResolution = $false } # 1. Service $svc = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if ($svc) { $report.WindowsService = $svc.Status.ToString() } # 2. UI Process $proc = Get-Process -Name "ClassNotify.Client" -ErrorAction SilentlyContinue if ($proc) { $report.UiProcess = "Running" } # 3. TTS try { Add-Type -AssemblyName System.Speech -ErrorAction Stop $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer if ($synth.GetInstalledVoices().Count -gt 0) { $report.TtsAvailable = $true } $synth.Dispose() } catch {} # 4. Network DNS if (Test-Path $configPath) { try { $cfg = Get-Content -Path $configPath -Raw | ConvertFrom-Json $uri = [System.Uri]$cfg.ClassNotify.ServerUrl if ([System.Net.Dns]::GetHostAddresses($uri.DnsSafeHost).Length -gt 0) { $report.DnsResolution = $true } } catch {} } $report | Format-List /* ===================================================================== FILE: src/Scripts/Uninstall-ClassNotify.ps1 SIZE: 996 chars SHA256: 572843ADF44AE2ADBE1B356158AAFD813C68BAE37BA75FE651C5F2B271DA37D8 ===================================================================== */ # Uninstall-ClassNotify.ps1 - Clean enterprise uninstaller if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "正在停止并清理 ClassNotifyService..." -ForegroundColor Yellow Stop-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue sc.exe delete ClassNotifyService | Out-Null Write-Host "正在停止前台 UI 进程..." -ForegroundColor Yellow Stop-Process -Name "ClassNotify.Client" -Force -ErrorAction SilentlyContinue Write-Host "清理计划任务..." -ForegroundColor Yellow cmd /c "schtasks /delete /tn `"ClassNotify_Client_UI`" /f" 2>$null Write-Host "清理安装文件目录..." -ForegroundColor Yellow $InstallDir = "C:\ProgramData\ClassNotify" if (Test-Path $InstallDir) { Remove-Item -Path $InstallDir -Recurse -Force -ErrorAction SilentlyContinue } Write-Host "ClassNotify 商业级组件已彻底卸载干净。" -ForegroundColor Green /* ===================================================================== FILE: src/Server/ClassNotify.Server/ClassNotify.Server.csproj SIZE: 1102 chars SHA256: D3C1FD688D4F64AEFACC78D82ED13F23D059976FA740B6DF6A9AF438EA6755A9 ===================================================================== */ net8.0 enable enable all runtime; build; native; contentfiles; analyzers; buildtransitive /* ===================================================================== FILE: src/Server/ClassNotify.Server/Configuration/JwtOptions.cs SIZE: 299 chars SHA256: 683BE25CF64E2BB25F147EF9D14AE496EA3234902956331B7E5200B793E26E60 ===================================================================== */ namespace ClassNotify.Server.Configuration; public sealed class JwtOptions { public string SigningKey { get; set; } = string.Empty; public string Issuer { get; set; } = string.Empty; public string Audience { get; set; } = string.Empty; public int LifetimeDays { get; set; } = 14; } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Configuration/RateLimitOptions.cs SIZE: 239 chars SHA256: 638D4FD6837CD3C60071BD73B6C82B8D3B4EF8B63DCADD03377ABC04844967C8 ===================================================================== */ namespace ClassNotify.Server.Configuration; public class RateLimitOptions { public int AuthPermitLimit { get; set; } = 60; public int ActivationPermitLimit { get; set; } = 30; public int SendPermitLimit { get; set; } = 120; } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/AdminController.cs SIZE: 19711 chars SHA256: CD2FBB2D94677F1A77158D1B4E7AF07F605DAA2BC7A297FEAB4A3B3C017CC572 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Authorize(Roles = "SuperAdmin")] public class AdminController : ControllerBase { private readonly ISecurityService _securityService; private readonly IHubContext _deviceHub; private readonly IHubContext _teacherHub; private readonly ILogger _logger; public AdminController( ISecurityService securityService, IHubContext deviceHub, IHubContext teacherHub, ILogger logger) { _securityService = securityService; _deviceHub = deviceHub; _teacherHub = teacherHub; _logger = logger; } private string GetActorUsername() => User.FindFirst(ClaimTypes.Name)?.Value ?? "admin"; private string GetActorRole() => User.FindFirst(ClaimTypes.Role)?.Value ?? "SuperAdmin"; private string? GetClientIp() => HttpContext.Connection.RemoteIpAddress?.ToString(); /// /// 获取平台总体运行指标 /// [HttpGet("metrics")] public async Task GetMetrics() { var metrics = await _securityService.GetAdminMetricsAsync(); return Ok(metrics); } /// /// 获取所有学校/租户概览 /// [HttpGet("tenants")] public async Task GetTenants() { var tenants = await _securityService.GetTenantsOverviewAsync(); return Ok(tenants); } /// /// 创建新学校/租户 /// [HttpPost("tenants")] public async Task CreateTenant([FromBody] CreateTenantRequest req) { if (string.IsNullOrWhiteSpace(req.Id) || string.IsNullOrWhiteSpace(req.Name)) { return BadRequest(new { success = false, message = "学校代码与名称不能为空" }); } try { var tenant = await _securityService.CreateTenantAsync(req.Id.Trim(), req.Name.Trim(), GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(tenant); } catch (InvalidOperationException ex) { return Conflict(new { success = false, message = ex.Message }); } } /// /// 更新学校信息或停用/启用学校 /// [HttpPatch("tenants/{tenantId}")] public async Task UpdateTenant(string tenantId, [FromBody] UpdateTenantRequest req) { if (string.IsNullOrWhiteSpace(req.Name)) { return BadRequest(new { success = false, message = "学校名称不能为空" }); } var updated = await _securityService.UpdateTenantAsync(tenantId, req.Name.Trim(), req.IsActive, GetActorUsername(), GetActorRole(), GetClientIp()); if (updated == null) { return NotFound(new { success = false, message = "未找到指定学校" }); } return Ok(updated); } /// /// 获取平台用户列表 (支持按租户和角色筛选) /// [HttpGet("users")] public async Task GetUsers([FromQuery] string? tenantId, [FromQuery] string? role) { var users = await _securityService.GetAllUsersAdminAsync(tenantId, role); return Ok(users); } /// /// 创建新用户 (严格执行角色白名单校验: 仅限 SchoolAdmin 或 Teacher) /// [HttpPost("users")] public async Task CreateUser([FromBody] CreateUserAdminRequest req) { if (string.IsNullOrWhiteSpace(req.Username) || string.IsNullOrWhiteSpace(req.Password)) { return BadRequest(new { success = false, message = "用户名与密码不能为空" }); } if (req.Password.Length < 8) { return BadRequest(new { success = false, message = "用户密码长度不得小于 8 个字符" }); } if (string.IsNullOrWhiteSpace(req.TenantId)) { return BadRequest(new { success = false, message = "必须指定归属学校" }); } if (req.Role != "SchoolAdmin" && req.Role != "Teacher") { return BadRequest(new { success = false, message = "只允许创建校区管理员 (SchoolAdmin) 或教师账号 (Teacher)" }); } try { var user = await _securityService.CreateUserAdminAsync(req, GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(user); } catch (InvalidOperationException ex) { return Conflict(new { success = false, message = ex.Message }); } } /// /// 管理员重置指定用户密码 /// [HttpPost("users/{userId}/reset-password")] public async Task ResetPassword(string userId, [FromBody] ResetPasswordRequest req) { if (string.IsNullOrWhiteSpace(req.NewPassword)) { return BadRequest(new { success = false, message = "新密码不能为空" }); } if (req.NewPassword.Length < 8) { return BadRequest(new { success = false, message = "新密码长度不得小于 8 个字符" }); } var ok = await _securityService.ResetPasswordAsync(userId, req.NewPassword, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在" }); } return Ok(new { success = true, message = "密码已成功重置" }); } /// /// 锁定或解锁用户账号 /// [HttpPost("users/{userId}/lock")] public async Task SetUserLock(string userId, [FromBody] LockUserRequest req) { var ok = await _securityService.SetUserLockAsync(userId, req.IsLocked, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在" }); } var detail = req.IsLocked ? "锁定账号 (禁止登录)" : "解锁账号 (恢复登录)"; return Ok(new { success = true, isLocked = req.IsLocked, message = detail }); } /// /// 删除指定用户 /// [HttpDelete("users/{userId}")] public async Task DeleteUser(string userId) { var ok = await _securityService.DeleteUserAsync(userId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在或无法删除" }); } return Ok(new { success = true, message = "用户已删除" }); } /// /// 获取全网所有设备及其在线状态、心跳、版本 /// [HttpGet("devices")] public async Task GetDevices() { var devices = await _securityService.GetAllDevicesAsync(); return Ok(devices); } /// /// 更新设备信息 (主机名/重命名、绑定班级) /// [HttpPatch("devices/{deviceId}")] public async Task UpdateDevice(string deviceId, [FromBody] UpdateDeviceRequest req) { try { var ok = await _securityService.UpdateDeviceAsync(deviceId, req.Hostname, req.ClassroomId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "设备不存在" }); } return Ok(new { success = true, message = "设备信息已更新" }); } catch (InvalidOperationException ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 清退并注销指定设备 /// [HttpPost("devices/{deviceId}/decommission")] public async Task DecommissionDevice(string deviceId) { var ok = await _securityService.DecommissionDeviceAsync(deviceId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "设备不存在" }); } return Ok(new { success = true, message = "设备已注销并清退" }); } /// /// 向指定设备下发远程维护指令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// [HttpPost("devices/{deviceId}/command")] public async Task SendDeviceCommand(string deviceId, [FromBody] RemoteCommandRequestDto req) { if (string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(req.Command)) { return BadRequest(new { success = false, message = "设备编号与指令内容不可为空" }); } try { var adminUser = GetActorUsername(); var cmdType = req.Command; if (cmdType.Equals("ping", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.SelfCheck; else if (cmdType.Equals("restart_client", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.RestartClient; else if (cmdType.Equals("refresh_config", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.RefreshConfig; else if (cmdType.Equals("reconnect", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.Reconnect; if (!DeviceCommandTypes.IsSupported(cmdType)) { return BadRequest(new { success = false, message = $"不支持的指令类型: '{req.Command}'。允许指令: {string.Join(", ", DeviceCommandTypes.AllSupported)}" }); } var cmdDto = await _securityService.CreateDeviceCommandAsync(null, deviceId, cmdType, req.Parameters, adminUser, GetActorRole(), GetClientIp()); var connId = _securityService.GetDeviceConnectionId(deviceId); if (!string.IsNullOrEmpty(connId)) { await _deviceHub.Clients.Client(connId).ReceiveRemoteCommand(cmdDto); await _securityService.MarkCommandDispatchedAsync(cmdDto.CommandId); cmdDto.Status = DeviceCommandStatuses.Dispatched; _logger.LogInformation("Admin dispatched remote command {CommandId} ('{Command}') to device {DeviceId} ({ConnId})", cmdDto.CommandId, cmdDto.CommandType, deviceId, connId); await _securityService.LogAdminAuditAsync( adminUser, GetActorRole(), "REMOTE_COMMAND_DISPATCHED", "Device", deviceId, $"指令已实时通过 SignalR 下发: {cmdDto.CommandType} (CommandId: {cmdDto.CommandId})", GetClientIp()); } else { _logger.LogInformation("Device {DeviceId} is offline. Remote command {CommandId} queued as Pending (expires at {ExpiresAt})", deviceId, cmdDto.CommandId, cmdDto.ExpiresAt); await _securityService.LogAdminAuditAsync( adminUser, GetActorRole(), "REMOTE_COMMAND_QUEUED", "Device", deviceId, $"设备离线,指令已入队待补发: {cmdDto.CommandType} (CommandId: {cmdDto.CommandId})", GetClientIp()); } return Ok(new { success = true, commandId = cmdDto.CommandId, deviceId, command = cmdDto.CommandType, status = cmdDto.Status, expiresAt = cmdDto.ExpiresAt, message = string.IsNullOrEmpty(connId) ? $"设备当前离线,指令 [{cmdDto.CommandType}] 已入队,将在设备上线时自动补发 (有效期至 {cmdDto.ExpiresAt:u})" : $"远程指令 [{cmdDto.CommandType}] 已通过 SignalR 实时下发至设备" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (InvalidOperationException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 获取指定学校的所有班级列表 (供管理端激活码生成等下拉选择) /// [HttpGet("classes")] public async Task GetClasses([FromQuery] string tenantId) { if (string.IsNullOrWhiteSpace(tenantId)) { return BadRequest(new { success = false, message = "租户代码不可为空" }); } var classes = await _securityService.GetClassroomsAsync(tenantId.Trim()); return Ok(classes); } /// /// 获取全网激活码列表 /// [HttpGet("activation-codes")] public async Task GetActivationCodes() { var codes = await _securityService.GetActivationCodesAsync(null); return Ok(codes); } /// /// 超级管理员直接生成指定学校指定班级的激活码 /// [HttpPost("activation-codes")] public async Task GenerateActivationCode([FromQuery] string tenantId, [FromQuery] string classId) { if (string.IsNullOrWhiteSpace(tenantId) || string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "租户与班级不可为空" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId, GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(new { success = true, code, tenantId, classId, message = "激活码生成成功" }); } catch (InvalidOperationException ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 作废或删除激活码 /// [HttpDelete("activation-codes/{code}")] public async Task DeleteActivationCode(string code) { var ok = await _securityService.DeleteActivationCodeAsync(code, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "激活码不存在" }); } return Ok(new { success = true, message = "激活码已成功作废" }); } /// /// 获取全平台最新通知历史记录与 ACK /// [HttpGet("notifications")] public async Task GetNotifications([FromQuery] int limit = 50) { var list = await _securityService.GetNotificationsAsync(null, null, limit); return Ok(list); } /// /// 超级管理员跨租户/全网紧急广播下发 /// [HttpPost("broadcasts")] public async Task EmergencyBroadcast([FromBody] EmergencyBroadcastRequest req) { if (string.IsNullOrWhiteSpace(req.Message)) { return BadRequest(new { success = false, message = "广播内容不能为空" }); } if (req.Message.Length > 2000) { return BadRequest(new { success = false, message = "广播内容长度不能超过 2000 字符" }); } if (!string.IsNullOrWhiteSpace(req.Title) && req.Title.Length > 100) { return BadRequest(new { success = false, message = "广播标题长度不能超过 100 字符" }); } if (req.DurationSeconds < 5 || req.DurationSeconds > 600) { return BadRequest(new { success = false, message = "广播显示时长必须在 5 至 600 秒之间" }); } var actor = GetActorUsername(); var targetTenants = new List(); if (string.IsNullOrWhiteSpace(req.TenantId) || req.TenantId == "*") { var all = await _securityService.GetTenantsOverviewAsync(); targetTenants = all.Where(t => t.IsActive).ToList(); } else { var all = await _securityService.GetTenantsOverviewAsync(); var found = all.FirstOrDefault(t => t.Id == req.TenantId); if (found != null) { if (!found.IsActive) { return BadRequest(new { success = false, message = $"目标学校 '{found.Name}' 当前已被停用,无法接收应急广播" }); } targetTenants.Add(found); } else return NotFound(new { success = false, message = $"未找到指定学校: {req.TenantId}" }); } // P0-FailClosed Audit: Persist BROADCAST_REQUESTED audit BEFORE triggering any SignalR broadcast. // If audit write fails (e.g. DB error or trigger block), an exception is thrown and NO broadcast is ever dispatched. await _securityService.LogAdminAuditAsync( actor, GetActorRole(), "EMERGENCY_BROADCAST_REQUESTED", "System", req.TenantId ?? "ALL", $"请求下发紧急广播: {req.Title} (计划覆盖 {targetTenants.Count} 所学校)", GetClientIp()); var broadcastId = $"bcast_{Guid.NewGuid():N}"; int dispatchedCount = 0; var duration = req.DurationSeconds; foreach (var tenant in targetTenants) { var classrooms = await _securityService.GetClassroomsAsync(tenant.Id); foreach (var cls in classrooms) { var notif = new NotificationDto { Id = $"msg_emerg_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}_{Guid.NewGuid().ToString("N")[..4]}", BroadcastId = broadcastId, TenantId = tenant.Id, ClassId = cls.Id, Title = string.IsNullOrWhiteSpace(req.Title) ? "⚠️ 全校紧急通知" : req.Title, Message = req.Message, Type = NotificationType.Urgent, CreatedAt = DateTimeOffset.UtcNow, ExpiresAt = DateTimeOffset.UtcNow.AddSeconds(duration + 120), DurationSeconds = duration, Voice = req.Voice, Shake = req.Shake }; await _securityService.RecordNotificationAsync(notif, null, "系统超级管理员 (应急广播)"); // Dispatch to SignalR classroom group await _deviceHub.Clients.Group($"t:{tenant.Id}:c:{cls.Id}").ReceiveNotification(notif); // Dispatch to Teacher Hub await _teacherHub.Clients.Group($"t:{tenant.Id}:teachers").OnNewNotificationBroadcast(notif); dispatchedCount++; } } await _securityService.LogAdminAuditAsync( actor, GetActorRole(), "EMERGENCY_BROADCAST_COMPLETED", "System", req.TenantId ?? "ALL", $"紧急广播下发完成: {req.Title} - {req.Message} (覆盖 {dispatchedCount} 个班级, BroadcastId: {broadcastId})", GetClientIp()); return Ok(new { success = true, broadcastId, dispatchedCount, targetSchools = targetTenants.Count, message = $"紧急广播已成功下发至 {targetTenants.Count} 所学校共 {dispatchedCount} 个班级,正在等待设备回执" }); } /// /// 获取紧急广播真实设备回执聚合状态 /// [HttpGet("broadcasts/{broadcastId}/receipt-summary")] public async Task GetBroadcastReceiptSummary(string broadcastId, CancellationToken ct) { var summary = await _securityService.GetBroadcastReceiptSummaryAsync(broadcastId, ct); if (summary == null) { return NotFound(new { success = false, message = "未找到该广播记录" }); } return Ok(summary); } /// /// 获取平台真实系统健康状态 (数据库连通性、延迟、内存、运行时间、连接数) /// [HttpGet("system/health")] public async Task GetSystemHealth() { var health = await _securityService.GetSystemHealthAsync(); return Ok(health); } /// /// 获取超级管理员关键操作审计日志 /// [HttpGet("audit-logs")] public async Task GetAuditLogs([FromQuery] int limit = 100) { var logs = await _securityService.GetAdminAuditLogsAsync(limit); return Ok(logs); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/AuthController.cs SIZE: 1460 chars SHA256: 3B11304893E563B8232AE99DAFE5BE4870CFC11A1F4B6D09EECC02A4B5085C1A ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [EnableRateLimiting("AuthLimiter")] public class AuthController : ControllerBase { private readonly ISecurityService _securityService; public AuthController(ISecurityService securityService) { _securityService = securityService; } /// /// 统一登录接口 (返回包含 Role / TenantId 的 JWT Token) /// [HttpPost("login")] public async Task Login([FromBody] TeacherLoginDto dto) { var remoteIp = HttpContext.Connection.RemoteIpAddress?.ToString(); var result = await _securityService.LoginTeacherAsync(dto, remoteIp); if (!result.Success) { return Unauthorized(result); } return Ok(result); } /// /// 获取当前登录用户画像与角色 /// [HttpGet("me")] [Authorize] public IActionResult GetMe() { return Ok(new { userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value, name = User.FindFirst(ClaimTypes.Name)?.Value, role = User.FindFirst(ClaimTypes.Role)?.Value, tenantId = User.FindFirst("tenant_id")?.Value }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/DeviceCommandController.cs SIZE: 5204 chars SHA256: 71F0D64FD4979D7EEB4A5B7BC51C659393CB23A6FF48CB09B8F9491E619E45B3 ===================================================================== */ using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; public class SendDeviceCommandRequest { public string DeviceId { get; set; } = string.Empty; public string CommandType { get; set; } = string.Empty; public string? Parameters { get; set; } } [ApiController] [Route("api/device-command")] [Authorize] public class DeviceCommandController : ControllerBase { private readonly ISecurityService _securityService; private readonly IHubContext _deviceHub; private readonly ILogger _logger; public DeviceCommandController( ISecurityService securityService, IHubContext deviceHub, ILogger logger) { _securityService = securityService; _deviceHub = deviceHub; _logger = logger; } /// /// 下发受控远程运维命令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// [HttpPost("send")] [Authorize(Roles = "SuperAdmin,SchoolAdmin,Teacher")] public async Task SendCommand([FromBody] SendDeviceCommandRequest req) { if (req == null || string.IsNullOrWhiteSpace(req.DeviceId) || string.IsNullOrWhiteSpace(req.CommandType)) { return BadRequest(new { success = false, message = "设备编号与指令类型不可为空" }); } var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var callerUser = User.Identity?.Name ?? User.FindFirst("name")?.Value ?? "User"; try { var cmdDto = await _securityService.CreateDeviceCommandAsync( tenantId, req.DeviceId, req.CommandType, req.Parameters, callerUser); var connId = _securityService.GetDeviceConnectionId(req.DeviceId); if (!string.IsNullOrEmpty(connId)) { await _deviceHub.Clients.Client(connId).ReceiveRemoteCommand(cmdDto); await _securityService.MarkCommandDispatchedAsync(cmdDto.CommandId); cmdDto.Status = DeviceCommandStatuses.Dispatched; _logger.LogInformation("Dispatched command {CommandId} ({Type}) to device {DeviceId} via SignalR {ConnId}", cmdDto.CommandId, cmdDto.CommandType, req.DeviceId, connId); } else { _logger.LogInformation("Device {DeviceId} is offline. Command {CommandId} queued as Pending until {ExpiresAt:u}", req.DeviceId, cmdDto.CommandId, cmdDto.ExpiresAt); } return Ok(new { success = true, command = cmdDto, isDispatched = !string.IsNullOrEmpty(connId), message = string.IsNullOrEmpty(connId) ? $"设备当前离线,指令已排队,将在设备上线且未过期时补发 (过期时间: {cmdDto.ExpiresAt:u})" : $"指令已通过 SignalR 实时下发至设备 (过期时间: {cmdDto.ExpiresAt:u})" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(StatusCodes.Status403Forbidden, new { success = false, message = ex.Message }); } catch (InvalidOperationException ex) { return NotFound(new { success = false, message = ex.Message }); } catch (Exception ex) { _logger.LogError(ex, "Unexpected error sending command to device {DeviceId}", req.DeviceId); return StatusCode(500, new { success = false, message = "下发指令内部错误" }); } } /// /// 查询单条命令当前状态与执行结果 /// [HttpGet("{commandId}")] public async Task GetCommand(string commandId) { if (string.IsNullOrWhiteSpace(commandId)) { return BadRequest(new { success = false, message = "CommandId 不可为空" }); } var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var cmd = await _securityService.GetDeviceCommandAsync(commandId, tenantId); if (cmd == null) { return NotFound(new { success = false, message = "命令未找到或无权访问" }); } return Ok(cmd); } /// /// 获取命令审计流水历史记录 /// [HttpGet("history")] public async Task GetHistory( [FromQuery] string? deviceId = null, [FromQuery] string? status = null, [FromQuery] int limit = 50) { var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var history = await _securityService.GetDeviceCommandHistoryAsync(tenantId, deviceId, status, limit); return Ok(history); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/DeviceController.cs SIZE: 4164 chars SHA256: 2F5D5BA2DBB53D861406118DB23A21B8680313F8AEA7235C65193B90244E1B78 ===================================================================== */ using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [EnableRateLimiting("ActivationLimiter")] public class DeviceController : ControllerBase { private readonly ISecurityService _securityService; private readonly IVisualReceiptService _visualReceiptService; public DeviceController(ISecurityService securityService, IVisualReceiptService visualReceiptService) { _securityService = securityService; _visualReceiptService = visualReceiptService; } /// /// 教室端初次安装激活接口 (通过一次性激活码换取永久硬件凭据) /// [HttpPost("activate")] public async Task Activate([FromBody] DeviceActivationRequestDto dto) { var result = await _securityService.ActivateDeviceAsync(dto); if (!result.Success) { if (result.ErrorMessage?.Contains("其他设备安装实例") == true) { return Conflict(result); } return BadRequest(result); } return Ok(result); } /// /// 学校教师/管理员在线生成班级一次性设备激活码 /// [HttpPost("generate-code")] [Microsoft.AspNetCore.Authorization.Authorize(Roles = "SuperAdmin,SchoolAdmin")] public async Task GenerateCode([FromQuery] string classId) { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) { return Unauthorized(new { success = false, message = "未发现合法的租户信息" }); } if (string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "班级编号不可为空" }); } var classroom = await _securityService.GetClassroomAsync(tenantId, classId); if (classroom == null) { return NotFound(new { success = false, message = $"班级 {classId} 不存在或不属于当前学校" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId); return Ok(new { success = true, code, tenantId, classId, message = "激活码已生成,有效期 7 天" }); } catch (Exception ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 教室 Windows 客户端上传单帧通知视觉回执 (JPEG 格式, 最大 512KB) /// [HttpPost("notifications/{notificationId}/visual-receipt")] [HttpPost("/api/devices/notifications/{notificationId}/visual-receipt")] [RequestSizeLimit(524288)] // 512 KiB public async Task UploadVisualReceipt(string notificationId) { var deviceId = Request.Headers["X-Device-Id"].FirstOrDefault(); var deviceToken = Request.Headers["X-Device-Token"].FirstOrDefault(); if (string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(deviceToken)) { return Unauthorized(new { success = false, message = "缺少设备鉴权凭据 (X-Device-Id / X-Device-Token)" }); } if (Request.ContentType?.StartsWith("image/jpeg", StringComparison.OrdinalIgnoreCase) != true) { return StatusCode(415, new { success = false, message = "仅支持 image/jpeg 格式内容" }); } using var ms = new MemoryStream(); await Request.Body.CopyToAsync(ms); var bytes = ms.ToArray(); var result = await _visualReceiptService.SaveVisualReceiptAsync(notificationId, deviceId, deviceToken, bytes); if (!result.Success) { return StatusCode(result.StatusCode, new { success = false, message = result.Message }); } return Ok(new { success = true, receiptId = result.ReceiptId, notificationId, visualReceiptState = "Available", capturedAt = result.CapturedAt, expiresAt = result.ExpiresAt, message = result.Message }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/NotificationController.cs SIZE: 9733 chars SHA256: 4776B79CDF8E1B8FF9FA14100C84B71AE4B293727F29C8DD3B087E5940A67D76 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Authorize] [EnableRateLimiting("SendLimiter")] public class NotificationController : ControllerBase { private readonly IHubContext _deviceHubContext; private readonly IHubContext _teacherHubContext; private readonly ISecurityService _securityService; private readonly IVisualReceiptService _visualReceiptService; private readonly ILogger _logger; public NotificationController( IHubContext deviceHubContext, IHubContext teacherHubContext, ISecurityService securityService, IVisualReceiptService visualReceiptService, ILogger logger) { _deviceHubContext = deviceHubContext; _teacherHubContext = teacherHubContext; _securityService = securityService; _visualReceiptService = visualReceiptService; _logger = logger; } /// /// 教师向指定班级下发呼叫通知 (严格校验租户与班级权限) /// [HttpPost("send")] public async Task SendNotification([FromBody] NotificationDto notification) { // 1. Extract and validate tenant from authenticated teacher claims var teacherTenantId = User.FindFirst("tenant_id")?.Value; var teacherName = User.FindFirst(ClaimTypes.Name)?.Value ?? "未知老师"; var teacherId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (string.IsNullOrEmpty(teacherTenantId)) { return Unauthorized(new { success = false, message = "未发现合法的租户信息" }); } if (string.IsNullOrWhiteSpace(notification.ClassId) || string.IsNullOrWhiteSpace(notification.Message)) { return BadRequest(new { success = false, message = "班级编号与通知内容不可为空" }); } // 2. Multi-tenant Scope Validation: Ensure target classroom exists in teacher's tenant! var classroom = await _securityService.GetClassroomAsync(teacherTenantId, notification.ClassId); if (classroom == null) { _logger.LogWarning("Cross-tenant attempt or invalid class: Teacher {TeacherId} (Tenant: {TenantId}) tried to notify Class {ClassId}", teacherId, teacherTenantId, notification.ClassId); return StatusCode(403, new { success = false, message = "无权访问该班级,或班级不属于当前学校" }); } // 3. Stamp metadata & Business TTL Policy notification.Id = $"msg_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}_{Guid.NewGuid().ToString("N")[..4]}"; notification.TenantId = teacherTenantId; notification.CreatedAt = DateTimeOffset.UtcNow; if (notification.ExpiresAt.HasValue) { if (notification.ExpiresAt.Value <= notification.CreatedAt) { return BadRequest(new { success = false, message = "消息过期时间必须在创建时间之后" }); } // Max TTL cap: 7 days var maxExpiresAt = notification.CreatedAt.AddDays(7); if (notification.ExpiresAt.Value > maxExpiresAt) { notification.ExpiresAt = maxExpiresAt; } } else { // Default TTL based on NotificationType urgency notification.ExpiresAt = notification.Type switch { ClassNotify.Shared.Enums.NotificationType.Call => notification.CreatedAt.AddMinutes(10), ClassNotify.Shared.Enums.NotificationType.Notice => notification.CreatedAt.AddMinutes(60), ClassNotify.Shared.Enums.NotificationType.Urgent => notification.CreatedAt.AddHours(24), _ => notification.CreatedAt.AddMinutes(15) }; } await _securityService.RecordNotificationAsync(notification, teacherId, teacherName); _logger.LogInformation("Teacher {TeacherName} ({TenantId}) sending notification to {ClassName} ({ClassId}): {Message}", teacherName, teacherTenantId, classroom.DisplayName, classroom.Id, notification.Message); // 4. Send to tenant-isolated SignalR classroom group var tenantClassGroup = $"t:{teacherTenantId}:c:{notification.ClassId}"; await _deviceHubContext.Clients.Group(tenantClassGroup).ReceiveNotification(notification); // 5. Broadcast only to teachers of THIS tenant var tenantTeacherGroup = $"t:{teacherTenantId}:teachers"; await _teacherHubContext.Clients.Group(tenantTeacherGroup).OnNewNotificationBroadcast(notification); return Ok(new { success = true, messageId = notification.Id, tenantId = teacherTenantId, classId = notification.ClassId, className = classroom.DisplayName, message = "通知已成功下发至教室大屏" }); } /// /// 获取当前教师所在学校的班级列表 /// [HttpGet("classes")] public async Task GetTeacherClasses() { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var classes = await _securityService.GetClassroomsAsync(tenantId); return Ok(classes); } /// /// 获取当前教师所在学校的历史通知记录与回执 /// [HttpGet("history")] public async Task GetNotificationHistory([FromQuery] string? classId, [FromQuery] int limit = 50) { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var list = await _securityService.GetNotificationsAsync(tenantId, classId, limit); return Ok(list); } /// /// 查看指定通知在指定教室设备的视觉回执现场画面 (受权限保护的短效 JPEG) /// [HttpGet("{notificationId}/receipts/{deviceId}/visual-receipt")] [HttpGet("/api/notifications/{notificationId}/receipts/{deviceId}/visual-receipt")] public async Task GetVisualReceipt(string notificationId, string deviceId) { var result = await _visualReceiptService.GetVisualReceiptFileAsync(notificationId, deviceId, User); if (!result.Success) { return StatusCode(result.StatusCode, new { success = false, message = result.ErrorMessage }); } Response.Headers["Cache-Control"] = "private, no-store, max-age=0"; Response.Headers["Pragma"] = "no-cache"; Response.Headers["X-Content-Type-Options"] = "nosniff"; return PhysicalFile(result.FilePath!, "image/jpeg"); } /// /// 撤回/提前关闭正在显示的通知 /// [HttpPost("{id}/cancel")] [HttpPost("/api/notifications/{id}/cancel")] public async Task CancelNotification(string id, CancellationToken ct) { var tenantId = User.FindFirst("tenant_id")?.Value; var userName = User.FindFirst(ClaimTypes.Name)?.Value ?? "未知操作者"; var userRole = User.FindFirst(ClaimTypes.Role)?.Value ?? "Teacher"; var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); CancelNotificationResult result; try { result = await _securityService.CancelNotificationAsync( id, userId, userName, userRole, tenantId, ip, ct); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } bool devicePushOk = true; bool teacherPushOk = true; if (!string.IsNullOrEmpty(result.ClassroomId)) { try { var tenantClassGroup = $"t:{result.TenantId}:c:{result.ClassroomId}"; await _deviceHubContext.Clients.Group(tenantClassGroup).CancelNotification(id); } catch (Exception ex) { devicePushOk = false; _logger.LogError(ex, "Failed to broadcast CancelNotification to device group for {NotificationId}", id); } } try { var tenantTeacherGroup = $"t:{result.TenantId}:teachers"; await _teacherHubContext.Clients.Group(tenantTeacherGroup).OnNotificationCancelled(id); } catch (Exception ex) { teacherPushOk = false; _logger.LogError(ex, "Failed to broadcast OnNotificationCancelled to teacher group for {NotificationId}", id); } return Ok(new { success = true, notificationId = id, alreadyCancelled = result.AlreadyCancelled, cancelledAt = result.CancelledAt, realtimeDeviceCloseSent = devicePushOk, realtimeTeacherUpdateSent = teacherPushOk, message = result.AlreadyCancelled ? "通知此前已被撤回" : devicePushOk ? "通知已成功撤回并请求大屏立即关闭" : "通知已撤回;实时关闭信令部分失败,但该通知不会再次补发" }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/SchoolAdminController.cs SIZE: 9359 chars SHA256: F3CD1C6506E2B00D62D8D81C215565E12AE018A89813BD7D2E01032EF5A52FC9 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Route("api/school-admin")] [Authorize(Roles = "SchoolAdmin,SuperAdmin")] public class SchoolAdminController : ControllerBase { private readonly ISecurityService _securityService; private readonly ILogger _logger; public SchoolAdminController(ISecurityService securityService, ILogger logger) { _securityService = securityService; _logger = logger; } private string? GetTenantId() { // If SuperAdmin, can specify tenant_id via query or header, otherwise use claim var claimTenant = User.FindFirst("tenant_id")?.Value; if (claimTenant == "global" && Request.Query.ContainsKey("tenant_id")) { return Request.Query["tenant_id"].ToString(); } return claimTenant; } /// /// 获取本校基础统计 /// [HttpGet("overview")] public async Task GetOverview() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var tenant = await _securityService.GetTenantAsync(tenantId); var classes = await _securityService.GetClassroomsAsync(tenantId); var devices = await _securityService.GetTenantDevicesAsync(tenantId); var teachers = await _securityService.GetUsersAsync(tenantId); return Ok(new { tenantId, tenantName = tenant?.Name ?? tenantId, classCount = classes.Count, deviceCount = devices.Count, onlineCount = devices.Count(d => d.IsOnline), teacherCount = teachers.Count }); } /// /// 获取本校所有班级 /// [HttpGet("classes")] public async Task GetClasses() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var classes = await _securityService.GetClassroomsAsync(tenantId); return Ok(classes); } /// /// 为本校新增班级 /// [HttpPost("classes")] public async Task CreateClass([FromBody] CreateClassroomDto dto) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(dto.Id) || string.IsNullOrWhiteSpace(dto.DisplayName)) { return BadRequest(new { success = false, message = "班级编号与班级名称不可为空" }); } var ok = await _securityService.CreateClassroomAsync(tenantId, dto); if (!ok) { return BadRequest(new { success = false, message = $"班级编号 {dto.Id} 已存在" }); } return Ok(new { success = true, message = "班级创建成功" }); } /// /// 获取本校所有教师与管理员账号 /// [HttpGet("teachers")] public async Task GetTeachers() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var users = await _securityService.GetUsersAsync(tenantId); var result = users.Select(u => new { u.Id, u.Username, u.FullName, u.Role, u.IsLocked, u.CreatedAt, u.LastLoginAt }); return Ok(result); } /// /// 学校管理员为本校教师重置密码 /// [HttpPost("teachers/{userId}/reset-password")] public async Task ResetTeacherPassword(string userId, [FromBody] ResetPasswordRequest req) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(req.NewPassword) || req.NewPassword.Length < 8) { return BadRequest(new { success = false, message = "新密码长度不得小于 8 个字符" }); } var actor = User.FindFirst(ClaimTypes.Name)?.Value ?? "SchoolAdmin"; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); try { await _securityService.ResetSchoolTeacherPasswordAsync(tenantId, userId, req.NewPassword, actor, ip); return Ok(new { success = true, message = "教师密码已成功重置,历史登录会话已失效" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 学校管理员停用或启用本校教师账号 /// [HttpPost("teachers/{userId}/lock")] public async Task SetTeacherLock(string userId, [FromBody] LockUserRequest req) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var actor = User.FindFirst(ClaimTypes.Name)?.Value ?? "SchoolAdmin"; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); try { var changed = await _securityService.SetSchoolTeacherLockAsync(tenantId, userId, req.IsLocked, actor, ip); return Ok(new { success = true, changed, isLocked = req.IsLocked, message = changed ? (req.IsLocked ? "教师账号已停用并强制下线" : "教师账号已恢复启用") : "账号已处于目标状态" }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 为本校创建教师账号 /// [HttpPost("teachers")] public async Task CreateTeacher([FromBody] CreateTeacherDto dto) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(dto.Username) || string.IsNullOrWhiteSpace(dto.Password) || string.IsNullOrWhiteSpace(dto.FullName)) { return BadRequest(new { success = false, message = "账号、密码和姓名不可为空" }); } // P0-02: Prevent privilege escalation. // SchoolAdmin can only create Teacher accounts. // SuperAdmin can create SchoolAdmin or Teacher, but never SuperAdmin here. if (!User.IsInRole("SuperAdmin")) { dto.Role = "Teacher"; } else { if (dto.Role == "SuperAdmin") { return BadRequest(new { success = false, message = "禁止通过此接口创建平台超级管理员账号" }); } if (string.IsNullOrWhiteSpace(dto.Role)) { dto.Role = "Teacher"; } } var ok = await _securityService.CreateUserAsync(tenantId, dto); if (!ok) { return BadRequest(new { success = false, message = $"用户名 {dto.Username} 已存在" }); } return Ok(new { success = true, message = "教师账号创建成功" }); } /// /// 获取本校所有设备 /// [HttpGet("devices")] public async Task GetDevices() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var devices = await _securityService.GetTenantDevicesAsync(tenantId); return Ok(devices); } /// /// 获取本校激活码 /// [HttpGet("activation-codes")] public async Task GetActivationCodes() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var codes = await _securityService.GetActivationCodesAsync(tenantId); return Ok(codes); } /// /// 本校管理员生成班级激活码 /// [HttpPost("activation-codes")] public async Task GenerateActivationCode([FromQuery] string classId) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "班级编号不可为空" }); } var classroom = await _securityService.GetClassroomAsync(tenantId, classId); if (classroom == null) { return NotFound(new { success = false, message = $"班级 {classId} 不存在或不属于该学校" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId); return Ok(new { success = true, code, tenantId, classId, message = "激活码生成成功" }); } catch (Exception ex) { return BadRequest(new { success = false, message = ex.Message }); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/ClassNotifyDbContext.cs SIZE: 9036 chars SHA256: D1E4022F664EE439A42AA256751754B1CE1E084A836D6FB6EE3A7DE9FD68823E ===================================================================== */ using ClassNotify.Server.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public class ClassNotifyDbContext : DbContext { public ClassNotifyDbContext(DbContextOptions options) : base(options) { } public DbSet Tenants => Set(); public DbSet Classrooms => Set(); public DbSet Users => Set(); public DbSet Devices => Set(); public DbSet DeviceCredentials => Set(); public DbSet ActivationCodes => Set(); public DbSet Notifications => Set(); public DbSet NotificationReceipts => Set(); public DbSet MigrationMarkers => Set(); public DbSet DeviceCommands => Set(); public DbSet AdminAuditEvents => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // 1. Tenant modelBuilder.Entity(entity => { entity.HasKey(t => t.Id); entity.Property(t => t.Name).IsRequired().HasMaxLength(200); }); // 2. Classroom (Composite key for multi-tenant isolation) modelBuilder.Entity(entity => { entity.HasKey(c => new { c.TenantId, c.Id }); entity.Property(c => c.DisplayName).IsRequired().HasMaxLength(100); entity.Property(c => c.Grade).HasMaxLength(50); entity.Property(c => c.RoomNumber).HasMaxLength(50); entity.HasOne(c => c.Tenant) .WithMany(t => t.Classrooms) .HasForeignKey(c => c.TenantId) .OnDelete(DeleteBehavior.Cascade); entity.HasIndex(c => new { c.TenantId, c.Id }); }); // 3. User modelBuilder.Entity(entity => { entity.HasKey(u => u.Id); entity.Property(u => u.Username).IsRequired().HasMaxLength(100); entity.Property(u => u.PasswordHash).IsRequired(); entity.Property(u => u.FullName).IsRequired().HasMaxLength(100); entity.Property(u => u.Role).IsRequired().HasMaxLength(50); entity.HasIndex(u => u.Username).IsUnique(); entity.HasIndex(u => u.TenantId); entity.HasOne(u => u.Tenant) .WithMany(t => t.Users) .HasForeignKey(u => u.TenantId) .OnDelete(DeleteBehavior.Restrict); }); // 4. Device modelBuilder.Entity(entity => { entity.HasKey(d => d.Id); entity.Property(d => d.DeviceTokenHash).IsRequired(); entity.Property(d => d.InstallationId).HasMaxLength(100); entity.Property(d => d.Hostname).HasMaxLength(200); entity.HasIndex(d => d.Id).IsUnique(); entity.HasIndex(d => d.InstallationId).IsUnique().HasFilter("\"InstallationId\" IS NOT NULL"); entity.HasIndex(d => new { d.TenantId, d.ClassroomId }); entity.HasIndex(d => d.TenantId); entity.HasOne(d => d.Tenant) .WithMany(t => t.Devices) .HasForeignKey(d => d.TenantId) .OnDelete(DeleteBehavior.Restrict); entity.HasOne(d => d.Classroom) .WithMany(c => c.Devices) .HasForeignKey(d => new { d.TenantId, d.ClassroomId }) .OnDelete(DeleteBehavior.Restrict); }); // 5. DeviceCredentialRecord modelBuilder.Entity(entity => { entity.HasKey(c => c.DeviceId); entity.Property(c => c.InstallationId).IsRequired().HasMaxLength(100); entity.Property(c => c.DeviceTokenHash).IsRequired(); entity.Property(c => c.EncryptedRecoverableToken).IsRequired(); entity.HasIndex(c => c.DeviceId).IsUnique(); entity.HasIndex(c => c.InstallationId).IsUnique(); }); // 6. ActivationCode modelBuilder.Entity(entity => { entity.HasKey(a => a.Code); entity.Property(a => a.Code).HasMaxLength(50); entity.Property(a => a.ClassroomId).IsRequired().HasMaxLength(50); entity.Property(a => a.InstallationId).HasMaxLength(100); entity.HasIndex(a => a.Code).IsUnique(); entity.HasIndex(a => a.TenantId); entity.HasIndex(a => a.ClassroomId); entity.HasIndex(a => a.InstallationId); entity.HasOne(a => a.Tenant) .WithMany(t => t.ActivationCodes) .HasForeignKey(a => a.TenantId) .OnDelete(DeleteBehavior.Restrict); }); // 7. Notification modelBuilder.Entity(entity => { entity.HasKey(n => n.Id); entity.Property(n => n.Id).HasMaxLength(100); entity.Property(n => n.ClassroomId).IsRequired().HasMaxLength(50); entity.Property(n => n.SenderName).IsRequired().HasMaxLength(100); entity.Property(n => n.Message).IsRequired(); entity.Property(n => n.Title).IsRequired().HasMaxLength(200); entity.Property(n => n.Priority).IsRequired().HasMaxLength(50); entity.HasIndex(n => new { n.TenantId, n.CreatedAt }).IsDescending(false, true); entity.HasIndex(n => new { n.ClassroomId, n.CreatedAt }).IsDescending(false, true); entity.HasIndex(n => new { n.TenantId, n.ClassroomId, n.ExpiresAt }); entity.HasOne(n => n.Tenant) .WithMany(t => t.Notifications) .HasForeignKey(n => n.TenantId) .OnDelete(DeleteBehavior.Cascade); }); // 8. NotificationReceipt (per-device ACK state isolation) modelBuilder.Entity(entity => { entity.HasKey(r => r.Id); entity.Property(r => r.Id).HasMaxLength(100); entity.Property(r => r.NotificationId).IsRequired().HasMaxLength(100); entity.Property(r => r.DeviceId).IsRequired().HasMaxLength(100); entity.Property(r => r.Status).IsRequired().HasMaxLength(50); entity.Property(r => r.FailureReason).HasMaxLength(500); entity.Property(r => r.VisualReceiptState).IsRequired().HasMaxLength(32).HasDefaultValue("None"); entity.Property(r => r.VisualReceiptPath).HasMaxLength(500); entity.Property(r => r.VisualReceiptSha256).HasMaxLength(64); entity.HasIndex(r => new { r.NotificationId, r.DeviceId }).IsUnique(); entity.HasIndex(r => new { r.DeviceId, r.UpdatedAt }).IsDescending(false, true); entity.HasIndex(r => new { r.DeviceId, r.Status }); entity.HasIndex(r => r.VisualReceiptExpiresAt); entity.HasOne(r => r.Notification) .WithMany(n => n.Receipts) .HasForeignKey(r => r.NotificationId) .OnDelete(DeleteBehavior.Cascade); entity.HasOne(r => r.Device) .WithMany(d => d.Receipts) .HasForeignKey(r => r.DeviceId) .OnDelete(DeleteBehavior.Cascade); }); // 9. MigrationMarker modelBuilder.Entity(entity => { entity.HasKey(m => m.Id); entity.Property(m => m.Id).HasMaxLength(100); }); // 10. DeviceCommand modelBuilder.Entity(entity => { entity.HasKey(c => c.Id); entity.Property(c => c.Id).HasMaxLength(100); entity.Property(c => c.TenantId).IsRequired().HasMaxLength(100); entity.Property(c => c.DeviceId).IsRequired().HasMaxLength(100); entity.Property(c => c.CommandType).IsRequired().HasMaxLength(50); entity.Property(c => c.CreatedBy).IsRequired().HasMaxLength(100); entity.Property(c => c.Status).IsRequired().HasMaxLength(50); entity.Property(c => c.DurationMs); entity.Property(c => c.ResultMessage).HasMaxLength(1000); entity.HasIndex(c => new { c.TenantId, c.DeviceId, c.CreatedAt }).IsDescending(false, false, true); entity.HasIndex(c => new { c.DeviceId, c.Status }); entity.HasIndex(c => new { c.Status, c.ExpiresAt }); entity.HasOne(c => c.Tenant) .WithMany() .HasForeignKey(c => c.TenantId) .OnDelete(DeleteBehavior.Cascade); entity.HasOne(c => c.Device) .WithMany() .HasForeignKey(c => c.DeviceId) .OnDelete(DeleteBehavior.Cascade); }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/ClassNotifyDbContextFactory.cs SIZE: 874 chars SHA256: 2BE10071544EF5D652C1776174492E92BE79FFDE57B84802F292447B17D7D7E1 ===================================================================== */ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace ClassNotify.Server.Data; public class ClassNotifyDbContextFactory : IDesignTimeDbContextFactory { public ClassNotifyDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder(); // Default local/development connection string for migrations design-time // Note: Real production connection strings are loaded via EnvironmentFile on the VPS var connStr = Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection") ?? "Host=127.0.0.1;Port=5432;Database=classnotify;Username=classnotify;Password=CHANGEME_DEV;"; optionsBuilder.UseNpgsql(connStr); return new ClassNotifyDbContext(optionsBuilder.Options); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/DbInitializer.cs SIZE: 5297 chars SHA256: 3CEB6AA53B59A906CA47669BFF68AB1801F5629CBF34B14466BF6F68F80E2E2D ===================================================================== */ using System.Security.Cryptography; using System.Text; using ClassNotify.Server.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public static class DbInitializer { public static async Task InitializeAsync(ClassNotifyDbContext dbContext, IHostEnvironment env, IConfiguration config, ILogger logger) { // 1. Always ensure 'global' tenant exists for SuperAdmin users if (!await dbContext.Tenants.AnyAsync(t => t.Id == "global")) { dbContext.Tenants.Add(new Tenant { Id = "global", Name = "全局平台管理", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } // 2. HARD PRODUCTION SEED GUARD: // In Production environment, NEVER allow development seeding under any circumstances, // even if SeedDevelopmentData is erroneously set to true in configuration. if (env.IsProduction()) { if (config.GetValue("SeedDevelopmentData")) { logger.LogWarning("SECURITY ALERT: SeedDevelopmentData=true was configured in Production environment! Hard guard engaged: development seeding is strictly prohibited in Production."); } logger.LogInformation("Production environment: Development seeding is strictly prohibited. Skipping."); return; } // Only seed sample schools/classes/devices in non-production development environments bool seedDevData = config.GetValue("SeedDevelopmentData") || env.IsDevelopment(); if (!seedDevData) { logger.LogInformation("Skipping development data seeding."); return; } // If tenants other than 'global' already exist, skip development seed if (await dbContext.Tenants.AnyAsync(t => t.Id != "global")) { return; } logger.LogInformation("Seeding initial development tenants, classrooms, users, and activation codes..."); // Development Tenants var t1 = new Tenant { Id = "t_beijing_no4", Name = "北京四中", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; var t2 = new Tenant { Id = "t_shanghai_high", Name = "上海实验学校", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.AddRange(t1, t2); // Development Classrooms var c1 = new Classroom { Id = "cls_801", TenantId = "t_beijing_no4", DisplayName = "八年级(1)班", Grade = "初二", RoomNumber = "综合楼301" }; var c2 = new Classroom { Id = "cls_802", TenantId = "t_beijing_no4", DisplayName = "八年级(2)班", Grade = "初二", RoomNumber = "综合楼302" }; var c3 = new Classroom { Id = "cls_801", TenantId = "t_shanghai_high", DisplayName = "高一(1)班", Grade = "高一", RoomNumber = "实验楼101" }; dbContext.Classrooms.AddRange(c1, c2, c3); // Development Users var hasher = new Microsoft.AspNetCore.Identity.PasswordHasher(); var uSuper = new User { Id = "usr_super", TenantId = "global", Username = "admin", FullName = "超级管理员", Role = "SuperAdmin" }; uSuper.PasswordHash = hasher.HashPassword(uSuper, "admin888"); var uAdminBj = new User { Id = "usr_admin_bj", TenantId = "t_beijing_no4", Username = "admin_bj4", FullName = "北京四中管理员", Role = "SchoolAdmin" }; uAdminBj.PasswordHash = hasher.HashPassword(uAdminBj, "admin123"); var uAdminSh = new User { Id = "usr_admin_sh", TenantId = "t_shanghai_high", Username = "admin_sh", FullName = "上海实验管理员", Role = "SchoolAdmin" }; uAdminSh.PasswordHash = hasher.HashPassword(uAdminSh, "admin123"); var u101 = new User { Id = "usr_101", TenantId = "t_beijing_no4", Username = "teacher_zhang", FullName = "张老师", Role = "Teacher" }; u101.PasswordHash = hasher.HashPassword(u101, "teacher123"); var u201 = new User { Id = "usr_201", TenantId = "t_shanghai_high", Username = "teacher_li", FullName = "李老师", Role = "Teacher" }; u201.PasswordHash = hasher.HashPassword(u201, "teacher123"); dbContext.Users.AddRange(uSuper, uAdminBj, uAdminSh, u101, u201); // Development Activation Codes dbContext.ActivationCodes.AddRange( new ActivationCode { Code = "TEST-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ81-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ82-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_802", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ81-DEMO", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "SH01-2026", TenantId = "t_shanghai_high", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false } ); await dbContext.SaveChangesAsync(); logger.LogInformation("Development seed completed successfully."); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/JsonMigrationService.cs SIZE: 14495 chars SHA256: 5094565BB6FCD1D33B83469E72A8C6627BA7FBE5A391B22A1BBDAD8B2962F0C3 ===================================================================== */ using System.Text.Json; using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Models; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public class JsonMigrationResult { public bool Migrated { get; set; } public string? BackupPath { get; set; } public int TenantsCount { get; set; } public int ClassroomsCount { get; set; } public int UsersCount { get; set; } public int DevicesCount { get; set; } public int CredentialsCount { get; set; } public int ActivationCodesCount { get; set; } public int NotificationsCount { get; set; } } public static class JsonMigrationService { public static async Task MigrateAsync(ClassNotifyDbContext dbContext, string? dataDirectory, ILogger logger) { var result = new JsonMigrationResult(); var marker = await dbContext.MigrationMarkers.FindAsync("JsonMigration_v1"); if (marker != null) { logger.LogInformation("JSON migration marker 'JsonMigration_v1' already exists (migrated at {MigratedAt}). Skipping migration.", marker.MigratedAt); return result; } var dataDir = dataDirectory ?? Path.Combine(AppContext.BaseDirectory, "data"); if (!Directory.Exists(dataDir)) { logger.LogInformation("No 'data' directory found at {DataDir}. Skipping JSON migration.", dataDir); return result; } var tenantsFile = Path.Combine(dataDir, "tenants.json"); var classroomsFile = Path.Combine(dataDir, "classrooms.json"); var usersFile = Path.Combine(dataDir, "users.json"); var devicesFile = Path.Combine(dataDir, "devices.json"); var credsFile = Path.Combine(dataDir, "device_credentials.json"); var codesFile = Path.Combine(dataDir, "activation_codes.json"); var notifsFile = Path.Combine(dataDir, "notifications.json"); if (!File.Exists(tenantsFile) && !File.Exists(classroomsFile) && !File.Exists(usersFile) && !File.Exists(devicesFile) && !File.Exists(credsFile) && !File.Exists(codesFile) && !File.Exists(notifsFile)) { logger.LogInformation("No legacy JSON data files found in {DataDir}. Skipping JSON migration.", dataDir); return result; } logger.LogInformation("Starting one-time legacy JSON to PostgreSQL transactional migration from {DataDir}...", dataDir); using var tx = await dbContext.Database.BeginTransactionAsync(); try { // 1. Tenants var tenantDict = new Dictionary(); if (!await dbContext.Tenants.AnyAsync(t => t.Id == "global")) { var globalTenant = new Tenant { Id = "global", Name = "全局平台管理", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.Add(globalTenant); tenantDict["global"] = globalTenant; } if (File.Exists(tenantsFile)) { var json = await File.ReadAllTextAsync(tenantsFile); var tenants = JsonSerializer.Deserialize>(json) ?? new(); foreach (var t in tenants) { if (!await dbContext.Tenants.AnyAsync(existing => existing.Id == t.Id) && !tenantDict.ContainsKey(t.Id)) { dbContext.Tenants.Add(t); tenantDict[t.Id] = t; result.TenantsCount++; } } await dbContext.SaveChangesAsync(); } // 2. Classrooms if (File.Exists(classroomsFile)) { var json = await File.ReadAllTextAsync(classroomsFile); var classrooms = JsonSerializer.Deserialize>(json) ?? new(); foreach (var c in classrooms) { if (!await dbContext.Classrooms.AnyAsync(existing => existing.TenantId == c.TenantId && existing.Id == c.Id)) { dbContext.Classrooms.Add(c); result.ClassroomsCount++; } } await dbContext.SaveChangesAsync(); } // 3. Users if (File.Exists(usersFile)) { var json = await File.ReadAllTextAsync(usersFile); var users = JsonSerializer.Deserialize>(json) ?? new(); foreach (var u in users) { if (!await dbContext.Users.AnyAsync(existing => existing.Username == u.Username)) { // Ensure tenant exists if (!string.IsNullOrEmpty(u.TenantId) && !await dbContext.Tenants.AnyAsync(t => t.Id == u.TenantId)) { var newTenant = new Tenant { Id = u.TenantId, Name = u.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.Add(newTenant); await dbContext.SaveChangesAsync(); } dbContext.Users.Add(u); result.UsersCount++; } } await dbContext.SaveChangesAsync(); } // 4. Devices var migratedDevices = new List(); if (File.Exists(devicesFile)) { var json = await File.ReadAllTextAsync(devicesFile); var devices = JsonSerializer.Deserialize>(json) ?? new(); var usedInstallationIds = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var d in devices) { if (!await dbContext.Devices.AnyAsync(existing => existing.Id == d.Id)) { // Ensure tenant and classroom exist if (!await dbContext.Tenants.AnyAsync(t => t.Id == d.TenantId)) { dbContext.Tenants.Add(new Tenant { Id = d.TenantId, Name = d.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } if (!await dbContext.Classrooms.AnyAsync(c => c.TenantId == d.TenantId && c.Id == d.ClassroomId)) { dbContext.Classrooms.Add(new Classroom { TenantId = d.TenantId, Id = d.ClassroomId, DisplayName = d.ClassroomId }); await dbContext.SaveChangesAsync(); } // Handle legacy duplicate InstallationId gracefully if (!string.IsNullOrEmpty(d.InstallationId)) { if (usedInstallationIds.Contains(d.InstallationId) || await dbContext.Devices.AnyAsync(existing => existing.InstallationId == d.InstallationId)) { logger.LogWarning("Legacy duplicate InstallationId {InstId} detected for Device {DeviceId}. Renaming for unique constraint.", d.InstallationId, d.Id); d.InstallationId = $"{d.InstallationId}_dup_{d.Id}"; } usedInstallationIds.Add(d.InstallationId); } dbContext.Devices.Add(d); migratedDevices.Add(d); result.DevicesCount++; } } await dbContext.SaveChangesAsync(); } // 5. Device Credentials if (File.Exists(credsFile)) { var json = await File.ReadAllTextAsync(credsFile); var creds = JsonSerializer.Deserialize>(json) ?? new(); var usedCredInstIds = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var c in creds) { if (!await dbContext.DeviceCredentials.AnyAsync(existing => existing.DeviceId == c.DeviceId)) { if (!string.IsNullOrEmpty(c.InstallationId)) { if (usedCredInstIds.Contains(c.InstallationId) || await dbContext.DeviceCredentials.AnyAsync(existing => existing.InstallationId == c.InstallationId)) { c.InstallationId = $"{c.InstallationId}_dup_{c.DeviceId}"; } usedCredInstIds.Add(c.InstallationId); } dbContext.DeviceCredentials.Add(c); result.CredentialsCount++; } } await dbContext.SaveChangesAsync(); } // 6. Activation Codes if (File.Exists(codesFile)) { var json = await File.ReadAllTextAsync(codesFile); var codes = JsonSerializer.Deserialize>(json) ?? new(); foreach (var a in codes) { if (!await dbContext.ActivationCodes.AnyAsync(existing => existing.Code == a.Code)) { if (!await dbContext.Tenants.AnyAsync(t => t.Id == a.TenantId)) { dbContext.Tenants.Add(new Tenant { Id = a.TenantId, Name = a.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } dbContext.ActivationCodes.Add(a); result.ActivationCodesCount++; } } await dbContext.SaveChangesAsync(); } // 7. Notifications if (File.Exists(notifsFile)) { var json = await File.ReadAllTextAsync(notifsFile); var notifDtos = JsonSerializer.Deserialize>(json) ?? new(); var allDevices = await dbContext.Devices.ToListAsync(); foreach (var n in notifDtos) { if (!await dbContext.Notifications.AnyAsync(existing => existing.Id == n.Id)) { var notifEntity = new Notification { Id = n.Id, TenantId = n.TenantId, ClassroomId = n.ClassId, SenderName = string.IsNullOrWhiteSpace(n.SenderName) ? "系统" : n.SenderName, Message = n.Message, Title = "🔔 老师呼叫", Priority = string.IsNullOrWhiteSpace(n.Priority) ? "Normal" : n.Priority, CreatedAt = n.CreatedAt }; dbContext.Notifications.Add(notifEntity); result.NotificationsCount++; // Associate receipt if device exists in classroom var targetDev = allDevices.FirstOrDefault(d => d.TenantId == n.TenantId && d.ClassroomId == n.ClassId); if (targetDev != null) { var receipt = new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = n.Id, DeviceId = targetDev.Id, Status = string.IsNullOrWhiteSpace(n.Status) ? "Sent" : n.Status, DeviceReceivedAt = n.CreatedAt, DisplayedAt = n.CreatedAt, AcknowledgedAt = n.ConfirmedAt, UpdatedAt = n.ConfirmedAt ?? n.CreatedAt }; dbContext.NotificationReceipts.Add(receipt); } } } await dbContext.SaveChangesAsync(); } // Write Migration Marker var markerRecord = new MigrationMarker { Id = "JsonMigration_v1", MigratedAt = DateTimeOffset.UtcNow, Details = $"Successfully migrated Tenants={result.TenantsCount}, Classrooms={result.ClassroomsCount}, Users={result.UsersCount}, Devices={result.DevicesCount}, Credentials={result.CredentialsCount}, Codes={result.ActivationCodesCount}, Notifications={result.NotificationsCount}." }; dbContext.MigrationMarkers.Add(markerRecord); await dbContext.SaveChangesAsync(); await tx.CommitAsync(); result.Migrated = true; logger.LogInformation("JSON to PostgreSQL transaction committed successfully: {Details}", markerRecord.Details); // Move legacy JSON files to data/json-backup-YYYYMMDD-HHmmss/ var backupDir = Path.Combine(dataDir, $"json-backup-{DateTime.UtcNow:yyyyMMdd-HHmmss}"); Directory.CreateDirectory(backupDir); result.BackupPath = backupDir; string[] jsonFiles = { tenantsFile, classroomsFile, usersFile, devicesFile, credsFile, codesFile, notifsFile }; foreach (var file in jsonFiles) { if (File.Exists(file)) { var dest = Path.Combine(backupDir, Path.GetFileName(file)); File.Move(file, dest, overwrite: true); } } logger.LogInformation("Legacy JSON files safely moved to backup directory: {BackupDir}", backupDir); return result; } catch (Exception ex) { await tx.RollbackAsync(); logger.LogError(ex, "FATAL: JSON to PostgreSQL migration failed. Transaction rolled back, legacy JSON files preserved."); throw; } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260920225928_InitialPostgreSql.cs SIZE: 16966 chars SHA256: 6B86292AF4D316E6FD6E66D06E07D52AA1845A48759D81E47A69DDA3602CF4A6 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class InitialPostgreSql : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DeviceCredentials", columns: table => new { DeviceId = table.Column(type: "text", nullable: false), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceTokenHash = table.Column(type: "text", nullable: false), EncryptedRecoverableToken = table.Column(type: "text", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), RotatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DeviceCredentials", x => x.DeviceId); }); migrationBuilder.CreateTable( name: "MigrationMarkers", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), MigratedAt = table.Column(type: "timestamp with time zone", nullable: false), Details = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_MigrationMarkers", x => x.Id); }); migrationBuilder.CreateTable( name: "Tenants", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), IsActive = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tenants", x => x.Id); }); migrationBuilder.CreateTable( name: "ActivationCodes", columns: table => new { Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), IsUsed = table.Column(type: "boolean", nullable: false), UsedAt = table.Column(type: "timestamp with time zone", nullable: true), UsedByDeviceId = table.Column(type: "text", nullable: true), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ActivationCodes", x => x.Code); table.ForeignKey( name: "FK_ActivationCodes_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Classrooms", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), DisplayName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Grade = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), RoomNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Classrooms", x => new { x.TenantId, x.Id }); table.ForeignKey( name: "FK_Classrooms_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Notifications", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), SenderUserId = table.Column(type: "text", nullable: true), SenderName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Message = table.Column(type: "text", nullable: false), Title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), Priority = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Notifications", x => x.Id); table.ForeignKey( name: "FK_Notifications_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), Username = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), PasswordHash = table.Column(type: "text", nullable: false), FullName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Role = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); table.ForeignKey( name: "FK_Users_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Devices", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "text", nullable: false), DeviceTokenHash = table.Column(type: "text", nullable: false), RawDeviceToken = table.Column(type: "text", nullable: true), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), Hostname = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), LastHeartbeatAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Devices", x => x.Id); table.ForeignKey( name: "FK_Devices_Classrooms_TenantId_ClassroomId", columns: x => new { x.TenantId, x.ClassroomId }, principalTable: "Classrooms", principalColumns: new[] { "TenantId", "Id" }, onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Devices_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "NotificationReceipts", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), NotificationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), DeviceReceivedAt = table.Column(type: "timestamp with time zone", nullable: true), DisplayedAt = table.Column(type: "timestamp with time zone", nullable: true), AcknowledgedAt = table.Column(type: "timestamp with time zone", nullable: true), FailedAt = table.Column(type: "timestamp with time zone", nullable: true), FailureReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_NotificationReceipts", x => x.Id); table.ForeignKey( name: "FK_NotificationReceipts_Devices_DeviceId", column: x => x.DeviceId, principalTable: "Devices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_NotificationReceipts_Notifications_NotificationId", column: x => x.NotificationId, principalTable: "Notifications", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_ClassroomId", table: "ActivationCodes", column: "ClassroomId"); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_Code", table: "ActivationCodes", column: "Code", unique: true); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_InstallationId", table: "ActivationCodes", column: "InstallationId"); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_TenantId", table: "ActivationCodes", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Classrooms_TenantId_Id", table: "Classrooms", columns: new[] { "TenantId", "Id" }); migrationBuilder.CreateIndex( name: "IX_DeviceCredentials_DeviceId", table: "DeviceCredentials", column: "DeviceId", unique: true); migrationBuilder.CreateIndex( name: "IX_DeviceCredentials_InstallationId", table: "DeviceCredentials", column: "InstallationId", unique: true); migrationBuilder.CreateIndex( name: "IX_Devices_Id", table: "Devices", column: "Id", unique: true); migrationBuilder.CreateIndex( name: "IX_Devices_InstallationId", table: "Devices", column: "InstallationId", unique: true, filter: "\"InstallationId\" IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_Devices_TenantId", table: "Devices", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Devices_TenantId_ClassroomId", table: "Devices", columns: new[] { "TenantId", "ClassroomId" }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_DeviceId_UpdatedAt", table: "NotificationReceipts", columns: new[] { "DeviceId", "UpdatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_NotificationId_DeviceId", table: "NotificationReceipts", columns: new[] { "NotificationId", "DeviceId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Notifications_ClassroomId_CreatedAt", table: "Notifications", columns: new[] { "ClassroomId", "CreatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_Notifications_TenantId_CreatedAt", table: "Notifications", columns: new[] { "TenantId", "CreatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_Users_TenantId", table: "Users", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Users_Username", table: "Users", column: "Username", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ActivationCodes"); migrationBuilder.DropTable( name: "DeviceCredentials"); migrationBuilder.DropTable( name: "MigrationMarkers"); migrationBuilder.DropTable( name: "NotificationReceipts"); migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Devices"); migrationBuilder.DropTable( name: "Notifications"); migrationBuilder.DropTable( name: "Classrooms"); migrationBuilder.DropTable( name: "Tenants"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260920225928_InitialPostgreSql.Designer.cs SIZE: 18154 chars SHA256: 5F471E0B59753E2DC1EA0658AA66928AEDB93E00C29B5534DDF13219B261A9AD ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260920225928_InitialPostgreSql")] partial class InitialPostgreSql { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("Id") .IsUnique(); b.HasIndex("InstallationId") .IsUnique() .HasFilter("\"InstallationId\" IS NOT NULL"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredentialRecord", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("DeviceId") .IsUnique(); b.HasIndex("InstallationId") .IsUnique(); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922000000_AddNotificationExpiresAtAndPendingIndex.cs SIZE: 2830 chars SHA256: 6E8631EC9A2EB772CA38EF8729A30337BB2E6D4DB64E1E4C7AE241796FA13AA2 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddNotificationExpiresAtAndPendingIndex : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ExpiresAt", table: "Notifications", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "Voice", table: "Notifications", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "Shake", table: "Notifications", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "DurationSeconds", table: "Notifications", type: "integer", nullable: false, defaultValue: 15); migrationBuilder.CreateIndex( name: "IX_Notifications_TenantId_ClassroomId_ExpiresAt", table: "Notifications", columns: new[] { "TenantId", "ClassroomId", "ExpiresAt" }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_DeviceId_Status", table: "NotificationReceipts", columns: new[] { "DeviceId", "Status" }); // P1 Batch 9: Backfill legacy notifications where ExpiresAt IS NULL to CreatedAt (marking them expired) migrationBuilder.Sql("UPDATE \"Notifications\" SET \"ExpiresAt\" = \"CreatedAt\" WHERE \"ExpiresAt\" IS NULL;"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_NotificationReceipts_DeviceId_Status", table: "NotificationReceipts"); migrationBuilder.DropIndex( name: "IX_Notifications_TenantId_ClassroomId_ExpiresAt", table: "Notifications"); migrationBuilder.DropColumn( name: "DurationSeconds", table: "Notifications"); migrationBuilder.DropColumn( name: "Shake", table: "Notifications"); migrationBuilder.DropColumn( name: "Voice", table: "Notifications"); migrationBuilder.DropColumn( name: "ExpiresAt", table: "Notifications"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922000000_AddNotificationExpiresAtAndPendingIndex.Designer.cs SIZE: 18273 chars SHA256: 5E983634C9ABC1D5BBBD8573EC78B2DD2735AE942CFA641CCF5CC4E3D3C0BAB4 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922000000_AddNotificationExpiresAtAndPendingIndex")] partial class AddNotificationExpiresAtAndPendingIndex { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("Id") .IsUnique(); b.HasIndex("InstallationId") .IsUnique() .HasFilter("\"InstallationId\" IS NOT NULL"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredentialRecord", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("DeviceId") .IsUnique(); b.HasIndex("InstallationId") .IsUnique(); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922120000_AddDeviceCommandsTable.cs SIZE: 3612 chars SHA256: 9CBA69DCB618D010A536ABDE04CF5F7A57A4E78D92650ECB1CF5E72A32A80569 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddDeviceCommandsTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DeviceCommands", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), TenantId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), CommandType = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Parameters = table.Column(type: "text", nullable: true), CreatedBy = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: true), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), ResultCode = table.Column(type: "integer", nullable: true), ResultMessage = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_DeviceCommands", x => x.Id); table.ForeignKey( name: "FK_DeviceCommands_Devices_DeviceId", column: x => x.DeviceId, principalTable: "Devices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DeviceCommands_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_DeviceId_Status", table: "DeviceCommands", columns: new[] { "DeviceId", "Status" }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_Status_ExpiresAt", table: "DeviceCommands", columns: new[] { "Status", "ExpiresAt" }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_TenantId_DeviceId_CreatedAt", table: "DeviceCommands", columns: new[] { "TenantId", "DeviceId", "CreatedAt" }, descending: new[] { false, false, true }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DeviceCommands"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922120000_AddDeviceCommandsTable.Designer.cs SIZE: 21209 chars SHA256: 2C2A7E2F82D8CEDFC2A527AF88D17B3602252C0787786E0E64BB0C9B3D6EFCA6 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922120000_AddDeviceCommandsTable")] partial class AddDeviceCommandsTable { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("InstallationId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.cs SIZE: 760 chars SHA256: C99935F743ACF18D16B28ED88687FE9D339693F50BE553EC7BF4B11C0DBF67FC ===================================================================== */ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddDeviceCommandDurationMs : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "DurationMs", table: "DeviceCommands", type: "bigint", nullable: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "DurationMs", table: "DeviceCommands"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.Designer.cs SIZE: 22590 chars SHA256: 118F61890CE5578A02B9E83E07930ED96FB030B4C4705C093D1776CA5C5CABBB ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922130000_AddDeviceCommandDurationMs")] partial class AddDeviceCommandDurationMs { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("Id") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CurrentIp") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("DeviceTokenHash") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Hostname") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("LastHeartbeat") .HasColumnType("timestamp with time zone"); b.Property("OnlineState") .IsRequired() .HasMaxLength(20) .HasColumnType("character varying(20)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("ClassroomId"); b.HasIndex("DeviceTokenHash") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DurationMs") .HasColumnType("bigint"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("EncryptedToken") .IsRequired() .HasColumnType("text"); b.Property("LastRotatedAt") .HasColumnType("timestamp with time zone"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("DeviceId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("character varying(100)"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.RateLimitAuditLog", b => { b.Property("Id") .HasColumnType("text"); b.Property("Action") .IsRequired() .HasColumnType("text"); b.Property("ClientIp") .IsRequired() .HasColumnType("text"); b.Property("Endpoint") .IsRequired() .HasColumnType("text"); b.Property("Reason") .IsRequired() .HasColumnType("text"); b.Property("TenantId") .HasColumnType("text"); b.Property("Timestamp") .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("text"); b.HasKey("Id"); b.ToTable("RateLimitAuditLogs"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Plan") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Username") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("Id"); b.HasIndex("TenantId", "Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", null) .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("ClassroomId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/ClassNotifyDbContextModelSnapshot.cs SIZE: 21208 chars SHA256: 4E911D269F138304C86D4CE0BFDF19582D2A7560482684F50AF5CEE8756027E3 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] public partial class ClassNotifyDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DurationMs") .HasColumnType("bigint"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("InstallationId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Domain/Entities/Entities.cs SIZE: 10654 chars SHA256: 7F7CD512D1D21494F0BD9BB3A5059011E5D783504706C259FA9781844939DAD3 ===================================================================== */ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace ClassNotify.Server.Domain.Entities; /// /// 学校/机构租户实体 /// public class Tenant { [Key] public string Id { get; set; } = string.Empty; // e.g. "t_beijing_no4" public string Name { get; set; } = string.Empty; // e.g. "北京四中" public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public ICollection Classrooms { get; set; } = new List(); public ICollection Users { get; set; } = new List(); public ICollection Devices { get; set; } = new List(); public ICollection ActivationCodes { get; set; } = new List(); public ICollection Notifications { get; set; } = new List(); } /// /// 教师/管理员用户实体 /// public class User { [Key] public string Id { get; set; } = string.Empty; // e.g. "usr_1001" public string TenantId { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string PasswordHash { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; [NotMapped] public string DisplayName => FullName; public string Role { get; set; } = "Teacher"; // Teacher, SchoolAdmin, SuperAdmin public bool IsLocked { get; set; } = false; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? LastLoginAt { get; set; } public int TokenVersion { get; set; } = 1; public Tenant? Tenant { get; set; } } /// /// 班级实体 /// public class Classroom { public string Id { get; set; } = string.Empty; // e.g. "cls_801" public string TenantId { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; // e.g. "八年级(1)班" public string? Grade { get; set; } public string? RoomNumber { get; set; } public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public Tenant? Tenant { get; set; } public ICollection Devices { get; set; } = new List(); } /// /// 教室硬件多媒体设备实体 /// public class Device { [Key] public string Id { get; set; } = string.Empty; // e.g. "dev_52f0" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string DeviceTokenHash { get; set; } = string.Empty; public string? RawDeviceToken { get; set; } // Kept only for legacy migration public string? InstallationId { get; set; } // Unique installation instance identifier public string? Hostname { get; set; } public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? LastHeartbeatAt { get; set; } public Tenant? Tenant { get; set; } public Classroom? Classroom { get; set; } public ICollection Receipts { get; set; } = new List(); } /// /// 设备加密凭据恢复记录 (仅用于 InstallationId 幂等恢复,不直接在业务代码暴露明文) /// public class DeviceCredentialRecord { [Key] public string DeviceId { get; set; } = string.Empty; public string InstallationId { get; set; } = string.Empty; public string DeviceTokenHash { get; set; } = string.Empty; public string EncryptedRecoverableToken { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? RotatedAt { get; set; } } /// /// 一次性设备激活码实体 /// public class ActivationCode { [Key] public string Code { get; set; } = string.Empty; // e.g. "H8K4-29DP" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } = DateTimeOffset.UtcNow.AddDays(7); public bool IsUsed { get; set; } public DateTimeOffset? UsedAt { get; set; } public string? UsedByDeviceId { get; set; } public string? InstallationId { get; set; } // Bound to first installation instance public Tenant? Tenant { get; set; } } /// /// 教师/系统下发通知主表 (不存储单一设备 ACK 状态) /// public class Notification { [Key] public string Id { get; set; } = string.Empty; // e.g. "msg_1789944446934_0471" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string? SenderUserId { get; set; } public string SenderName { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public string Title { get; set; } = "🔔 老师呼叫"; public string Priority { get; set; } = "Normal"; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? ExpiresAt { get; set; } public bool Voice { get; set; } = true; public bool Shake { get; set; } = true; public int DurationSeconds { get; set; } = 15; public bool IsCancelled { get; set; } = false; public DateTimeOffset? CancelledAt { get; set; } public string? CancelledBy { get; set; } public string? BroadcastId { get; set; } public Tenant? Tenant { get; set; } public ICollection Receipts { get; set; } = new List(); } /// /// 设备通知回执明细表 (按设备独立记录状态与时间线,防止单点覆盖) /// public class NotificationReceipt { [Key] public string Id { get; set; } = string.Empty; // e.g. "rcpt_..." public string NotificationId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; /// /// 回执阶段状态: Sent, DeviceReceived, Displayed, Acknowledged, Failed, Timeout /// public string Status { get; set; } = "Sent"; public DateTimeOffset? DeviceReceivedAt { get; set; } public DateTimeOffset? DisplayedAt { get; set; } public DateTimeOffset? AcknowledgedAt { get; set; } public DateTimeOffset? FailedAt { get; set; } public string? FailureReason { get; set; } /// /// 视觉回执状态: None, Available, Expired /// public string VisualReceiptState { get; set; } = "None"; public string? VisualReceiptPath { get; set; } public DateTimeOffset? VisualReceiptCapturedAt { get; set; } public DateTimeOffset? VisualReceiptExpiresAt { get; set; } public long? VisualReceiptSizeBytes { get; set; } public string? VisualReceiptSha256 { get; set; } public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow; public Notification? Notification { get; set; } public Device? Device { get; set; } } /// /// JSON 数据一次性迁移记录标记 /// public class MigrationMarker { [Key] public string Id { get; set; } = string.Empty; // e.g. "JsonMigration_v1" public DateTimeOffset MigratedAt { get; set; } = DateTimeOffset.UtcNow; public string? Details { get; set; } } /// /// 教室终端受控远程运维命令实体 /// 全链路统一 CommandId (cmd_xxxxx),从创建到最终上报不可篡改 /// public class DeviceCommand { [Key] public string Id { get; set; } = string.Empty; // e.g. "cmd_..." [Required] public string TenantId { get; set; } = string.Empty; [Required] public string DeviceId { get; set; } = string.Empty; [Required] public string CommandType { get; set; } = string.Empty; // "SelfCheck", "RestartClient", "Reconnect", "RefreshConfig" public string? Parameters { get; set; } [Required] public string CreatedBy { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset ExpiresAt { get; set; } public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? CompletedAt { get; set; } [Required] public string Status { get; set; } = "Pending"; // "Pending", "Dispatched", "Succeeded", "Failed", "TimedOut", "Expired" public int? ResultCode { get; set; } public long? DurationMs { get; set; } public string? ResultMessage { get; set; } public Tenant? Tenant { get; set; } public Device? Device { get; set; } } /// /// 全局唯一远程命令超期与超时状态终态化规则 /// 彻底消除各查询路径与后台 Worker 之间的状态竞态 /// public static class DeviceCommandNormalizer { public static bool NormalizeExpiredOrTimedOut(DeviceCommand cmd, DateTimeOffset now) { if (ClassNotify.Shared.Models.DeviceCommandStatuses.IsTerminal(cmd.Status)) { return false; } if (cmd.Status == ClassNotify.Shared.Models.DeviceCommandStatuses.Pending) { if (cmd.ExpiresAt <= now) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.Expired; cmd.CompletedAt = now; cmd.ResultCode = -2; cmd.ResultMessage = "Command pending expired before dispatch or device reconnect."; return true; } } else if (cmd.Status == ClassNotify.Shared.Models.DeviceCommandStatuses.Dispatched) { var dispatchedAt = cmd.StartedAt ?? cmd.CreatedAt; if (cmd.ExpiresAt <= now) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.TimedOut; cmd.CompletedAt = now; cmd.ResultCode = -4; cmd.ResultMessage = "Command expired after dispatch without device result."; return true; } else if (now - dispatchedAt >= TimeSpan.FromMinutes(2)) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.TimedOut; cmd.CompletedAt = now; cmd.ResultCode = -4; cmd.ResultMessage = "Command timed out (device did not report execution result within 2 minutes)."; return true; } } return false; } } /// /// 管理员操作审计事件实体 /// public class AdminAuditEvent { [Key] public string Id { get; set; } = string.Empty; public DateTimeOffset OccurredAt { get; set; } = DateTimeOffset.UtcNow; public string ActorUsername { get; set; } = string.Empty; public string ActorRole { get; set; } = string.Empty; public string Action { get; set; } = string.Empty; public string TargetType { get; set; } = string.Empty; public string TargetId { get; set; } = string.Empty; public string? Details { get; set; } public string? IpAddress { get; set; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Hubs/DeviceHub.cs SIZE: 13008 chars SHA256: BA46DBD2277935E6AE92651FB34294D07A4CF64D066D4A38D60A9FE489DC1B6F ===================================================================== */ using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Hubs; public class DeviceHub : Hub { private readonly ILogger _logger; private readonly IHubContext _teacherHub; private readonly ISecurityService _securityService; // Track active connection -> { TenantId, ClassroomId, DeviceId } private static readonly Dictionary _connectionTenantMap = new(); public DeviceHub( ILogger logger, IHubContext teacherHub, ISecurityService securityService) { _logger = logger; _teacherHub = teacherHub; _securityService = securityService; } public override async Task OnConnectedAsync() { var httpContext = Context.GetHttpContext(); var deviceId = httpContext?.Request.Headers["X-Device-Id"].FirstOrDefault() ?? httpContext?.Request.Query["device_id"].FirstOrDefault(); var deviceToken = httpContext?.Request.Headers["X-Device-Token"].FirstOrDefault() ?? httpContext?.Request.Query["device_token"].FirstOrDefault(); var clientVersion = httpContext?.Request.Headers["X-Client-Version"].FirstOrDefault() ?? "2.1.0"; var remoteIp = httpContext?.Connection.RemoteIpAddress?.ToString() ?? "127.0.0.1"; if (string.IsNullOrEmpty(deviceId) || string.IsNullOrEmpty(deviceToken)) { _logger.LogWarning("Rejecting unauthorized device connection {ConnId}: Missing device credentials.", Context.ConnectionId); Context.Abort(); return; } var device = await _securityService.ValidateDeviceAsync(deviceId, deviceToken); if (device == null) { _logger.LogWarning("Rejecting unauthorized device connection {ConnId}: Invalid device ID or token ({DeviceId}).", Context.ConnectionId, deviceId); Context.Abort(); return; } // Add to Tenant-Isolated Group var tenantClassGroup = $"t:{device.TenantId}:c:{device.ClassroomId}"; await Groups.AddToGroupAsync(Context.ConnectionId, tenantClassGroup); lock (_connectionTenantMap) { _connectionTenantMap[Context.ConnectionId] = (device.TenantId, device.ClassroomId, device.Id); } // Register in SecurityService Live Registry var regResult = await _securityService.RegisterDeviceConnectionAsync( Context.ConnectionId, device.Id, device.TenantId, device.ClassroomId, device.Hostname, remoteIp, clientVersion); if (!string.IsNullOrEmpty(regResult.ReplacedConnectionId) && regResult.ReplacedConnectionId != Context.ConnectionId) { await Groups.RemoveFromGroupAsync(regResult.ReplacedConnectionId, tenantClassGroup); _logger.LogInformation("Removed replaced connection {OldConnId} from class group {Group}; current connection is {NewConnId}", regResult.ReplacedConnectionId, tenantClassGroup, Context.ConnectionId); } _logger.LogInformation("Device {DeviceId} authenticated successfully. Joined group {Group} at {ConnId}", device.Id, tenantClassGroup, Context.ConnectionId); // Notify teachers of THIS tenant var classroom = await _securityService.GetClassroomAsync(device.TenantId, device.ClassroomId); var status = new DeviceStatusDto { DeviceId = device.Id, ClassId = device.ClassroomId, ClassName = classroom?.DisplayName ?? device.ClassroomId, Hostname = device.Hostname ?? "Classroom-PC", State = DeviceOnlineState.Online, LastHeartbeat = DateTimeOffset.UtcNow, AgentVersion = clientVersion }; await _teacherHub.Clients.Group($"t:{device.TenantId}:teachers").OnDeviceStatusChanged(status); await base.OnConnectedAsync(); // P1 Batch 9: Catch-up pending notifications for this reconnected device (Caller unicast only) try { var pendingNotifications = await _securityService.GetPendingNotificationsForDeviceAsync(device.Id); if (pendingNotifications.Count > 0) { _logger.LogInformation("Device {DeviceId} connected with {Count} pending notification(s) to catch up.", device.Id, pendingNotifications.Count); foreach (var pending in pendingNotifications) { await Clients.Caller.ReceiveNotification(pending); } } } catch (Exception ex) { _logger.LogError(ex, "Error catching up pending notifications for Device {DeviceId}", device.Id); } // P1 Batch 10: Catch-up pending commands for this reconnected device (Caller unicast only) try { var pendingCommands = await _securityService.GetPendingCommandsForDeviceAsync(device.Id); if (pendingCommands.Count > 0) { _logger.LogInformation("Device {DeviceId} connected with {Count} pending command(s) to catch up.", device.Id, pendingCommands.Count); foreach (var pendingCmd in pendingCommands) { await Clients.Caller.ReceiveRemoteCommand(pendingCmd); await _securityService.MarkCommandDispatchedAsync(pendingCmd.CommandId); } } } catch (Exception ex) { _logger.LogError(ex, "Error catching up pending commands for Device {DeviceId}", device.Id); } } public async Task SendAckReceipt(AckReceiptDto ack) { string? tenantId = null; string? classroomId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; classroomId = info.ClassroomId; deviceId = info.DeviceId; } } if (tenantId == null || classroomId == null || deviceId == null) { _logger.LogWarning("Rejecting ACK from unauthenticated connection {ConnId}", Context.ConnectionId); return; } // Must be current connection for this device if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale ACK from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // P0-11: Enforce device ACK attribution validation. // Force ClassId to match the connection's authenticated classroom (never trust client-supplied ClassId). ack.ClassId = classroomId; // Verify that this notification was actually sent to this tenant and classroom if (!await _securityService.ValidateNotificationTargetAsync(ack.MessageId, tenantId, classroomId)) { _logger.LogWarning("Spoofed or unknown ACK rejected: Message {MsgId} does not match Tenant {TenantId}, Class {ClassId} (Device {DeviceId})", ack.MessageId, tenantId, classroomId, deviceId); return; } _logger.LogInformation("ACK validated from Tenant {TenantId}, Class {ClassId} (Device {DeviceId}): Message {MsgId} -> {Status}", tenantId, classroomId, deviceId, ack.MessageId, ack.Status); // Record ACK in history (NotificationReceipt per device) await _securityService.RecordAckAsync(ack.MessageId, deviceId, ack); // Relay ONLY to teachers belonging to THIS tenant! await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnAckReceiptReceived(ack); } public async Task ReportCommandResult(DeviceCommandResultDto result) { string? tenantId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; deviceId = info.DeviceId; } } if (tenantId == null || deviceId == null) { _logger.LogWarning("Rejecting command result from unauthenticated connection {ConnId}", Context.ConnectionId); return; } if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale command result from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // Security enforcement: force DeviceId from authenticated connection! result.DeviceId = deviceId; var recorded = await _securityService.RecordCommandResultAsync(result, deviceId, tenantId); if (recorded != null) { // Relay to teachers and administrators of THIS tenant! await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnDeviceCommandStatusChanged(recorded); } } public async Task SendHealthReport(DeviceHealthReportDto report) { string? tenantId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; deviceId = info.DeviceId; } } if (tenantId == null || deviceId == null) return; if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale health report from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // Security requirement: Force DeviceId from authenticated connection! report.DeviceId = deviceId; await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnHealthReportReceived(report); } public async Task SendHeartbeat(string classId) { string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { deviceId = info.DeviceId; } } if (deviceId == null) { _logger.LogWarning("Rejecting heartbeat from unauthenticated connection {ConnId}", Context.ConnectionId); return; } if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale heartbeat from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } await _securityService.UpdateDeviceHeartbeatAsync(Context.ConnectionId); _logger.LogDebug("Received heartbeat from Device {DeviceId} ({ConnId})", deviceId, Context.ConnectionId); } public override async Task OnDisconnectedAsync(Exception? exception) { string? tenantId = null; string? classId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; classId = info.ClassroomId; deviceId = info.DeviceId; _connectionTenantMap.Remove(Context.ConnectionId); } } var isCurrentDisconnected = await _securityService.UnregisterDeviceConnectionAsync(Context.ConnectionId); if (tenantId != null && classId != null && deviceId != null) { if (isCurrentDisconnected) { _logger.LogInformation("Device {DeviceId} disconnected for Tenant {TenantId}, Class {ClassId}", deviceId, tenantId, classId); var status = new DeviceStatusDto { DeviceId = deviceId, ClassId = classId, State = DeviceOnlineState.Offline, LastHeartbeat = DateTimeOffset.UtcNow }; await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnDeviceStatusChanged(status); } else { _logger.LogInformation("Stale connection {ConnId} disconnected for Device {DeviceId} (Tenant {TenantId}, Class {ClassId}); device is still active on newer connection. Skipping Offline status broadcast.", Context.ConnectionId, deviceId, tenantId, classId); } } await base.OnDisconnectedAsync(exception); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Hubs/TeacherHub.cs SIZE: 1332 chars SHA256: F45E2F8C1F620B9FEF0487E3CBBE7FAE7569D4C9F99EBF23EF95D61B587A4AC7 ===================================================================== */ using System.Security.Claims; using ClassNotify.Shared.Contracts; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Hubs; /// /// 教师端 SignalR Hub (强制 JWT 认证,基于 TenantId 强隔离事件流) /// [Authorize] public class TeacherHub : Hub { private readonly ILogger _logger; public TeacherHub(ILogger logger) { _logger = logger; } public override async Task OnConnectedAsync() { var tenantId = Context.User?.FindFirst("tenant_id")?.Value; var teacherName = Context.User?.FindFirst(ClaimTypes.Name)?.Value ?? "教师"; if (string.IsNullOrEmpty(tenantId)) { _logger.LogWarning("Rejecting teacher connection {ConnId}: Missing tenant_id claim.", Context.ConnectionId); Context.Abort(); return; } // Join tenant-specific teacher event channel var tenantTeacherGroup = $"t:{tenantId}:teachers"; await Groups.AddToGroupAsync(Context.ConnectionId, tenantTeacherGroup); _logger.LogInformation("Teacher {TeacherName} connected to SignalR Hub. Joined group {Group} at {ConnId}", teacherName, tenantTeacherGroup, Context.ConnectionId); await base.OnConnectedAsync(); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Program.cs SIZE: 14398 chars SHA256: 047B98E937390B13E8381BAF6FD9CFC2F4C0605C2DB2984A57C1CFCA8AAE7A63 ===================================================================== */ using System.Net; using System.Security.Claims; using System.Text; using System.Threading.RateLimiting; using ClassNotify.Server.Configuration; using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.RateLimiting; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using Microsoft.Extensions.Options; using Serilog; Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Console() .CreateLogger(); try { var builder = WebApplication.CreateBuilder(args); builder.Host.UseSerilog(); builder.Services.AddControllers(); builder.Services.AddSignalR(); // 1. PostgreSQL EF Core DbContext var defaultConn = builder.Configuration.GetConnectionString("DefaultConnection") ?? Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection") ?? "Host=127.0.0.1;Port=5432;Database=classnotify;Username=classnotify;Password=CHANGEME_DEV;"; builder.Services.AddDbContext(options => { options.UseNpgsql(defaultConn); }); // 2. Data Protection for Encrypted Recoverable Device Tokens var keysPath = OperatingSystem.IsLinux() ? "/var/lib/classnotify/keys" : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ClassNotify", "keys"); if (!Directory.Exists(keysPath)) { Directory.CreateDirectory(keysPath); } builder.Services.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(keysPath)) .SetApplicationName("ClassNotify"); // 3. ASP.NET Core PasswordHasher builder.Services.AddSingleton, PasswordHasher>(); // 4. JWT Options Binding & Strict Production Guard builder.Services.Configure(builder.Configuration.GetSection("Jwt")); var jwtOptions = builder.Configuration.GetSection("Jwt").Get() ?? new JwtOptions(); if (builder.Environment.IsProduction()) { if (string.IsNullOrWhiteSpace(jwtOptions.SigningKey) || Encoding.UTF8.GetByteCount(jwtOptions.SigningKey) < 64) { throw new InvalidOperationException("Production Guard: Jwt__SigningKey is missing or has insufficient length (minimum 64 bytes required in Production). Refusing to start."); } if (string.IsNullOrWhiteSpace(jwtOptions.Issuer)) { throw new InvalidOperationException("Production Guard: Jwt__Issuer is missing. Refusing to start."); } if (string.IsNullOrWhiteSpace(jwtOptions.Audience)) { throw new InvalidOperationException("Production Guard: Jwt__Audience is missing. Refusing to start."); } } else { // Non-production fallback for design-time / local dev if unconfigured if (string.IsNullOrWhiteSpace(jwtOptions.SigningKey) || Encoding.UTF8.GetByteCount(jwtOptions.SigningKey) < 32) { jwtOptions.SigningKey = "DEV_ONLY_INSECURE_SIGNING_KEY_FOR_LOCAL_TESTING_PURPOSES_ONLY_MIN_64_BYTES_LONG_!"; } if (string.IsNullOrWhiteSpace(jwtOptions.Issuer)) jwtOptions.Issuer = "ClassNotify.Server"; if (string.IsNullOrWhiteSpace(jwtOptions.Audience)) jwtOptions.Audience = "ClassNotify.Clients"; } builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddHostedService(); builder.Services.AddHostedService(); // 5. JWT Authentication with Strict Validation builder.Services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { // Support SignalR query string token for WebSocket connections options.Events = new JwtBearerEvents { OnMessageReceived = context => { var accessToken = context.Request.Query["access_token"]; var path = context.HttpContext.Request.Path; if (!string.IsNullOrEmpty(accessToken) && (path.StartsWithSegments("/hubs/teacher") || path.StartsWithSegments("/hubs/device"))) { context.Token = accessToken; } return Task.CompletedTask; }, OnTokenValidated = async context => { var userId = context.Principal?.FindFirst(ClaimTypes.NameIdentifier)?.Value; var tenantId = context.Principal?.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(userId)) { context.Fail("Invalid token claims: missing NameIdentifier."); return; } var dbContext = context.HttpContext.RequestServices.GetRequiredService(); var user = await dbContext.Users.AsNoTracking().FirstOrDefaultAsync(u => u.Id == userId); if (user == null || user.IsLocked) { context.Fail("User account has been locked or deactivated."); return; } var tokenVersionClaim = context.Principal?.FindFirst("token_version")?.Value; if (string.IsNullOrWhiteSpace(tokenVersionClaim) || !int.TryParse(tokenVersionClaim, out var tokenVersion)) { context.Fail("Invalid token claims: missing or invalid token_version (fail-closed against legacy tokens)."); return; } if (user.TokenVersion != tokenVersion) { context.Fail("Token has been revoked due to security event or password reset."); return; } if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { var tenant = await dbContext.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { context.Fail("Tenant is inactive or suspended."); return; } } } }; }); builder.Services.AddOptions(JwtBearerDefaults.AuthenticationScheme) .Configure>((options, jwtOptAccessor) => { var currentJwt = jwtOptAccessor.Value; var keyStr = currentJwt.SigningKey; if (string.IsNullOrWhiteSpace(keyStr) || Encoding.UTF8.GetByteCount(keyStr) < 32) { keyStr = "DEV_ONLY_INSECURE_SIGNING_KEY_FOR_LOCAL_TESTING_PURPOSES_ONLY_MIN_64_BYTES_LONG_!"; } var iss = !string.IsNullOrWhiteSpace(currentJwt.Issuer) ? currentJwt.Issuer : "ClassNotify.Server"; var aud = !string.IsNullOrWhiteSpace(currentJwt.Audience) ? currentJwt.Audience : "ClassNotify.Clients"; options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = iss, ValidAudience = aud, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(keyStr)), ClockSkew = TimeSpan.FromMinutes(1) }; }); builder.Services.AddAuthorization(); // 6. Partitioned Rate Limiting (按来源分区,避免全局限流瓶颈) builder.Services.Configure(builder.Configuration.GetSection("RateLimit")); builder.Services.AddRateLimiter(options => { options.RejectionStatusCode = StatusCodes.Status429TooManyRequests; // AuthLimiter: requests / minute / IP options.AddPolicy("AuthLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var remoteIp = httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"; return RateLimitPartition.GetFixedWindowLimiter(remoteIp, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.AuthPermitLimit > 0 ? rateOpts.AuthPermitLimit : 60, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); // ActivationLimiter: requests / minute / IP options.AddPolicy("ActivationLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var remoteIp = httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"; return RateLimitPartition.GetFixedWindowLimiter(remoteIp, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.ActivationPermitLimit > 0 ? rateOpts.ActivationPermitLimit : 30, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); // SendLimiter: notifications / minute / user (fallback to IP) options.AddPolicy("SendLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var userId = httpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var partitionKey = !string.IsNullOrEmpty(userId) ? $"user_{userId}" : $"ip_{httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"}"; return RateLimitPartition.GetFixedWindowLimiter(partitionKey, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.SendPermitLimit > 0 ? rateOpts.SendPermitLimit : 120, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); }); // 7. CORS Hardening (Production strictly allows official domain only) builder.Services.AddCors(options => { options.AddPolicy("CorsPolicy", policy => { if (builder.Environment.IsDevelopment()) { policy.WithOrigins("http://localhost:5173", "http://127.0.0.1:5173") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } else { policy.WithOrigins("https://classnotify.paradise.eu.org") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } }); }); // 6. Forwarded Headers for Linux reverse proxy (Caddy / Nginx) // Only trust loopback reverse proxy (Caddy on same host) with ForwardLimit = 1 builder.Services.Configure(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; options.KnownNetworks.Clear(); options.KnownProxies.Clear(); options.KnownProxies.Add(IPAddress.Loopback); options.KnownProxies.Add(IPAddress.IPv6Loopback); options.ForwardLimit = 1; }); var app = builder.Build(); app.UseForwardedHeaders(); // Database Initialization & One-Time JSON Migration using (var scope = app.Services.CreateScope()) { var db = scope.ServiceProvider.GetRequiredService(); try { if (db.Database.IsRelational()) { await db.Database.MigrateAsync(); } await DbInitializer.InitializeAsync(db, app.Environment, app.Configuration, app.Logger); await JsonMigrationService.MigrateAsync(db, null, app.Logger); } catch (Exception ex) { app.Logger.LogError(ex, "Error during database initialization or JSON migration."); throw; } } // Serve React SPA static files from wwwroot app.UseDefaultFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.UseRateLimiter(); app.MapControllers(); app.MapHub("/hubs/device"); app.MapHub("/hubs/teacher"); // Dedicated Real PostgreSQL Health Check Endpoint app.MapGet("/api/health", async (ClassNotifyDbContext dbContext) => { bool dbOk = false; string? dbError = null; try { using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); dbOk = await dbContext.Database.CanConnectAsync(cts.Token); if (dbOk) { await dbContext.Database.ExecuteSqlRawAsync("SELECT 1", cts.Token); } } catch (Exception ex) { dbError = ex.Message; } var status = dbOk ? "Healthy" : "Degraded"; var result = new { service = "ClassNotify Commercial Server (ASP.NET Core on Linux)", version = "2.1.0", status = status, database = dbOk ? "Connected" : "Disconnected", databaseError = dbError, hubs = new[] { "/hubs/device", "/hubs/teacher" } }; return dbOk ? Results.Ok(result) : Results.Json(result, statusCode: 503); }); // Fallback to index.html for React SPA client-side routing app.MapFallbackToFile("index.html"); app.Run(); } catch (Exception ex) { Log.Fatal(ex, "ClassNotify Server terminated unexpectedly."); } finally { Log.CloseAndFlush(); } namespace ClassNotify.Server { public partial class Program { } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/ClassNotify.Server.deps.json SIZE: 40299 chars SHA256: F5267BB0E4D1BFEFE0D0216896698D4CF762C69B5155222FE8AAFB0B8C619A26 ===================================================================== */ { "runtimeTarget": { "name": ".NETCoreApp,Version=v8.0", "signature": "" }, "compilationOptions": {}, "targets": { ".NETCoreApp,Version=v8.0": { "ClassNotify.Server/1.0.0": { "dependencies": { "ClassNotify.Shared": "1.0.0", "Microsoft.AspNetCore.Authentication.JwtBearer": "8.0.0", "Microsoft.AspNetCore.SignalR.Common": "8.0.0", "Microsoft.EntityFrameworkCore.Design": "8.0.0", "Npgsql.EntityFrameworkCore.PostgreSQL": "8.0.0", "Serilog.AspNetCore": "8.0.0", "Serilog.Sinks.Console": "5.0.0", "Serilog.Sinks.File": "5.0.0" }, "runtime": { "ClassNotify.Server.dll": {} } }, "Humanizer.Core/2.14.1": {}, "Microsoft.AspNetCore.Authentication.JwtBearer/8.0.0": { "dependencies": { "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53112" } } }, "Microsoft.AspNetCore.Connections.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Features": "8.0.0", "System.IO.Pipelines": "8.0.0" } }, "Microsoft.AspNetCore.SignalR.Common/8.0.0": { "dependencies": { "Microsoft.AspNetCore.Connections.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0" } }, "Microsoft.Bcl.AsyncInterfaces/6.0.0": {}, "Microsoft.CodeAnalysis.Analyzers/3.3.3": {}, "Microsoft.CodeAnalysis.Common/4.5.0": { "dependencies": { "Microsoft.CodeAnalysis.Analyzers": "3.3.3", "System.Collections.Immutable": "6.0.0", "System.Reflection.Metadata": "6.0.1", "System.Runtime.CompilerServices.Unsafe": "6.0.0", "System.Text.Encoding.CodePages": "6.0.0" } }, "Microsoft.CodeAnalysis.CSharp/4.5.0": { "dependencies": { "Microsoft.CodeAnalysis.Common": "4.5.0" } }, "Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.CodeAnalysis.CSharp": "4.5.0", "Microsoft.CodeAnalysis.Common": "4.5.0", "Microsoft.CodeAnalysis.Workspaces.Common": "4.5.0" } }, "Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.Bcl.AsyncInterfaces": "6.0.0", "Microsoft.CodeAnalysis.Common": "4.5.0", "System.Composition": "6.0.0", "System.IO.Pipelines": "8.0.0", "System.Threading.Channels": "6.0.0" } }, "Microsoft.EntityFrameworkCore/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore.Abstractions": "8.0.0", "Microsoft.EntityFrameworkCore.Analyzers": "8.0.0", "Microsoft.Extensions.Caching.Memory": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.EntityFrameworkCore.Abstractions/8.0.0": { "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.Abstractions.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.EntityFrameworkCore.Analyzers/8.0.0": {}, "Microsoft.EntityFrameworkCore.Design/8.0.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.5.0", "Microsoft.EntityFrameworkCore.Relational": "8.0.0", "Microsoft.Extensions.DependencyModel": "8.0.0", "Mono.TextTemplating": "2.2.1" } }, "Microsoft.EntityFrameworkCore.Relational/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.0", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.Relational.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.Extensions.Caching.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Caching.Memory/8.0.0": { "dependencies": { "Microsoft.Extensions.Caching.Abstractions": "8.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0", "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Configuration.Binder/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" } }, "Microsoft.Extensions.DependencyInjection/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": {}, "Microsoft.Extensions.DependencyModel/8.0.0": { "dependencies": { "System.Text.Encodings.Web": "8.0.0", "System.Text.Json": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.Extensions.DependencyModel.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0", "System.Diagnostics.DiagnosticSource": "8.0.0" } }, "Microsoft.Extensions.Features/8.0.0": {}, "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0" } }, "Microsoft.Extensions.Logging/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0" } }, "Microsoft.Extensions.Logging.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, "Microsoft.Extensions.Options/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Primitives/8.0.0": {}, "Microsoft.IdentityModel.Abstractions/7.0.3": { "runtime": { "lib/net8.0/Microsoft.IdentityModel.Abstractions.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.JsonWebTokens/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Logging/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Abstractions": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Logging.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Protocols/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Logging": "7.0.3", "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Protocols.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Protocols.OpenIdConnect/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Protocols": "7.0.3", "System.IdentityModel.Tokens.Jwt": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Tokens/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Logging": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Tokens.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Mono.TextTemplating/2.2.1": { "dependencies": { "System.CodeDom": "4.4.0" } }, "Npgsql/8.0.0": { "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "8.0.0" }, "runtime": { "lib/net8.0/Npgsql.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Npgsql.EntityFrameworkCore.PostgreSQL/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.0", "Microsoft.EntityFrameworkCore.Abstractions": "8.0.0", "Microsoft.EntityFrameworkCore.Relational": "8.0.0", "Npgsql": "8.0.0" }, "runtime": { "lib/net8.0/Npgsql.EntityFrameworkCore.PostgreSQL.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog/3.1.1": { "runtime": { "lib/net7.0/Serilog.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "3.1.1.0" } } }, "Serilog.AspNetCore/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0", "Serilog": "3.1.1", "Serilog.Extensions.Hosting": "8.0.0", "Serilog.Extensions.Logging": "8.0.0", "Serilog.Formatting.Compact": "2.0.0", "Serilog.Settings.Configuration": "8.0.0", "Serilog.Sinks.Console": "5.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0" }, "runtime": { "lib/net8.0/Serilog.AspNetCore.dll": { "assemblyVersion": "0.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Extensions.Hosting/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Hosting.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Serilog": "3.1.1", "Serilog.Extensions.Logging": "8.0.0" }, "runtime": { "lib/net8.0/Serilog.Extensions.Hosting.dll": { "assemblyVersion": "7.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Extensions.Logging/8.0.0": { "dependencies": { "Microsoft.Extensions.Logging": "8.0.0", "Serilog": "3.1.1" }, "runtime": { "lib/net8.0/Serilog.Extensions.Logging.dll": { "assemblyVersion": "7.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Formatting.Compact/2.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net7.0/Serilog.Formatting.Compact.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "2.0.0.0" } } }, "Serilog.Settings.Configuration/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Binder": "8.0.0", "Microsoft.Extensions.DependencyModel": "8.0.0", "Serilog": "3.1.1" }, "runtime": { "lib/net8.0/Serilog.Settings.Configuration.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Sinks.Console/5.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net7.0/Serilog.Sinks.Console.dll": { "assemblyVersion": "5.0.0.0", "fileVersion": "5.0.0.0" } } }, "Serilog.Sinks.Debug/2.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/netstandard2.1/Serilog.Sinks.Debug.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "2.0.0.0" } } }, "Serilog.Sinks.File/5.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net5.0/Serilog.Sinks.File.dll": { "assemblyVersion": "5.0.0.0", "fileVersion": "5.0.0.0" } } }, "System.CodeDom/4.4.0": {}, "System.Collections.Immutable/6.0.0": { "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Composition/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0", "System.Composition.Convention": "6.0.0", "System.Composition.Hosting": "6.0.0", "System.Composition.Runtime": "6.0.0", "System.Composition.TypedParts": "6.0.0" } }, "System.Composition.AttributedModel/6.0.0": {}, "System.Composition.Convention/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0" } }, "System.Composition.Hosting/6.0.0": { "dependencies": { "System.Composition.Runtime": "6.0.0" } }, "System.Composition.Runtime/6.0.0": {}, "System.Composition.TypedParts/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0", "System.Composition.Hosting": "6.0.0", "System.Composition.Runtime": "6.0.0" } }, "System.Diagnostics.DiagnosticSource/8.0.0": {}, "System.IdentityModel.Tokens.Jwt/7.0.3": { "dependencies": { "Microsoft.IdentityModel.JsonWebTokens": "7.0.3", "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/System.IdentityModel.Tokens.Jwt.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "System.IO.Pipelines/8.0.0": {}, "System.Reflection.Metadata/6.0.1": { "dependencies": { "System.Collections.Immutable": "6.0.0" } }, "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, "System.Text.Encoding.CodePages/6.0.0": { "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Text.Encodings.Web/8.0.0": {}, "System.Text.Json/8.0.0": { "dependencies": { "System.Text.Encodings.Web": "8.0.0" } }, "System.Threading.Channels/6.0.0": {}, "ClassNotify.Shared/1.0.0": { "runtime": { "ClassNotify.Shared.dll": { "assemblyVersion": "1.0.0", "fileVersion": "1.0.0.0" } } } } }, "libraries": { "ClassNotify.Server/1.0.0": { "type": "project", "serviceable": false, "sha512": "" }, "Humanizer.Core/2.14.1": { "type": "package", "serviceable": true, "sha512": "sha512-lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==", "path": "humanizer.core/2.14.1", "hashPath": "humanizer.core.2.14.1.nupkg.sha512" }, "Microsoft.AspNetCore.Authentication.JwtBearer/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-rwxaZYHips5M9vqxRkGfJthTx+Ws4O4yCuefn17J371jL3ouC5Ker43h2hXb5yd9BMnImE9rznT75KJHm6bMgg==", "path": "microsoft.aspnetcore.authentication.jwtbearer/8.0.0", "hashPath": "microsoft.aspnetcore.authentication.jwtbearer.8.0.0.nupkg.sha512" }, "Microsoft.AspNetCore.Connections.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-WgJE2+VyA0RW4yl+hgfrB7r4CSGcLzAvcVo31swukjXHZvBAjMilyG/pRJ8kroOO1h7sGf4r91Wii2L9gCMNfA==", "path": "microsoft.aspnetcore.connections.abstractions/8.0.0", "hashPath": "microsoft.aspnetcore.connections.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.AspNetCore.SignalR.Common/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-HOy32Kb4z69sCep+pVUTL11L49pk8Ze18HuqCYllaRMdDlfcSrBE0stb8fJL+ogPKTB7XZAxpj1UT/IJQIfS6g==", "path": "microsoft.aspnetcore.signalr.common/8.0.0", "hashPath": "microsoft.aspnetcore.signalr.common.8.0.0.nupkg.sha512" }, "Microsoft.Bcl.AsyncInterfaces/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==", "path": "microsoft.bcl.asyncinterfaces/6.0.0", "hashPath": "microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.Analyzers/3.3.3": { "type": "package", "serviceable": true, "sha512": "sha512-j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==", "path": "microsoft.codeanalysis.analyzers/3.3.3", "hashPath": "microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512" }, "Microsoft.CodeAnalysis.Common/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-lwAbIZNdnY0SUNoDmZHkVUwLO8UyNnyyh1t/4XsbFxi4Ounb3xszIYZaWhyj5ZjyfcwqwmtMbE7fUTVCqQEIdQ==", "path": "microsoft.codeanalysis.common/4.5.0", "hashPath": "microsoft.codeanalysis.common.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.CSharp/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-cM59oMKAOxvdv76bdmaKPy5hfj+oR+zxikWoueEB7CwTko7mt9sVKZI8Qxlov0C/LuKEG+WQwifepqL3vuTiBQ==", "path": "microsoft.codeanalysis.csharp/4.5.0", "hashPath": "microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-h74wTpmGOp4yS4hj+EvNzEiPgg/KVs2wmSfTZ81upJZOtPkJsVkgfsgtxxqmAeapjT/vLKfmYV0bS8n5MNVP+g==", "path": "microsoft.codeanalysis.csharp.workspaces/4.5.0", "hashPath": "microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-l4dDRmGELXG72XZaonnOeORyD/T5RpEu5LGHOUIhnv+MmUWDY/m1kWXGwtcgQ5CJ5ynkFiRnIYzTKXYjUs7rbw==", "path": "microsoft.codeanalysis.workspaces.common/4.5.0", "hashPath": "microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-SoODat83pGQUpWB9xULdMX6tuKpq/RTXDuJ2WeC1ldUKcKzLkaFJD1n+I0nOLY58odez/e7z8b6zdp235G/kyg==", "path": "microsoft.entityframeworkcore/8.0.0", "hashPath": "microsoft.entityframeworkcore.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-VR22s3+zoqlVI7xauFKn1znSIFHO8xuILT+noSwS8bZCKcHz0ydkTDQMuaxSa5WBaQrZmwtTz9rmRvJ7X8mSPQ==", "path": "microsoft.entityframeworkcore.abstractions/8.0.0", "hashPath": "microsoft.entityframeworkcore.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Analyzers/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZXxEeLs2zoZ1TA+QoMMcw4f3Tirf8PzgdDax8RoWo0dxI2KmqiEGWYjhm2B/XyWfglc6+mNRyB8rZiQSmxCpeg==", "path": "microsoft.entityframeworkcore.analyzers/8.0.0", "hashPath": "microsoft.entityframeworkcore.analyzers.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Design/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-94reKYu63jg4O75UI3LMJHwOSi8tQ6IfubiZhdnSsWcgtmAuF8OyLfjK/MIxuvaQRJZAF6E747FIuxjOtb8/og==", "path": "microsoft.entityframeworkcore.design/8.0.0", "hashPath": "microsoft.entityframeworkcore.design.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Relational/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-fFKkr24cYc7Zw5T6DC4tEyOEPgPbq23BBmym1r9kn4ET9F3HKaetpOeQtV2RryYyUxEeNkJuxgfiZHTisqZc+A==", "path": "microsoft.entityframeworkcore.relational/8.0.0", "hashPath": "microsoft.entityframeworkcore.relational.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Caching.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-3KuSxeHoNYdxVYfg2IRZCThcrlJ1XJqIXkAWikCsbm5C/bCjv7G0WoKDyuR98Q+T607QT2Zl5GsbGRkENcV2yQ==", "path": "microsoft.extensions.caching.abstractions/8.0.0", "hashPath": "microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Caching.Memory/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-7pqivmrZDzo1ADPkRwjy+8jtRKWRCPag9qPI+p7sgu7Q4QreWhcvbiWXsbhP+yY8XSiDvZpu2/LWdBv7PnmOpQ==", "path": "microsoft.extensions.caching.memory/8.0.0", "hashPath": "microsoft.extensions.caching.memory.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==", "path": "microsoft.extensions.configuration.abstractions/8.0.0", "hashPath": "microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Configuration.Binder/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==", "path": "microsoft.extensions.configuration.binder/8.0.0", "hashPath": "microsoft.extensions.configuration.binder.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyInjection/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", "path": "microsoft.extensions.dependencyinjection/8.0.0", "hashPath": "microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==", "path": "microsoft.extensions.dependencyinjection.abstractions/8.0.0", "hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyModel/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-NSmDw3K0ozNDgShSIpsZcbFIzBX4w28nDag+TfaQujkXGazBm+lid5onlWoCBy4VsLxqnnKjEBbGSJVWJMf43g==", "path": "microsoft.extensions.dependencymodel/8.0.0", "hashPath": "microsoft.extensions.dependencymodel.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==", "path": "microsoft.extensions.diagnostics.abstractions/8.0.0", "hashPath": "microsoft.extensions.diagnostics.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Features/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-fxj+P9aIbTLtguFwiNqBtGNl4ZU/2Aggwj4/Ruf3qFaiBk7r1t8KnyJ+bEIK5emMyGSszTndwnP/g+gBEP9zLA==", "path": "microsoft.extensions.features/8.0.0", "hashPath": "microsoft.extensions.features.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==", "path": "microsoft.extensions.fileproviders.abstractions/8.0.0", "hashPath": "microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-AG7HWwVRdCHlaA++1oKDxLsXIBxmDpMPb3VoyOoAghEWnkUvEAdYQUwnV4jJbAaa/nMYNiEh5ByoLauZBEiovg==", "path": "microsoft.extensions.hosting.abstractions/8.0.0", "hashPath": "microsoft.extensions.hosting.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Logging/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", "path": "microsoft.extensions.logging/8.0.0", "hashPath": "microsoft.extensions.logging.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Logging.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", "path": "microsoft.extensions.logging.abstractions/8.0.0", "hashPath": "microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Options/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==", "path": "microsoft.extensions.options/8.0.0", "hashPath": "microsoft.extensions.options.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Primitives/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==", "path": "microsoft.extensions.primitives/8.0.0", "hashPath": "microsoft.extensions.primitives.8.0.0.nupkg.sha512" }, "Microsoft.IdentityModel.Abstractions/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-cfPUWdjigLIRIJSKz3uaZxShgf86RVDXHC1VEEchj1gnY25akwPYpbrfSoIGDCqA9UmOMdlctq411+2pAViFow==", "path": "microsoft.identitymodel.abstractions/7.0.3", "hashPath": "microsoft.identitymodel.abstractions.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.JsonWebTokens/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-vxjHVZbMKD3rVdbvKhzAW+7UiFrYToUVm3AGmYfKSOAwyhdLl/ELX1KZr+FaLyyS5VReIzWRWJfbOuHM9i6ywg==", "path": "microsoft.identitymodel.jsonwebtokens/7.0.3", "hashPath": "microsoft.identitymodel.jsonwebtokens.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Logging/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-b6GbGO+2LOTBEccHhqoJsOsmemG4A/MY+8H0wK/ewRhiG+DCYwEnucog1cSArPIY55zcn+XdZl0YEiUHkpDISQ==", "path": "microsoft.identitymodel.logging/7.0.3", "hashPath": "microsoft.identitymodel.logging.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Protocols/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-BtwR+tctBYhPNygyZmt1Rnw74GFrJteW+1zcdIgyvBCjkek6cNwPPqRfdhzCv61i+lwyNomRi8+iI4QKd4YCKA==", "path": "microsoft.identitymodel.protocols/7.0.3", "hashPath": "microsoft.identitymodel.protocols.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Protocols.OpenIdConnect/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-W97TraHApDNArLwpPcXfD+FZH7njJsfEwZE9y9BoofeXMS8H0LBBobz0VOmYmMK4mLdOKxzN7SFT3Ekg0FWI3Q==", "path": "microsoft.identitymodel.protocols.openidconnect/7.0.3", "hashPath": "microsoft.identitymodel.protocols.openidconnect.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Tokens/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-wB+LlbDjhnJ98DULjmFepqf9eEMh/sDs6S6hFh68iNRHmwollwhxk+nbSSfpA5+j+FbRyNskoaY4JsY1iCOKCg==", "path": "microsoft.identitymodel.tokens/7.0.3", "hashPath": "microsoft.identitymodel.tokens.7.0.3.nupkg.sha512" }, "Mono.TextTemplating/2.2.1": { "type": "package", "serviceable": true, "sha512": "sha512-KZYeKBET/2Z0gY1WlTAK7+RHTl7GSbtvTLDXEZZojUdAPqpQNDL6tHv7VUpqfX5VEOh+uRGKaZXkuD253nEOBQ==", "path": "mono.texttemplating/2.2.1", "hashPath": "mono.texttemplating.2.2.1.nupkg.sha512" }, "Npgsql/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-Qiz74U+O7Mv4knrsXgKVYGJjgwoziK+aMFZqz7PtKR3vyGIhZA0tnW6HoUnL3X+YqtmVuhmoKkN8LDWEHMxPbw==", "path": "npgsql/8.0.0", "hashPath": "npgsql.8.0.0.nupkg.sha512" }, "Npgsql.EntityFrameworkCore.PostgreSQL/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-GDXiMS9peEdjSCU/rfgyHruio7q6tYuywGaktqEi6UPQ6ILechp3fVVX+dHXkIXt4nklCBzYVWkzFrSL9ubKUA==", "path": "npgsql.entityframeworkcore.postgresql/8.0.0", "hashPath": "npgsql.entityframeworkcore.postgresql.8.0.0.nupkg.sha512" }, "Serilog/3.1.1": { "type": "package", "serviceable": true, "sha512": "sha512-P6G4/4Kt9bT635bhuwdXlJ2SCqqn2nhh4gqFqQueCOr9bK/e7W9ll/IoX1Ter948cV2Z/5+5v8pAfJYUISY03A==", "path": "serilog/3.1.1", "hashPath": "serilog.3.1.1.nupkg.sha512" }, "Serilog.AspNetCore/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-FAjtKPZ4IzqFQBqZKPv6evcXK/F0ls7RoXI/62Pnx2igkDZ6nZ/jn/C/FxVATqQbEQvtqP+KViWYIe4NZIHa2w==", "path": "serilog.aspnetcore/8.0.0", "hashPath": "serilog.aspnetcore.8.0.0.nupkg.sha512" }, "Serilog.Extensions.Hosting/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-db0OcbWeSCvYQkHWu6n0v40N4kKaTAXNjlM3BKvcbwvNzYphQFcBR+36eQ/7hMMwOkJvAyLC2a9/jNdUL5NjtQ==", "path": "serilog.extensions.hosting/8.0.0", "hashPath": "serilog.extensions.hosting.8.0.0.nupkg.sha512" }, "Serilog.Extensions.Logging/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-YEAMWu1UnWgf1c1KP85l1SgXGfiVo0Rz6x08pCiPOIBt2Qe18tcZLvdBUuV5o1QHvrs8FAry9wTIhgBRtjIlEg==", "path": "serilog.extensions.logging/8.0.0", "hashPath": "serilog.extensions.logging.8.0.0.nupkg.sha512" }, "Serilog.Formatting.Compact/2.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ob6z3ikzFM3D1xalhFuBIK1IOWf+XrQq+H4KeH4VqBcPpNcmUgZlRQ2h3Q7wvthpdZBBoY86qZOI2LCXNaLlNA==", "path": "serilog.formatting.compact/2.0.0", "hashPath": "serilog.formatting.compact.2.0.0.nupkg.sha512" }, "Serilog.Settings.Configuration/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-nR0iL5HwKj5v6ULo3/zpP8NMcq9E2pxYA6XKTSWCbugVs4YqPyvaqaKOY+OMpPivKp7zMEpax2UKHnDodbRB0Q==", "path": "serilog.settings.configuration/8.0.0", "hashPath": "serilog.settings.configuration.8.0.0.nupkg.sha512" }, "Serilog.Sinks.Console/5.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-IZ6bn79k+3SRXOBpwSOClUHikSkp2toGPCZ0teUkscv4dpDg9E2R2xVsNkLmwddE4OpNVO3N0xiYsAH556vN8Q==", "path": "serilog.sinks.console/5.0.0", "hashPath": "serilog.sinks.console.5.0.0.nupkg.sha512" }, "Serilog.Sinks.Debug/2.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-Y6g3OBJ4JzTyyw16fDqtFcQ41qQAydnEvEqmXjhwhgjsnG/FaJ8GUqF5ldsC/bVkK8KYmqrPhDO+tm4dF6xx4A==", "path": "serilog.sinks.debug/2.0.0", "hashPath": "serilog.sinks.debug.2.0.0.nupkg.sha512" }, "Serilog.Sinks.File/5.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", "path": "serilog.sinks.file/5.0.0", "hashPath": "serilog.sinks.file.5.0.0.nupkg.sha512" }, "System.CodeDom/4.4.0": { "type": "package", "serviceable": true, "sha512": "sha512-2sCCb7doXEwtYAbqzbF/8UAeDRMNmPaQbU2q50Psg1J9KzumyVVCgKQY8s53WIPTufNT0DpSe9QRvVjOzfDWBA==", "path": "system.codedom/4.4.0", "hashPath": "system.codedom.4.4.0.nupkg.sha512" }, "System.Collections.Immutable/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", "path": "system.collections.immutable/6.0.0", "hashPath": "system.collections.immutable.6.0.0.nupkg.sha512" }, "System.Composition/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-d7wMuKQtfsxUa7S13tITC8n1cQzewuhD5iDjZtK2prwFfKVzdYtgrTHgjaV03Zq7feGQ5gkP85tJJntXwInsJA==", "path": "system.composition/6.0.0", "hashPath": "system.composition.6.0.0.nupkg.sha512" }, "System.Composition.AttributedModel/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-WK1nSDLByK/4VoC7fkNiFuTVEiperuCN/Hyn+VN30R+W2ijO1d0Z2Qm0ScEl9xkSn1G2MyapJi8xpf4R8WRa/w==", "path": "system.composition.attributedmodel/6.0.0", "hashPath": "system.composition.attributedmodel.6.0.0.nupkg.sha512" }, "System.Composition.Convention/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-XYi4lPRdu5bM4JVJ3/UIHAiG6V6lWWUlkhB9ab4IOq0FrRsp0F4wTyV4Dj+Ds+efoXJ3qbLqlvaUozDO7OLeXA==", "path": "system.composition.convention/6.0.0", "hashPath": "system.composition.convention.6.0.0.nupkg.sha512" }, "System.Composition.Hosting/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-w/wXjj7kvxuHPLdzZ0PAUt++qJl03t7lENmb2Oev0n3zbxyNULbWBlnd5J5WUMMv15kg5o+/TCZFb6lSwfaUUQ==", "path": "system.composition.hosting/6.0.0", "hashPath": "system.composition.hosting.6.0.0.nupkg.sha512" }, "System.Composition.Runtime/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-qkRH/YBaMPTnzxrS5RDk1juvqed4A6HOD/CwRcDGyPpYps1J27waBddiiq1y93jk2ZZ9wuA/kynM+NO0kb3PKg==", "path": "system.composition.runtime/6.0.0", "hashPath": "system.composition.runtime.6.0.0.nupkg.sha512" }, "System.Composition.TypedParts/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-iUR1eHrL8Cwd82neQCJ00MpwNIBs4NZgXzrPqx8NJf/k4+mwBO0XCRmHYJT4OLSwDDqh5nBLJWkz5cROnrGhRA==", "path": "system.composition.typedparts/6.0.0", "hashPath": "system.composition.typedparts.6.0.0.nupkg.sha512" }, "System.Diagnostics.DiagnosticSource/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ==", "path": "system.diagnostics.diagnosticsource/8.0.0", "hashPath": "system.diagnostics.diagnosticsource.8.0.0.nupkg.sha512" }, "System.IdentityModel.Tokens.Jwt/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-caEe+OpQNYNiyZb+DJpUVROXoVySWBahko2ooNfUcllxa9ZQUM8CgM/mDjP6AoFn6cQU9xMmG+jivXWub8cbGg==", "path": "system.identitymodel.tokens.jwt/7.0.3", "hashPath": "system.identitymodel.tokens.jwt.7.0.3.nupkg.sha512" }, "System.IO.Pipelines/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-FHNOatmUq0sqJOkTx+UF/9YK1f180cnW5FVqnQMvYUN0elp6wFzbtPSiqbo1/ru8ICp43JM1i7kKkk6GsNGHlA==", "path": "system.io.pipelines/8.0.0", "hashPath": "system.io.pipelines.8.0.0.nupkg.sha512" }, "System.Reflection.Metadata/6.0.1": { "type": "package", "serviceable": true, "sha512": "sha512-III/lNMSn0ZRBuM9m5Cgbiho5j81u0FAEagFX5ta2DKbljZ3T0IpD8j+BIiHQPeKqJppWS9bGEp6JnKnWKze0g==", "path": "system.reflection.metadata/6.0.1", "hashPath": "system.reflection.metadata.6.0.1.nupkg.sha512" }, "System.Runtime.CompilerServices.Unsafe/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", "path": "system.runtime.compilerservices.unsafe/6.0.0", "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" }, "System.Text.Encoding.CodePages/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==", "path": "system.text.encoding.codepages/6.0.0", "hashPath": "system.text.encoding.codepages.6.0.0.nupkg.sha512" }, "System.Text.Encodings.Web/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==", "path": "system.text.encodings.web/8.0.0", "hashPath": "system.text.encodings.web.8.0.0.nupkg.sha512" }, "System.Text.Json/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-OdrZO2WjkiEG6ajEFRABTRCi/wuXQPxeV6g8xvUJqdxMvvuCCEk86zPla8UiIQJz3durtUEbNyY/3lIhS0yZvQ==", "path": "system.text.json/8.0.0", "hashPath": "system.text.json.8.0.0.nupkg.sha512" }, "System.Threading.Channels/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==", "path": "system.threading.channels/6.0.0", "hashPath": "system.threading.channels.6.0.0.nupkg.sha512" }, "ClassNotify.Shared/1.0.0": { "type": "project", "serviceable": false, "sha512": "" } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/ClassNotify.Server.runtimeconfig.json SIZE: 557 chars SHA256: BFCD9777228F00CE830A77B9EE3D2D735AFEC5E998DEF17C549C6B004DD354CF ===================================================================== */ { "runtimeOptions": { "tfm": "net8.0", "frameworks": [ { "name": "Microsoft.NETCore.App", "version": "8.0.0" }, { "name": "Microsoft.AspNetCore.App", "version": "8.0.0" } ], "configProperties": { "System.GC.Server": true, "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, "System.Reflection.NullabilityInfoContext.IsSupported": true, "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/assets/index-Cw4C71zT.js SIZE: 397525 chars SHA256: F98F2D21737D8238804615BBCA7F886AAC4814F8A845A72930FED3D40345D24A ===================================================================== */ var Jf=Object.defineProperty;var Xf=(a,l,o)=>l in a?Jf(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;var xt=(a,l,o)=>Xf(a,typeof l!="symbol"?l+"":l,o);function Gf(a,l){for(var o=0;ou[d]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();function Td(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Oo={exports:{}},pr={},Uo={exports:{}},me={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var rd;function Yf(){if(rd)return me;rd=1;var a=Symbol.for("react.element"),l=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),S=Symbol.iterator;function $(N){return N===null||typeof N!="object"?null:(N=S&&N[S]||N["@@iterator"],typeof N=="function"?N:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,F={};function I(N,L,ie){this.props=N,this.context=L,this.refs=F,this.updater=ie||D}I.prototype.isReactComponent={},I.prototype.setState=function(N,L){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,L,"setState")},I.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=I.prototype;function G(N,L,ie){this.props=N,this.context=L,this.refs=F,this.updater=ie||D}var Z=G.prototype=new q;Z.constructor=G,H(Z,I.prototype),Z.isPureReactComponent=!0;var te=Array.isArray,O=Object.prototype.hasOwnProperty,K={current:null},fe={key:!0,ref:!0,__self:!0,__source:!0};function pe(N,L,ie){var ce,he={},ve=null,ke=null;if(L!=null)for(ce in L.ref!==void 0&&(ke=L.ref),L.key!==void 0&&(ve=""+L.key),L)O.call(L,ce)&&!fe.hasOwnProperty(ce)&&(he[ce]=L[ce]);var Ne=arguments.length-2;if(Ne===1)he.children=ie;else if(1>>1,L=k[N];if(0>>1;Nd(he,T))ved(ke,he)?(k[N]=ke,k[ve]=T,N=ve):(k[N]=he,k[ce]=T,N=ce);else if(ved(ke,T))k[N]=ke,k[ve]=T,N=ve;else break e}}return W}function d(k,W){var T=k.sortIndex-W.sortIndex;return T!==0?T:k.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,y=m.now();a.unstable_now=function(){return m.now()-y}}var p=[],j=[],C=1,S=null,$=3,D=!1,H=!1,F=!1,I=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(k){for(var W=o(j);W!==null;){if(W.callback===null)u(j);else if(W.startTime<=k)u(j),W.sortIndex=W.expirationTime,l(p,W);else break;W=o(j)}}function te(k){if(F=!1,Z(k),!H)if(o(p)!==null)H=!0,Te(O);else{var W=o(j);W!==null&&V(te,W.startTime-k)}}function O(k,W){H=!1,F&&(F=!1,q(pe),pe=-1),D=!0;var T=$;try{for(Z(W),S=o(p);S!==null&&(!(S.expirationTime>W)||k&&!Ee());){var N=S.callback;if(typeof N=="function"){S.callback=null,$=S.priorityLevel;var L=N(S.expirationTime<=W);W=a.unstable_now(),typeof L=="function"?S.callback=L:S===o(p)&&u(p),Z(W)}else u(p);S=o(p)}if(S!==null)var ie=!0;else{var ce=o(j);ce!==null&&V(te,ce.startTime-W),ie=!1}return ie}finally{S=null,$=T,D=!1}}var K=!1,fe=null,pe=-1,b=5,ne=-1;function Ee(){return!(a.unstable_now()-nek||125N?(k.sortIndex=T,l(j,k),o(p)===null&&k===o(j)&&(F?(q(pe),pe=-1):F=!0,V(te,T-N))):(k.sortIndex=L,l(p,k),H||D||(H=!0,Te(O))),k},a.unstable_shouldYield=Ee,a.unstable_wrapCallback=function(k){var W=$;return function(){var T=$;$=W;try{return k.apply(this,arguments)}finally{$=T}}}})(Ho)),Ho}var cd;function sm(){return cd||(cd=1,Bo.exports=nm()),Bo.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ud;function rm(){if(ud)return gt;ud=1;var a=ta(),l=sm();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,j=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,C={},S={};function $(e){return p.call(S,e)?!0:p.call(C,e)?!1:j.test(e)?S[e]=!0:(C[e]=!0,!1)}function D(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function H(e,t,s,r){if(t===null||typeof t>"u"||D(e,t,s,r))return!0;if(r)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function F(e,t,s,r,i,c,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=h}var I={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){I[e]=new F(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];I[t]=new F(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){I[e]=new F(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){I[e]=new F(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){I[e]=new F(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){I[e]=new F(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){I[e]=new F(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){I[e]=new F(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){I[e]=new F(e,5,!1,e.toLowerCase(),null,!1,!1)});var q=/[\-:]([a-z])/g;function G(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(q,G);I[t]=new F(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(q,G);I[t]=new F(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(q,G);I[t]=new F(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){I[e]=new F(e,1,!1,e.toLowerCase(),null,!1,!1)}),I.xlinkHref=new F("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){I[e]=new F(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,s,r){var i=I.hasOwnProperty(t)?I[t]:null;(i!==null?i.type!==0:r||!(2x||i[h]!==c[x]){var v=` `+i[h].replace(" at new "," at ");return e.displayName&&v.includes("")&&(v=v.replace("",e.displayName)),v}while(1<=h&&0<=x);break}}}finally{ie=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?L(e):""}function he(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ce(e.type,!1),e;case 11:return e=ce(e.type.render,!1),e;case 1:return e=ce(e.type,!0),e;default:return""}}function ve(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case fe:return"Fragment";case K:return"Portal";case b:return"Profiler";case pe:return"StrictMode";case _e:return"Suspense";case Ue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ee:return(e.displayName||"Context")+".Consumer";case ne:return(e._context.displayName||"Context")+".Provider";case je:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $e:return t=e.displayName||null,t!==null?t:ve(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return ve(e(t))}catch{}}return null}function ke(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ve(t);case 8:return t===pe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ne(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function de(e){var t=U(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var i=s.get,c=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(h){r=""+h,c.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(h){r=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ot(e){e._valueTracker||(e._valueTracker=de(e))}function be(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=U(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function We(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Le(e,t){var s=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Jn(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=Ne(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function nn(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Ql(e,t){nn(e,t);var s=Ne(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ql(e,t.type,s):t.hasOwnProperty("defaultValue")&&ql(e,t.type,Ne(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fa(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function ql(e,t,s){(t!=="number"||We(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ps=Array.isArray;function Xn(e,t,s,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Is(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Rs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yd=["Webkit","ms","Moz","O"];Object.keys(Rs).forEach(function(e){Yd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rs[t]=Rs[e]})});function ya(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Rs.hasOwnProperty(e)&&Rs[e]?(""+t).trim():t+"px"}function wa(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,i=ya(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,i):e[s]=i}}var Zd=T({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xl(e,t){if(t){if(Zd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function Gl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Yl=null;function Zl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ei=null,Gn=null,Yn=null;function ja(e){if(e=er(e)){if(typeof ei!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Gr(t),ei(e.stateNode,e.type,t))}}function Na(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function ba(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,ja(e),t)for(e=0;e>>=0,e===0?32:31-(uh(e)/dh|0)|0}var Lr=64,Dr=4194304;function Ms(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $r(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,c=e.pingedLanes,h=s&268435455;if(h!==0){var x=h&~i;x!==0?r=Ms(x):(c&=h,c!==0&&(r=Ms(c)))}else h=s&~i,h!==0?r=Ms(h):c!==0&&(r=Ms(c));if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,c=t&-t,i>=c||i===16&&(c&4194240)!==0))return t;if((r&4)!==0&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0s;s++)t.push(e);return t}function As(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=s}function ph(e,t){var s=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vs),Ga=" ",Ya=!1;function Za(e,t){switch(e){case"keyup":return Hh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function Vh(e,t){switch(e){case"compositionend":return ec(t);case"keypress":return t.which!==32?null:(Ya=!0,Ga);case"textInput":return e=t.data,e===Ga&&Ya?null:e;default:return null}}function Qh(e,t){if(ts)return e==="compositionend"||!vi&&Za(e,t)?(e=Va(),Ur=hi=an=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=oc(s)}}function cc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function uc(){for(var e=window,t=We();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=We(e.document)}return t}function ji(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function tf(e){var t=uc(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&cc(s.ownerDocument.documentElement,s)){if(r!==null&&ji(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=s.textContent.length,c=Math.min(r.start,i);r=r.end===void 0?c:Math.min(r.end,i),!e.extend&&c>r&&(i=r,r=c,c=i),i=ac(s,c);var h=ac(s,r);i&&h&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),c>r?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ns=null,Ni=null,Js=null,bi=!1;function dc(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bi||ns==null||ns!==We(r)||(r=ns,"selectionStart"in r&&ji(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Js&&Ks(Js,r)||(Js=r,r=Kr(Ni,"onSelect"),0os||(e.current=$i[os],$i[os]=null,os--)}function Pe(e,t){os++,$i[os]=e.current,e.current=t}var hn={},nt=dn(hn),dt=dn(!1),Pn=hn;function as(e,t){var s=e.type.contextTypes;if(!s)return hn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},c;for(c in s)i[c]=t[c];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ht(e){return e=e.childContextTypes,e!=null}function Yr(){Re(dt),Re(nt)}function Sc(e,t,s){if(nt.current!==hn)throw Error(o(168));Pe(nt,t),Pe(dt,s)}function Cc(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(o(108,ke(e)||"Unknown",i));return T({},s,r)}function Zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hn,Pn=nt.current,Pe(nt,e),Pe(dt,dt.current),!0}function Ec(e,t,s){var r=e.stateNode;if(!r)throw Error(o(169));s?(e=Cc(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,Re(dt),Re(nt),Pe(nt,e)):Re(dt),Pe(dt,s)}var Kt=null,el=!1,Mi=!1;function Tc(e){Kt===null?Kt=[e]:Kt.push(e)}function mf(e){el=!0,Tc(e)}function fn(){if(!Mi&&Kt!==null){Mi=!0;var e=0,t=Se;try{var s=Kt;for(Se=1;e>=h,i-=h,Jt=1<<32-It(t)+i|s<le?(Ze=re,re=null):Ze=re.sibling;var we=M(_,re,E[le],B);if(we===null){re===null&&(re=Ze);break}e&&re&&we.alternate===null&&t(_,re),w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we,re=Ze}if(le===E.length)return s(_,re),De&&Rn(_,le),ee;if(re===null){for(;lele?(Ze=re,re=null):Ze=re.sibling;var Nn=M(_,re,we.value,B);if(Nn===null){re===null&&(re=Ze);break}e&&re&&Nn.alternate===null&&t(_,re),w=c(Nn,w,le),se===null?ee=Nn:se.sibling=Nn,se=Nn,re=Ze}if(we.done)return s(_,re),De&&Rn(_,le),ee;if(re===null){for(;!we.done;le++,we=E.next())we=z(_,we.value,B),we!==null&&(w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we);return De&&Rn(_,le),ee}for(re=r(_,re);!we.done;le++,we=E.next())we=Q(re,_,le,we.value,B),we!==null&&(e&&we.alternate!==null&&re.delete(we.key===null?le:we.key),w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we);return e&&re.forEach(function(Kf){return t(_,Kf)}),De&&Rn(_,le),ee}function Be(_,w,E,B){if(typeof E=="object"&&E!==null&&E.type===fe&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case O:e:{for(var ee=E.key,se=w;se!==null;){if(se.key===ee){if(ee=E.type,ee===fe){if(se.tag===7){s(_,se.sibling),w=i(se,E.props.children),w.return=_,_=w;break e}}else if(se.elementType===ee||typeof ee=="object"&&ee!==null&&ee.$$typeof===Te&&$c(ee)===se.type){s(_,se.sibling),w=i(se,E.props),w.ref=tr(_,se,E),w.return=_,_=w;break e}s(_,se);break}else t(_,se);se=se.sibling}E.type===fe?(w=Un(E.props.children,_.mode,B,E.key),w.return=_,_=w):(B=El(E.type,E.key,E.props,null,_.mode,B),B.ref=tr(_,w,E),B.return=_,_=B)}return h(_);case K:e:{for(se=E.key;w!==null;){if(w.key===se)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){s(_,w.sibling),w=i(w,E.children||[]),w.return=_,_=w;break e}else{s(_,w);break}else t(_,w);w=w.sibling}w=Do(E,_.mode,B),w.return=_,_=w}return h(_);case Te:return se=E._init,Be(_,w,se(E._payload),B)}if(Ps(E))return X(_,w,E,B);if(W(E))return Y(_,w,E,B);rl(_,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,w!==null&&w.tag===6?(s(_,w.sibling),w=i(w,E),w.return=_,_=w):(s(_,w),w=Lo(E,_.mode,B),w.return=_,_=w),h(_)):s(_,w)}return Be}var hs=Mc(!0),Ac=Mc(!1),ll=dn(null),il=null,fs=null,Bi=null;function Hi(){Bi=fs=il=null}function Wi(e){var t=ll.current;Re(ll),e._currentValue=t}function Vi(e,t,s){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===s)break;e=e.return}}function ms(e,t){il=e,Bi=fs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ft=!0),e.firstContext=null)}function St(e){var t=e._currentValue;if(Bi!==e)if(e={context:e,memoizedValue:t,next:null},fs===null){if(il===null)throw Error(o(308));fs=e,il.dependencies={lanes:0,firstContext:e}}else fs=fs.next=e;return t}var Ln=null;function Qi(e){Ln===null?Ln=[e]:Ln.push(e)}function zc(e,t,s,r){var i=t.interleaved;return i===null?(s.next=s,Qi(t)):(s.next=i.next,i.next=s),t.interleaved=s,Gt(e,r)}function Gt(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var mn=!1;function qi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ye&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Gt(e,s)}return i=r.interleaved,i===null?(t.next=t,Qi(r)):(t.next=i.next,i.next=t),r.interleaved=t,Gt(e,s)}function ol(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}function Uc(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var i=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};c===null?i=c=h:c=c.next=h,s=s.next}while(s!==null);c===null?i=c=t:c=c.next=t}else i=c=t;s={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:c,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function al(e,t,s,r){var i=e.updateQueue;mn=!1;var c=i.firstBaseUpdate,h=i.lastBaseUpdate,x=i.shared.pending;if(x!==null){i.shared.pending=null;var v=x,P=v.next;v.next=null,h===null?c=P:h.next=P,h=v;var A=e.alternate;A!==null&&(A=A.updateQueue,x=A.lastBaseUpdate,x!==h&&(x===null?A.firstBaseUpdate=P:x.next=P,A.lastBaseUpdate=v))}if(c!==null){var z=i.baseState;h=0,A=P=v=null,x=c;do{var M=x.lane,Q=x.eventTime;if((r&M)===M){A!==null&&(A=A.next={eventTime:Q,lane:0,tag:x.tag,payload:x.payload,callback:x.callback,next:null});e:{var X=e,Y=x;switch(M=t,Q=s,Y.tag){case 1:if(X=Y.payload,typeof X=="function"){z=X.call(Q,z,M);break e}z=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=Y.payload,M=typeof X=="function"?X.call(Q,z,M):X,M==null)break e;z=T({},z,M);break e;case 2:mn=!0}}x.callback!==null&&x.lane!==0&&(e.flags|=64,M=i.effects,M===null?i.effects=[x]:M.push(x))}else Q={eventTime:Q,lane:M,tag:x.tag,payload:x.payload,callback:x.callback,next:null},A===null?(P=A=Q,v=z):A=A.next=Q,h|=M;if(x=x.next,x===null){if(x=i.shared.pending,x===null)break;M=x,x=M.next,M.next=null,i.lastBaseUpdate=M,i.shared.pending=null}}while(!0);if(A===null&&(v=z),i.baseState=v,i.firstBaseUpdate=P,i.lastBaseUpdate=A,t=i.shared.interleaved,t!==null){i=t;do h|=i.lane,i=i.next;while(i!==t)}else c===null&&(i.shared.lanes=0);Mn|=h,e.lanes=h,e.memoizedState=z}}function Fc(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;ts?s:4,e(!0);var r=Yi.transition;Yi.transition={};try{e(!1),t()}finally{Se=s,Yi.transition=r}}function iu(){return Ct().memoizedState}function vf(e,t,s){var r=yn(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},ou(e))au(t,s);else if(s=zc(e,t,s,r),s!==null){var i=ct();At(s,e,r,i),cu(s,t,r)}}function yf(e,t,s){var r=yn(e),i={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(ou(e))au(t,i);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,x=c(h,s);if(i.hasEagerState=!0,i.eagerState=x,Rt(x,h)){var v=t.interleaved;v===null?(i.next=i,Qi(t)):(i.next=v.next,v.next=i),t.interleaved=i;return}}catch{}finally{}s=zc(e,t,i,r),s!==null&&(i=ct(),At(s,e,r,i),cu(s,t,r))}}function ou(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function au(e,t){lr=dl=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function cu(e,t,s){if((s&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}var ml={readContext:St,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useInsertionEffect:st,useLayoutEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useMutableSource:st,useSyncExternalStore:st,useId:st,unstable_isNewReconciler:!1},wf={readContext:St,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Yc,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,hl(4194308,4,tu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return hl(4,2,e,t)},useMemo:function(e,t){var s=Ht();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=Ht();return t=s!==void 0?s(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=vf.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:Xc,useDebugValue:lo,useDeferredValue:function(e){return Ht().memoizedState=e},useTransition:function(){var e=Xc(!1),t=e[0];return e=gf.bind(null,e[1]),Ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=Ae,i=Ht();if(De){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),Ye===null)throw Error(o(349));($n&30)!==0||Vc(r,t,s)}i.memoizedState=s;var c={value:s,getSnapshot:t};return i.queue=c,Yc(qc.bind(null,r,c,e),[e]),r.flags|=2048,ar(9,Qc.bind(null,r,c,s,t),void 0,null),s},useId:function(){var e=Ht(),t=Ye.identifierPrefix;if(De){var s=Xt,r=Jt;s=(r&~(1<<32-It(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=h.createElement(s,{is:r.is}):(e=h.createElement(s),s==="select"&&(h=e,r.multiple?h.multiple=!0:r.size&&(h.size=r.size))):e=h.createElementNS(e,s),e[Ft]=t,e[Zs]=r,Tu(e,t,!1,!1),t.stateNode=e;e:{switch(h=Gl(s,r),s){case"dialog":Ie("cancel",e),Ie("close",e),i=r;break;case"iframe":case"object":case"embed":Ie("load",e),i=r;break;case"video":case"audio":for(i=0;iys&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304)}else{if(!r)if(e=cl(h),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),cr(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!De)return rt(t),null}else 2*Fe()-c.renderingStartTime>ys&&s!==1073741824&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304);c.isBackwards?(h.sibling=t.child,t.child=h):(s=c.last,s!==null?s.sibling=h:t.child=h,c.last=h)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Fe(),t.sibling=null,s=Me.current,Pe(Me,r?s&1|2:s&1),t):(rt(t),null);case 22:case 23:return Po(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(jt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Ef(e,t){switch(zi(t),t.tag){case 1:return ht(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ps(),Re(dt),Re(nt),Gi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(Re(Me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ds()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Me),null;case 4:return ps(),null;case 10:return Wi(t.type._context),null;case 22:case 23:return Po(),null;case 24:return null;default:return null}}var vl=!1,lt=!1,Tf=typeof WeakSet=="function"?WeakSet:Set,J=null;function gs(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Oe(e,t,r)}else s.current=null}function vo(e,t,s){try{s()}catch(r){Oe(e,t,r)}}var Ru=!1;function Pf(e,t){if(Ti=zr,e=uc(),ji(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var i=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{s.nodeType,c.nodeType}catch{s=null;break e}var h=0,x=-1,v=-1,P=0,A=0,z=e,M=null;t:for(;;){for(var Q;z!==s||i!==0&&z.nodeType!==3||(x=h+i),z!==c||r!==0&&z.nodeType!==3||(v=h+r),z.nodeType===3&&(h+=z.nodeValue.length),(Q=z.firstChild)!==null;)M=z,z=Q;for(;;){if(z===e)break t;if(M===s&&++P===i&&(x=h),M===c&&++A===r&&(v=h),(Q=z.nextSibling)!==null)break;z=M,M=z.parentNode}z=Q}s=x===-1||v===-1?null:{start:x,end:v}}else s=null}s=s||{start:0,end:0}}else s=null;for(Pi={focusedElem:e,selectionRange:s},zr=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var X=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(X!==null){var Y=X.memoizedProps,Be=X.memoizedState,_=t.stateNode,w=_.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Dt(t.type,Y),Be);_.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=t.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(B){Oe(t,t.return,B)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return X=Ru,Ru=!1,X}function ur(e,t,s){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var c=i.destroy;i.destroy=void 0,c!==void 0&&vo(t,s,c)}i=i.next}while(i!==r)}}function yl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function yo(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function Lu(e){var t=e.alternate;t!==null&&(e.alternate=null,Lu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ft],delete t[Zs],delete t[Di],delete t[hf],delete t[ff])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Du(e){return e.tag===5||e.tag===3||e.tag===4}function $u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Du(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.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 wo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Xr));else if(r!==4&&(e=e.child,e!==null))for(wo(e,t,s),e=e.sibling;e!==null;)wo(e,t,s),e=e.sibling}function jo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(jo(e,t,s),e=e.sibling;e!==null;)jo(e,t,s),e=e.sibling}var et=null,$t=!1;function xn(e,t,s){for(s=s.child;s!==null;)Mu(e,t,s),s=s.sibling}function Mu(e,t,s){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Rr,s)}catch{}switch(s.tag){case 5:lt||gs(s,t);case 6:var r=et,i=$t;et=null,xn(e,t,s),et=r,$t=i,et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):et.removeChild(s.stateNode));break;case 18:et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?Li(e.parentNode,s):e.nodeType===1&&Li(e,s),Bs(e)):Li(et,s.stateNode));break;case 4:r=et,i=$t,et=s.stateNode.containerInfo,$t=!0,xn(e,t,s),et=r,$t=i;break;case 0:case 11:case 14:case 15:if(!lt&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var c=i,h=c.destroy;c=c.tag,h!==void 0&&((c&2)!==0||(c&4)!==0)&&vo(s,t,h),i=i.next}while(i!==r)}xn(e,t,s);break;case 1:if(!lt&&(gs(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(x){Oe(s,t,x)}xn(e,t,s);break;case 21:xn(e,t,s);break;case 22:s.mode&1?(lt=(r=lt)||s.memoizedState!==null,xn(e,t,s),lt=r):xn(e,t,s);break;default:xn(e,t,s)}}function Au(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Tf),t.forEach(function(r){var i=Of.bind(null,e,r);s.has(r)||(s.add(r),r.then(i,i))})}}function Mt(e,t){var s=t.deletions;if(s!==null)for(var r=0;ri&&(i=h),r&=~c}if(r=i,r=Fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Rf(r/1960))-r,10e?16:e,vn===null)var r=!1;else{if(e=vn,vn=null,_l=0,(ye&6)!==0)throw Error(o(331));var i=ye;for(ye|=4,J=e.current;J!==null;){var c=J,h=c.child;if((J.flags&16)!==0){var x=c.deletions;if(x!==null){for(var v=0;vFe()-_o?zn(e,0):bo|=s),pt(e,t)}function Xu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Dr,Dr<<=1,(Dr&130023424)===0&&(Dr=4194304)));var s=ct();e=Gt(e,t),e!==null&&(As(e,t,s),pt(e,s))}function zf(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Xu(e,s)}function Of(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(s=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}r!==null&&r.delete(t),Xu(e,s)}var Gu;Gu=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||dt.current)ft=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return ft=!1,Sf(e,t,s);ft=(e.flags&131072)!==0}else ft=!1,De&&(t.flags&1048576)!==0&&Pc(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gl(e,t),e=t.pendingProps;var i=as(t,nt.current);ms(t,s),i=eo(null,t,r,e,i,s);var c=to();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(r)?(c=!0,Zr(t)):c=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,qi(t),i.updater=pl,t.stateNode=i,i._reactInternals=t,oo(t,r,e,s),t=ho(null,t,r,!0,c,s)):(t.tag=0,De&&c&&Ai(t),at(null,t,i,s),t=t.child),t;case 16:r=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Ff(r),e=Dt(r,e),i){case 0:t=uo(null,t,r,e,s);break e;case 1:t=bu(null,t,r,e,s);break e;case 11:t=vu(null,t,r,e,s);break e;case 14:t=yu(null,t,r,Dt(r.type,e),s);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),uo(e,t,r,i,s);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),bu(e,t,r,i,s);case 3:e:{if(_u(t),e===null)throw Error(o(387));r=t.pendingProps,c=t.memoizedState,i=c.element,Oc(e,t),al(t,r,null,s);var h=t.memoizedState;if(r=h.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){i=xs(Error(o(423)),t),t=ku(e,t,r,s,i);break e}else if(r!==i){i=xs(Error(o(424)),t),t=ku(e,t,r,s,i);break e}else for(wt=un(t.stateNode.containerInfo.firstChild),yt=t,De=!0,Lt=null,s=Ac(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ds(),r===i){t=Zt(e,t,s);break e}at(e,t,r,s)}t=t.child}return t;case 5:return Bc(t),e===null&&Ui(t),r=t.type,i=t.pendingProps,c=e!==null?e.memoizedProps:null,h=i.children,Ii(r,i)?h=null:c!==null&&Ii(r,c)&&(t.flags|=32),Nu(e,t),at(e,t,h,s),t.child;case 6:return e===null&&Ui(t),null;case 13:return Su(e,t,s);case 4:return Ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hs(t,null,r,s):at(e,t,r,s),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),vu(e,t,r,i,s);case 7:return at(e,t,t.pendingProps,s),t.child;case 8:return at(e,t,t.pendingProps.children,s),t.child;case 12:return at(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,c=t.memoizedProps,h=i.value,Pe(ll,r._currentValue),r._currentValue=h,c!==null)if(Rt(c.value,h)){if(c.children===i.children&&!dt.current){t=Zt(e,t,s);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var x=c.dependencies;if(x!==null){h=c.child;for(var v=x.firstContext;v!==null;){if(v.context===r){if(c.tag===1){v=Yt(-1,s&-s),v.tag=2;var P=c.updateQueue;if(P!==null){P=P.shared;var A=P.pending;A===null?v.next=v:(v.next=A.next,A.next=v),P.pending=v}}c.lanes|=s,v=c.alternate,v!==null&&(v.lanes|=s),Vi(c.return,s,t),x.lanes|=s;break}v=v.next}}else if(c.tag===10)h=c.type===t.type?null:c.child;else if(c.tag===18){if(h=c.return,h===null)throw Error(o(341));h.lanes|=s,x=h.alternate,x!==null&&(x.lanes|=s),Vi(h,s,t),h=c.sibling}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===t){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}at(e,t,i.children,s),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ms(t,s),i=St(i),r=r(i),t.flags|=1,at(e,t,r,s),t.child;case 14:return r=t.type,i=Dt(r,t.pendingProps),i=Dt(r.type,i),yu(e,t,r,i,s);case 15:return wu(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),gl(e,t),t.tag=1,ht(r)?(e=!0,Zr(t)):e=!1,ms(t,s),du(t,r,i),oo(t,r,i,s),ho(null,t,r,!0,e,s);case 19:return Eu(e,t,s);case 22:return ju(e,t,s)}throw Error(o(156,t.tag))};function Yu(e,t){return Ia(e,t)}function Uf(e,t,s,r){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tt(e,t,s,r){return new Uf(e,t,s,r)}function Ro(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ff(e){if(typeof e=="function")return Ro(e)?1:0;if(e!=null){if(e=e.$$typeof,e===je)return 11;if(e===$e)return 14}return 2}function jn(e,t){var s=e.alternate;return s===null?(s=Tt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function El(e,t,s,r,i,c){var h=2;if(r=e,typeof e=="function")Ro(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case fe:return Un(s.children,i,c,t);case pe:h=8,i|=8;break;case b:return e=Tt(12,s,t,i|2),e.elementType=b,e.lanes=c,e;case _e:return e=Tt(13,s,t,i),e.elementType=_e,e.lanes=c,e;case Ue:return e=Tt(19,s,t,i),e.elementType=Ue,e.lanes=c,e;case V:return Tl(s,i,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ne:h=10;break e;case Ee:h=9;break e;case je:h=11;break e;case $e:h=14;break e;case Te:h=16,r=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Tt(h,s,t,i),t.elementType=e,t.type=r,t.lanes=c,t}function Un(e,t,s,r){return e=Tt(7,e,r,t),e.lanes=s,e}function Tl(e,t,s,r){return e=Tt(22,e,r,t),e.elementType=V,e.lanes=s,e.stateNode={isHidden:!1},e}function Lo(e,t,s){return e=Tt(6,e,null,t),e.lanes=s,e}function Do(e,t,s){return t=Tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bf(e,t,s,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ii(0),this.expirationTimes=ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ii(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $o(e,t,s,r,i,c,h,x,v){return e=new Bf(e,t,s,x,v),t===1?(t=1,c===!0&&(t|=8)):t=0,c=Tt(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qi(c),e}function Hf(e,t,s){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Fo.exports=rm(),Fo.exports}var hd;function lm(){if(hd)return Ml;hd=1;var a=Pd();return Ml.createRoot=a.createRoot,Ml.hydrateRoot=a.hydrateRoot,Ml}var im=lm();const om=Td(im);Pd();/** * @remix-run/router v1.23.4 * * 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 */function vr(){return vr=Object.assign?Object.assign.bind():function(a){for(var l=1;l"u")throw new Error(l)}function Id(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function cm(){return Math.random().toString(36).substr(2,8)}function md(a,l){return{usr:a.state,key:a.key,idx:l}}function qo(a,l,o,u){return o===void 0&&(o=null),vr({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof l=="string"?Es(l):l,{state:o,key:l&&l.key||u||cm()})}function zl(a){let{pathname:l="/",search:o="",hash:u=""}=a;return o&&o!=="?"&&(l+=o.charAt(0)==="?"?o:"?"+o),u&&u!=="#"&&(l+=u.charAt(0)==="#"?u:"#"+u),l}function Es(a){let l={};if(a){let o=a.indexOf("#");o>=0&&(l.hash=a.substr(o),a=a.substr(0,o));let u=a.indexOf("?");u>=0&&(l.search=a.substr(u),a=a.substr(0,u)),a&&(l.pathname=a)}return l}function um(a,l,o,u){u===void 0&&(u={});let{window:d=document.defaultView,v5Compat:f=!1}=u,m=d.history,y=bn.Pop,p=null,j=C();j==null&&(j=0,m.replaceState(vr({},m.state,{idx:j}),""));function C(){return(m.state||{idx:null}).idx}function S(){y=bn.Pop;let I=C(),q=I==null?null:I-j;j=I,p&&p({action:y,location:F.location,delta:q})}function $(I,q){y=bn.Push;let G=qo(F.location,I,q);j=C()+1;let Z=md(G,j),te=F.createHref(G);try{m.pushState(Z,"",te)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;d.location.assign(te)}f&&p&&p({action:y,location:F.location,delta:1})}function D(I,q){y=bn.Replace;let G=qo(F.location,I,q);j=C();let Z=md(G,j),te=F.createHref(G);m.replaceState(Z,"",te),f&&p&&p({action:y,location:F.location,delta:0})}function H(I){let q=d.location.origin!=="null"?d.location.origin:d.location.href,G=typeof I=="string"?I:zl(I);return G=G.replace(/ $/,"%20"),He(q,"No window.location.(origin|href) available to create URL for href: "+G),new URL(G,q)}let F={get action(){return y},get location(){return a(d,m)},listen(I){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(fd,S),p=I,()=>{d.removeEventListener(fd,S),p=null}},createHref(I){return l(d,I)},createURL:H,encodeLocation(I){let q=H(I);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:$,replace:D,go(I){return m.go(I)}};return F}var pd;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(pd||(pd={}));function dm(a,l,o){return o===void 0&&(o="/"),hm(a,l,o)}function hm(a,l,o,u){let d=typeof l=="string"?Es(l):l,f=sa(d.pathname||"/",o);if(f==null)return null;let m=Rd(a);fm(m);let y=null,p=km(f);for(let j=0;y==null&&j{let p={relativePath:y===void 0?f.path||"":y,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};p.relativePath.startsWith("/")&&(He(p.relativePath.startsWith(u),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(u.length));let j=_n([u,p.relativePath]),C=o.concat(p);f.children&&f.children.length>0&&(He(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+j+'".')),Rd(f.children,l,C,j)),!(f.path==null&&!f.index)&&l.push({path:j,score:wm(j,f.index),routesMeta:C})};return a.forEach((f,m)=>{var y;if(f.path===""||!((y=f.path)!=null&&y.includes("?")))d(f,m);else for(let p of Ld(f.path))d(f,m,p)}),l}function Ld(a){let l=a.split("/");if(l.length===0)return[];let[o,...u]=l,d=o.endsWith("?"),f=o.replace(/\?$/,"");if(u.length===0)return d?[f,""]:[f];let m=Ld(u.join("/")),y=[];return y.push(...m.map(p=>p===""?f:[f,p].join("/"))),d&&y.push(...m),y.map(p=>a.startsWith("/")&&p===""?"/":p)}function fm(a){a.sort((l,o)=>l.score!==o.score?o.score-l.score:jm(l.routesMeta.map(u=>u.childrenIndex),o.routesMeta.map(u=>u.childrenIndex)))}const mm=/^:[\w-]+$/,pm=3,xm=2,gm=1,vm=10,ym=-2,xd=a=>a==="*";function wm(a,l){let o=a.split("/"),u=o.length;return o.some(xd)&&(u+=ym),l&&(u+=xm),o.filter(d=>!xd(d)).reduce((d,f)=>d+(mm.test(f)?pm:f===""?gm:vm),u)}function jm(a,l){return a.length===l.length&&a.slice(0,-1).every((u,d)=>u===l[d])?a[a.length-1]-l[l.length-1]:0}function Nm(a,l,o){let{routesMeta:u}=a,d={},f="/",m=[];for(let y=0;y{let{paramName:$,isOptional:D}=C;if($==="*"){let F=y[S]||"";m=f.slice(0,f.length-F.length).replace(/(.)\/+$/,"$1")}const H=y[S];return D&&!H?j[$]=void 0:j[$]=(H||"").replace(/%2F/g,"/"),j},{}),pathname:f,pathnameBase:m,pattern:a}}function _m(a,l,o){l===void 0&&(l=!1),o===void 0&&(o=!0),Id(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let u=[],d="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,y,p)=>(u.push({paramName:y,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(u.push({paramName:"*"}),d+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?d+="\\/*$":a!==""&&a!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,l?void 0:"i"),u]}function km(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Id(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+l+").")),a}}function sa(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,u=a.charAt(o);return u&&u!=="/"?null:a.slice(o)||"/"}function Sm(a,l){l===void 0&&(l="/");let{pathname:o,search:u="",hash:d=""}=typeof a=="string"?Es(a):a,f;return o?(o=Dd(o),o.startsWith("/")?f=gd(o.substring(1),"/"):f=gd(o,l)):f=l,{pathname:f,search:Tm(u),hash:Pm(d)}}function gd(a,l){let o=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(d=>{d===".."?o.length>1&&o.pop():d!=="."&&o.push(d)}),o.length>1?o.join("/"):"/"}function Wo(a,l,o,u){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+o+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Cm(a){return a.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function ra(a,l){let o=Cm(a);return l?o.map((u,d)=>d===o.length-1?u.pathname:u.pathnameBase):o.map(u=>u.pathnameBase)}function la(a,l,o,u){u===void 0&&(u=!1);let d;typeof a=="string"?d=Es(a):(d=vr({},a),He(!d.pathname||!d.pathname.includes("?"),Wo("?","pathname","search",d)),He(!d.pathname||!d.pathname.includes("#"),Wo("#","pathname","hash",d)),He(!d.search||!d.search.includes("#"),Wo("#","search","hash",d)));let f=a===""||d.pathname==="",m=f?"/":d.pathname,y;if(m==null)y=o;else{let S=l.length-1;if(!u&&m.startsWith("..")){let $=m.split("/");for(;$[0]==="..";)$.shift(),S-=1;d.pathname=$.join("/")}y=S>=0?l[S]:"/"}let p=Sm(d,y),j=m&&m!=="/"&&m.endsWith("/"),C=(f||m===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(j||C)&&(p.pathname+="/"),p}const Dd=a=>a.replace(/\/\/+/g,"/"),_n=a=>Dd(a.join("/")),Em=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Tm=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Pm=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Im(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const $d=["post","put","patch","delete"];new Set($d);const Rm=["get",...$d];new Set(Rm);/** * React Router v6.30.6 * * 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 */function yr(){return yr=Object.assign?Object.assign.bind():function(a){for(var l=1;l{y.current=!0}),g.useCallback(function(j,C){if(C===void 0&&(C={}),!y.current)return;if(typeof j=="number"){u.go(j);return}let S=la(j,JSON.parse(m),f,C.relative==="path");a==null&&l!=="/"&&(S.pathname=S.pathname==="/"?l:_n([l,S.pathname])),(C.replace?u.replace:u.push)(S,C.state,C)},[l,u,m,f,a])}const Mm=g.createContext(null);function Am(a){let l=g.useContext(tn).outlet;return l&&g.createElement(Mm.Provider,{value:a},l)}function zd(a,l){let{relative:o}=l===void 0?{}:l,{future:u}=g.useContext(Cn),{matches:d}=g.useContext(tn),{pathname:f}=qn(),m=JSON.stringify(ra(d,u.v7_relativeSplatPath));return g.useMemo(()=>la(a,JSON.parse(m),f,o==="path"),[a,m,f,o])}function zm(a,l){return Om(a,l)}function Om(a,l,o,u){Ts()||He(!1);let{navigator:d}=g.useContext(Cn),{matches:f}=g.useContext(tn),m=f[f.length-1],y=m?m.params:{};m&&m.pathname;let p=m?m.pathnameBase:"/";m&&m.route;let j=qn(),C;if(l){var S;let I=typeof l=="string"?Es(l):l;p==="/"||(S=I.pathname)!=null&&S.startsWith(p)||He(!1),C=I}else C=j;let $=C.pathname||"/",D=$;if(p!=="/"){let I=p.replace(/^\//,"").split("/");D="/"+$.replace(/^\//,"").split("/").slice(I.length).join("/")}let H=dm(a,{pathname:D}),F=Wm(H&&H.map(I=>Object.assign({},I,{params:Object.assign({},y,I.params),pathname:_n([p,d.encodeLocation?d.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?p:_n([p,d.encodeLocation?d.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),f,o,u);return l&&F?g.createElement(Hl.Provider,{value:{location:yr({pathname:"/",search:"",hash:"",state:null,key:"default"},C),navigationType:bn.Pop}},F):F}function Um(){let a=Km(),l=Im(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),o=a instanceof Error?a.stack:null,d={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},l),o?g.createElement("pre",{style:d},o):null,null)}const Fm=g.createElement(Um,null);class Bm extends g.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,o){return o.location!==l.location||o.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:o.error,location:o.location,revalidation:l.revalidation||o.revalidation}}componentDidCatch(l,o){console.error("React Router caught the following error during render",l,o)}render(){return this.state.error!==void 0?g.createElement(tn.Provider,{value:this.props.routeContext},g.createElement(Md.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Hm(a){let{routeContext:l,match:o,children:u}=a,d=g.useContext(ia);return d&&d.static&&d.staticContext&&(o.route.errorElement||o.route.ErrorBoundary)&&(d.staticContext._deepestRenderedBoundaryId=o.route.id),g.createElement(tn.Provider,{value:l},u)}function Wm(a,l,o,u){var d;if(l===void 0&&(l=[]),o===void 0&&(o=null),u===void 0&&(u=null),a==null){var f;if(!o)return null;if(o.errors)a=o.matches;else if((f=u)!=null&&f.v7_partialHydration&&l.length===0&&!o.initialized&&o.matches.length>0)a=o.matches;else return null}let m=a,y=(d=o)==null?void 0:d.errors;if(y!=null){let C=m.findIndex(S=>S.route.id&&(y==null?void 0:y[S.route.id])!==void 0);C>=0||He(!1),m=m.slice(0,Math.min(m.length,C+1))}let p=!1,j=-1;if(o&&u&&u.v7_partialHydration)for(let C=0;C=0?m=m.slice(0,j+1):m=[m[0]];break}}}return m.reduceRight((C,S,$)=>{let D,H=!1,F=null,I=null;o&&(D=y&&S.route.id?y[S.route.id]:void 0,F=S.route.errorElement||Fm,p&&(j<0&&$===0?(Xm("route-fallback"),H=!0,I=null):j===$&&(H=!0,I=S.route.hydrateFallbackElement||null)));let q=l.concat(m.slice(0,$+1)),G=()=>{let Z;return D?Z=F:H?Z=I:S.route.Component?Z=g.createElement(S.route.Component,null):S.route.element?Z=S.route.element:Z=C,g.createElement(Hm,{match:S,routeContext:{outlet:C,matches:q,isDataRoute:o!=null},children:Z})};return o&&(S.route.ErrorBoundary||S.route.errorElement||$===0)?g.createElement(Bm,{location:o.location,revalidation:o.revalidation,component:F,error:D,children:G(),routeContext:{outlet:null,matches:q,isDataRoute:!0}}):G()},null)}var Od=(function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a})(Od||{}),Ud=(function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a})(Ud||{});function Vm(a){let l=g.useContext(ia);return l||He(!1),l}function Qm(a){let l=g.useContext(Lm);return l||He(!1),l}function qm(a){let l=g.useContext(tn);return l||He(!1),l}function Fd(a){let l=qm(),o=l.matches[l.matches.length-1];return o.route.id||He(!1),o.route.id}function Km(){var a;let l=g.useContext(Md),o=Qm(),u=Fd();return l!==void 0?l:(a=o.errors)==null?void 0:a[u]}function Jm(){let{router:a}=Vm(Od.UseNavigateStable),l=Fd(Ud.UseNavigateStable),o=g.useRef(!1);return Ad(()=>{o.current=!0}),g.useCallback(function(d,f){f===void 0&&(f={}),o.current&&(typeof d=="number"?a.navigate(d):a.navigate(d,yr({fromRouteId:l},f)))},[a,l])}const vd={};function Xm(a,l,o){vd[a]||(vd[a]=!0)}function Gm(a,l){a==null||a.v7_startTransition,a==null||a.v7_relativeSplatPath}function Vt(a){let{to:l,replace:o,state:u,relative:d}=a;Ts()||He(!1);let{future:f,static:m}=g.useContext(Cn),{matches:y}=g.useContext(tn),{pathname:p}=qn(),j=Wl(),C=la(l,ra(y,f.v7_relativeSplatPath),p,d==="path"),S=JSON.stringify(C);return g.useEffect(()=>j(JSON.parse(S),{replace:o,state:u,relative:d}),[j,S,d,o,u]),null}function Bd(a){return Am(a.context)}function Qe(a){He(!1)}function Ym(a){let{basename:l="/",children:o=null,location:u,navigationType:d=bn.Pop,navigator:f,static:m=!1,future:y}=a;Ts()&&He(!1);let p=l.replace(/^\/*/,"/"),j=g.useMemo(()=>({basename:p,navigator:f,static:m,future:yr({v7_relativeSplatPath:!1},y)}),[p,y,f,m]);typeof u=="string"&&(u=Es(u));let{pathname:C="/",search:S="",hash:$="",state:D=null,key:H="default"}=u,F=g.useMemo(()=>{let I=sa(C,p);return I==null?null:{location:{pathname:I,search:S,hash:$,state:D,key:H},navigationType:d}},[p,C,S,$,D,H,d]);return F==null?null:g.createElement(Cn.Provider,{value:j},g.createElement(Hl.Provider,{children:o,value:F}))}function Zm(a){let{children:l,location:o}=a;return zm(Ko(l),o)}new Promise(()=>{});function Ko(a,l){l===void 0&&(l=[]);let o=[];return g.Children.forEach(a,(u,d)=>{if(!g.isValidElement(u))return;let f=[...l,d];if(u.type===g.Fragment){o.push.apply(o,Ko(u.props.children,f));return}u.type!==Qe&&He(!1),!u.props.index||!u.props.children||He(!1);let m={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(m.children=Ko(u.props.children,f)),o.push(m)}),o}/** * React Router DOM v6.30.6 * * 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 */function Jo(){return Jo=Object.assign?Object.assign.bind():function(a){for(var l=1;l{let u=a[o];return l.concat(Array.isArray(u)?u.map(d=>[o,d]):[[o,u]])},[]))}function sp(a,l){let o=Xo(a);return l&&l.forEach((u,d)=>{o.has(d)||l.getAll(d).forEach(f=>{o.append(d,f)})}),o}const rp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],lp="6";try{window.__reactRouterVersion=lp}catch{}const ip="startTransition",yd=tm[ip];function op(a){let{basename:l,children:o,future:u,window:d}=a,f=g.useRef();f.current==null&&(f.current=am({window:d,v5Compat:!0}));let m=f.current,[y,p]=g.useState({action:m.action,location:m.location}),{v7_startTransition:j}=u||{},C=g.useCallback(S=>{j&&yd?yd(()=>p(S)):p(S)},[p,j]);return g.useLayoutEffect(()=>m.listen(C),[m,C]),g.useEffect(()=>Gm(u),[u]),g.createElement(Ym,{basename:l,children:o,location:y.location,navigationType:y.action,navigator:m,future:u})}const ap=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ge=g.forwardRef(function(l,o){let{onClick:u,relative:d,reloadDocument:f,replace:m,state:y,target:p,to:j,preventScrollReset:C,viewTransition:S}=l,$=ep(l,rp),{basename:D}=g.useContext(Cn),H,F=!1;if(typeof j=="string"&&cp.test(j)&&(H=j,ap))try{let Z=new URL(window.location.href),te=j.startsWith("//")?new URL(Z.protocol+j):new URL(j),O=sa(te.pathname,D);te.origin===Z.origin&&O!=null?j=O+te.search+te.hash:F=!0}catch{}let I=Dm(j,{relative:d}),q=up(j,{replace:m,state:y,target:p,preventScrollReset:C,relative:d,viewTransition:S});function G(Z){u&&u(Z),Z.defaultPrevented||q(Z)}return g.createElement("a",Jo({},$,{href:H||I,onClick:F||f?u:G,ref:o,target:p}))});var wd;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(wd||(wd={}));var jd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(jd||(jd={}));function up(a,l){let{target:o,replace:u,state:d,preventScrollReset:f,relative:m,viewTransition:y}=l===void 0?{}:l,p=Wl(),j=qn(),C=zd(a,{relative:m});return g.useCallback(S=>{if(np(S,o)){S.preventDefault();let $=u!==void 0?u:zl(j)===zl(C);p(a,{replace:$,state:d,preventScrollReset:f,relative:m,viewTransition:y})}},[j,p,C,u,d,o,a,f,m,y])}function dp(a){let l=g.useRef(Xo(a)),o=g.useRef(!1),u=qn(),d=g.useMemo(()=>sp(u.search,o.current?null:l.current),[u.search]),f=Wl(),m=g.useCallback((y,p)=>{const j=Xo(typeof y=="function"?y(d):y);o.current=!0,f("?"+j,p)},[f,d]);return[d,m]}class hp{constructor(){xt(this,"listeners",new Set);xt(this,"isTerminated",!1)}subscribe(l){return this.listeners.add(l),()=>this.listeners.delete(l)}notifySessionExpired(l="登录已过期,请重新登录"){this.isTerminated||(this.isTerminated=!0,this.listeners.forEach(o=>{try{o(l)}catch(u){console.error("Error in session expired listener",u)}}))}reset(){this.isTerminated=!1}}const Ns=new hp,Hd="/api";function Ss(){return localStorage.getItem("classnotify_token")}function fp(a){localStorage.setItem("classnotify_token",a)}function xr(){localStorage.removeItem("classnotify_token"),localStorage.removeItem("classnotify_user")}async function xe(a,l={}){const o=Ss(),u={"Content-Type":"application/json",...l.headers};o&&(u.Authorization=`Bearer ${o}`);const d=await fetch(`${Hd}${a}`,{...l,headers:u});if(d.status===401)throw xr(),Ns.notifySessionExpired("未授权或登录已过期,请重新登录"),new Error("未授权或登录已过期,请重新登录");if(!d.ok){let f=`请求失败 (${d.status})`;try{const m=await d.json();f=m.message||m.errorMessage||f}catch{}throw new Error(f)}return d.json()}const oe={login:(a,l)=>xe("/auth/login",{method:"POST",body:JSON.stringify({username:a,password:l})}),getMe:()=>xe("/auth/me"),getAdminMetrics:()=>xe("/admin/metrics"),getTenants:()=>xe("/admin/tenants"),getAllDevices:()=>xe("/admin/devices"),sendDeviceCommand:(a,l,o)=>xe(`/admin/devices/${a}/command`,{method:"POST",body:JSON.stringify({command:l,parameters:o})}),getAdminActivationCodes:()=>xe("/admin/activation-codes"),getAdminClasses:a=>xe(`/admin/classes?tenantId=${encodeURIComponent(a)}`),generateAdminCode:(a,l)=>xe(`/admin/activation-codes?tenantId=${encodeURIComponent(a)}&classId=${encodeURIComponent(l)}`,{method:"POST"}),getAdminNotifications:(a=50)=>xe(`/admin/notifications?limit=${a}`),createTenant:a=>xe("/admin/tenants",{method:"POST",body:JSON.stringify(a)}),updateTenant:(a,l)=>xe(`/admin/tenants/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),getUsers:(a,l)=>{const o=new URLSearchParams;a&&o.append("tenantId",a),l&&o.append("role",l);const u=o.toString();return xe(`/admin/users${u?`?${u}`:""}`)},createUser:a=>xe("/admin/users",{method:"POST",body:JSON.stringify(a)}),resetPassword:(a,l)=>xe(`/admin/users/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setUserLock:(a,l)=>xe(`/admin/users/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),deleteUser:a=>xe(`/admin/users/${encodeURIComponent(a)}`,{method:"DELETE"}),updateDevice:(a,l)=>xe(`/admin/devices/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),decommissionDevice:a=>xe(`/admin/devices/${encodeURIComponent(a)}/decommission`,{method:"POST"}),deleteActivationCode:a=>xe(`/admin/activation-codes/${encodeURIComponent(a)}`,{method:"DELETE"}),sendEmergencyBroadcast:a=>xe("/admin/broadcasts",{method:"POST",body:JSON.stringify(a)}),getSystemHealth:()=>xe("/admin/system/health"),getAuditLogs:(a=100)=>xe(`/admin/audit-logs?limit=${a}`),getSchoolOverview:()=>xe("/school-admin/overview"),getSchoolClasses:()=>xe("/school-admin/classes"),createSchoolClass:a=>xe("/school-admin/classes",{method:"POST",body:JSON.stringify(a)}),getSchoolTeachers:()=>xe("/school-admin/teachers"),createSchoolTeacher:a=>xe("/school-admin/teachers",{method:"POST",body:JSON.stringify(a)}),resetSchoolTeacherPassword:(a,l)=>xe(`/school-admin/teachers/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setSchoolTeacherLock:(a,l)=>xe(`/school-admin/teachers/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),getSchoolDevices:()=>xe("/school-admin/devices"),getSchoolCodes:()=>xe("/school-admin/activation-codes"),generateSchoolCode:a=>xe(`/school-admin/activation-codes?classId=${encodeURIComponent(a)}`,{method:"POST"}),getTeacherClasses:()=>xe("/notification/classes"),sendNotification:a=>xe("/notification/send",{method:"POST",body:JSON.stringify(a)}),cancelNotification:a=>xe(`/notifications/${encodeURIComponent(a)}/cancel`,{method:"POST"}),getTeacherHistory:(a,l=50)=>xe(`/notification/history?${a?`classId=${encodeURIComponent(a)}&`:""}limit=${l}`),getVisualReceiptBlob:async(a,l)=>{const o=Ss(),u=await fetch(`${Hd}/notifications/${encodeURIComponent(a)}/receipts/${encodeURIComponent(l)}/visual-receipt`,{headers:o?{Authorization:`Bearer ${o}`}:{}});if(u.status===410)throw new Error("视觉回执已按24小时保存策略自动销毁");if(u.status===404)throw new Error("未找到该通知的视觉回执");if(!u.ok)throw new Error(`获取视觉回执失败 (${u.status})`);return u.blob()}};class Fn extends Error{constructor(l,o){const u=new.target.prototype;super(`${l}: Status code '${o}'`),this.statusCode=o,this.__proto__=u}}class oa extends Error{constructor(l="A timeout occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class zt extends Error{constructor(l="An abort occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class mp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="UnsupportedTransportError",this.__proto__=u}}class pp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="DisabledTransportError",this.__proto__=u}}class xp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="FailedToStartTransportError",this.__proto__=u}}class Nd extends Error{constructor(l){const o=new.target.prototype;super(l),this.errorType="FailedToNegotiateWithServerError",this.__proto__=o}}class gp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.innerErrors=o,this.__proto__=u}}class Wd{constructor(l,o,u){this.statusCode=l,this.statusText=o,this.content=u}}class Vl{get(l,o){return this.send({...o,method:"GET",url:l})}post(l,o){return this.send({...o,method:"POST",url:l})}delete(l,o){return this.send({...o,method:"DELETE",url:l})}getCookieString(l){return""}}var R;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(R||(R={}));class wr{constructor(){}log(l,o){}}wr.instance=new wr;const vp="8.0.29";class qe{static isRequired(l,o){if(l==null)throw new Error(`The '${o}' argument is required.`)}static isNotEmpty(l,o){if(!l||l.match(/^\s*$/))throw new Error(`The '${o}' argument should not be empty.`)}static isIn(l,o,u){if(!(l in o))throw new Error(`Unknown ${u} value: ${l}.`)}}class ze{static get isBrowser(){return!ze.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!ze.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!ze.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function jr(a,l){let o="";return Wn(a)?(o=`Binary data of length ${a.byteLength}`,l&&(o+=`. Content: '${yp(a)}'`)):typeof a=="string"&&(o=`String data of length ${a.length}`,l&&(o+=`. Content: '${a}'`)),o}function yp(a){const l=new Uint8Array(a);let o="";return l.forEach(u=>{const d=u<16?"0":"";o+=`0x${d}${u.toString(16)} `}),o.substr(0,o.length-1)}function Wn(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function Vd(a,l,o,u,d,f){const m={},[y,p]=Cs();m[y]=p,a.log(R.Trace,`(${l} transport) sending data. ${jr(d,f.logMessageContent)}.`);const j=Wn(d)?"arraybuffer":"text",C=await o.post(u,{content:d,headers:{...m,...f.headers},responseType:j,timeout:f.timeout,withCredentials:f.withCredentials});a.log(R.Trace,`(${l} transport) request complete. Response status: ${C.statusCode}.`)}function wp(a){return a===void 0?new Ol(R.Information):a===null?wr.instance:a.log!==void 0?a:new Ol(a)}class jp{constructor(l,o){this._subject=l,this._observer=o}dispose(){const l=this._subject.observers.indexOf(this._observer);l>-1&&this._subject.observers.splice(l,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(o=>{})}}class Ol{constructor(l){this._minLevel=l,this.out=console}log(l,o){if(l>=this._minLevel){const u=`[${new Date().toISOString()}] ${R[l]}: ${o}`;switch(l){case R.Critical:case R.Error:this.out.error(u);break;case R.Warning:this.out.warn(u);break;case R.Information:this.out.info(u);break;default:this.out.log(u);break}}}}function Cs(){let a="X-SignalR-User-Agent";return ze.isNode&&(a="User-Agent"),[a,Np(vp,bp(),kp(),_p())]}function Np(a,l,o,u){let d="Microsoft SignalR/";const f=a.split(".");return d+=`${f[0]}.${f[1]}`,d+=` (${a}; `,l&&l!==""?d+=`${l}; `:d+="Unknown OS; ",d+=`${o}`,u?d+=`; ${u}`:d+="; Unknown Runtime Version",d+=")",d}function bp(){if(ze.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function _p(){if(ze.isNode)return process.versions.node}function kp(){return ze.isNode?"NodeJS":"Browser"}function Vo(a){return a.stack?a.stack:a.message?a.message:`${a}`}function Sp(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Cp extends Vl{constructor(l){if(super(),this._logger=l,typeof fetch>"u"||ze.isNode){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(o("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=o("node-fetch"):this._fetchType=fetch,this._fetchType=o("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Sp());if(typeof AbortController>"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=o("abort-controller")}else this._abortControllerType=AbortController}async send(l){if(l.abortSignal&&l.abortSignal.aborted)throw new zt;if(!l.method)throw new Error("No method defined.");if(!l.url)throw new Error("No url defined.");const o=new this._abortControllerType;let u;l.abortSignal&&(l.abortSignal.onabort=()=>{o.abort(),u=new zt});let d=null;if(l.timeout){const p=l.timeout;d=setTimeout(()=>{o.abort(),this._logger.log(R.Warning,"Timeout from HTTP request."),u=new oa},p)}l.content===""&&(l.content=void 0),l.content&&(l.headers=l.headers||{},Wn(l.content)?l.headers["Content-Type"]="application/octet-stream":l.headers["Content-Type"]="text/plain;charset=UTF-8");let f;try{f=await this._fetchType(l.url,{body:l.content,cache:"no-cache",credentials:l.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...l.headers},method:l.method,mode:"cors",redirect:"follow",signal:o.signal})}catch(p){throw u||(this._logger.log(R.Warning,`Error from HTTP request. ${p}.`),p)}finally{d&&clearTimeout(d),l.abortSignal&&(l.abortSignal.onabort=null)}if(!f.ok){const p=await bd(f,"text");throw new Fn(p||f.statusText,f.status)}const y=await bd(f,l.responseType);return new Wd(f.status,f.statusText,y)}getCookieString(l){let o="";return ze.isNode&&this._jar&&this._jar.getCookies(l,(u,d)=>o=d.join("; ")),o}}function bd(a,l){let o;switch(l){case"arraybuffer":o=a.arrayBuffer();break;case"text":o=a.text();break;case"blob":case"document":case"json":throw new Error(`${l} is not supported.`);default:o=a.text();break}return o}class Ep extends Vl{constructor(l){super(),this._logger=l}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?new Promise((o,u)=>{const d=new XMLHttpRequest;d.open(l.method,l.url,!0),d.withCredentials=l.withCredentials===void 0?!0:l.withCredentials,d.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.content===""&&(l.content=void 0),l.content&&(Wn(l.content)?d.setRequestHeader("Content-Type","application/octet-stream"):d.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const f=l.headers;f&&Object.keys(f).forEach(m=>{d.setRequestHeader(m,f[m])}),l.responseType&&(d.responseType=l.responseType),l.abortSignal&&(l.abortSignal.onabort=()=>{d.abort(),u(new zt)}),l.timeout&&(d.timeout=l.timeout),d.onload=()=>{l.abortSignal&&(l.abortSignal.onabort=null),d.status>=200&&d.status<300?o(new Wd(d.status,d.statusText,d.response||d.responseText)):u(new Fn(d.response||d.responseText||d.statusText,d.status))},d.onerror=()=>{this._logger.log(R.Warning,`Error from HTTP request. ${d.status}: ${d.statusText}.`),u(new Fn(d.statusText,d.status))},d.ontimeout=()=>{this._logger.log(R.Warning,"Timeout from HTTP request."),u(new oa)},d.send(l.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Tp extends Vl{constructor(l){if(super(),typeof fetch<"u"||ze.isNode)this._httpClient=new Cp(l);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ep(l);else throw new Error("No usable HttpClient found.")}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?this._httpClient.send(l):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(l){return this._httpClient.getCookieString(l)}}class Nt{static write(l){return`${l}${Nt.RecordSeparator}`}static parse(l){if(l[l.length-1]!==Nt.RecordSeparator)throw new Error("Message is incomplete.");const o=l.split(Nt.RecordSeparator);return o.pop(),o}}Nt.RecordSeparatorCode=30;Nt.RecordSeparator=String.fromCharCode(Nt.RecordSeparatorCode);class Pp{writeHandshakeRequest(l){return Nt.write(JSON.stringify(l))}parseHandshakeResponse(l){let o,u;if(Wn(l)){const y=new Uint8Array(l),p=y.indexOf(Nt.RecordSeparatorCode);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=String.fromCharCode.apply(null,Array.prototype.slice.call(y.slice(0,j))),u=y.byteLength>j?y.slice(j).buffer:null}else{const y=l,p=y.indexOf(Nt.RecordSeparator);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=y.substring(0,j),u=y.length>j?y.substring(j):null}const d=Nt.parse(o),f=JSON.parse(d[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[u,f]}}var ue;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close",a[a.Ack=8]="Ack",a[a.Sequence=9]="Sequence"})(ue||(ue={}));class Ip{constructor(){this.observers=[]}next(l){for(const o of this.observers)o.next(l)}error(l){for(const o of this.observers)o.error&&o.error(l)}complete(){for(const l of this.observers)l.complete&&l.complete()}subscribe(l){return this.observers.push(l),new jp(this,l)}}class Rp{constructor(l,o,u){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=l,this._connection=o,this._bufferSize=u}async _send(l){const o=this._protocol.writeMessage(l);let u=Promise.resolve();if(this._isInvocationMessage(l)){this._totalMessageCount++;let d=()=>{},f=()=>{};Wn(o)?this._bufferedByteCount+=o.byteLength:this._bufferedByteCount+=o.length,this._bufferedByteCount>=this._bufferSize&&(u=new Promise((m,y)=>{d=m,f=y})),this._messages.push(new Lp(o,this._totalMessageCount,d,f))}try{this._reconnectInProgress||await this._connection.send(o)}catch{this._disconnected()}await u}_ack(l){let o=-1;for(let u=0;uthis._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=l.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const l=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:ue.Sequence,sequenceId:l}));const o=this._messages;for(const u of o)await this._connection.send(u._message);this._reconnectInProgress=!1}_dispose(l){l??(l=new Error("Unable to reconnect to server."));for(const o of this._messages)o._rejector(l)}_isInvocationMessage(l){switch(l.type){case ue.Invocation:case ue.StreamItem:case ue.Completion:case ue.StreamInvocation:case ue.CancelInvocation:return!0;case ue.Close:case ue.Sequence:case ue.Ping:case ue.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:ue.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Lp{constructor(l,o,u,d){this._message=l,this._id=o,this._resolver=u,this._rejector=d}}const Dp=30*1e3,$p=15*1e3,Mp=1e5;var Ce;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(Ce||(Ce={}));class aa{static create(l,o,u,d,f,m,y){return new aa(l,o,u,d,f,m,y)}constructor(l,o,u,d,f,m,y){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(R.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},qe.isRequired(l,"connection"),qe.isRequired(o,"logger"),qe.isRequired(u,"protocol"),this.serverTimeoutInMilliseconds=f??Dp,this.keepAliveIntervalInMilliseconds=m??$p,this._statefulReconnectBufferSize=y??Mp,this._logger=o,this._protocol=u,this.connection=l,this._reconnectPolicy=d,this._handshakeProtocol=new Pp,this.connection.onreceive=p=>this._processIncomingData(p),this.connection.onclose=p=>this._connectionClosed(p),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ce.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:ue.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(l){if(this._connectionState!==Ce.Disconnected&&this._connectionState!==Ce.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!l)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=l}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ce.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ce.Connecting,this._logger.log(R.Debug,"Starting HubConnection.");try{await this._startInternal(),ze.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ce.Connected,this._connectionStarted=!0,this._logger.log(R.Debug,"HubConnection connected successfully.")}catch(l){return this._connectionState=Ce.Disconnected,this._logger.log(R.Debug,`HubConnection failed to start successfully because of error '${l}'.`),Promise.reject(l)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const l=new Promise((o,u)=>{this._handshakeResolver=o,this._handshakeRejecter=u});await this.connection.start(this._protocol.transferFormat);try{let o=this._protocol.version;this.connection.features.reconnect||(o=1);const u={protocol:this._protocol.name,version:o};if(this._logger.log(R.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(u)),this._logger.log(R.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await l,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Rp(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(o){throw this._logger.log(R.Debug,`Hub handshake failed with error '${o}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(o),o}}async stop(){const l=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await l}catch{}}_stopInternal(l){if(this._connectionState===Ce.Disconnected)return this._logger.log(R.Debug,`Call to HubConnection.stop(${l}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ce.Disconnecting)return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const o=this._connectionState;return this._connectionState=Ce.Disconnecting,this._logger.log(R.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(R.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(o===Ce.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=l||new zt("The connection was stopped before the hub handshake could complete."),this.connection.stop(l))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createStreamInvocation(l,o,d);let m;const y=new Ip;return y.cancelCallback=()=>{const p=this._createCancelInvocation(f.invocationId);return delete this._callbacks[f.invocationId],m.then(()=>this._sendWithProtocol(p))},this._callbacks[f.invocationId]=(p,j)=>{if(j){y.error(j);return}else p&&(p.type===ue.Completion?p.error?y.error(new Error(p.error)):y.complete():y.next(p.item))},m=this._sendWithProtocol(f).catch(p=>{y.error(p),delete this._callbacks[f.invocationId]}),this._launchStreams(u,m),y}_sendMessage(l){return this._resetKeepAliveInterval(),this.connection.send(l)}_sendWithProtocol(l){return this._messageBuffer?this._messageBuffer._send(l):this._sendMessage(this._protocol.writeMessage(l))}send(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._sendWithProtocol(this._createInvocation(l,o,!0,d));return this._launchStreams(u,f),f}invoke(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createInvocation(l,o,!1,d);return new Promise((y,p)=>{this._callbacks[f.invocationId]=(C,S)=>{if(S){p(S);return}else C&&(C.type===ue.Completion?C.error?p(new Error(C.error)):y(C.result):p(new Error(`Unexpected message type: ${C.type}`)))};const j=this._sendWithProtocol(f).catch(C=>{p(C),delete this._callbacks[f.invocationId]});this._launchStreams(u,j)})}on(l,o){!l||!o||(l=l.toLowerCase(),this._methods[l]||(this._methods[l]=[]),this._methods[l].indexOf(o)===-1&&this._methods[l].push(o))}off(l,o){if(!l)return;l=l.toLowerCase();const u=this._methods[l];if(u)if(o){const d=u.indexOf(o);d!==-1&&(u.splice(d,1),u.length===0&&delete this._methods[l])}else delete this._methods[l]}onclose(l){l&&this._closedCallbacks.push(l)}onreconnecting(l){l&&this._reconnectingCallbacks.push(l)}onreconnected(l){l&&this._reconnectedCallbacks.push(l)}_processIncomingData(l){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(l=this._processHandshakeResponse(l),this._receivedHandshakeResponse=!0),l){const o=this._protocol.parseMessages(l,this._logger);for(const u of o)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(u)))switch(u.type){case ue.Invocation:this._invokeClientMethod(u).catch(d=>{this._logger.log(R.Error,`Invoke client method threw error: ${Vo(d)}`)});break;case ue.StreamItem:case ue.Completion:{const d=this._callbacks[u.invocationId];if(d){u.type===ue.Completion&&delete this._callbacks[u.invocationId];try{d(u)}catch(f){this._logger.log(R.Error,`Stream callback threw error: ${Vo(f)}`)}}break}case ue.Ping:break;case ue.Close:{this._logger.log(R.Information,"Close message received from server.");const d=u.error?new Error("Server returned an error on close: "+u.error):void 0;u.allowReconnect===!0?this.connection.stop(d):this._stopPromise=this._stopInternal(d);break}case ue.Ack:this._messageBuffer&&this._messageBuffer._ack(u);break;case ue.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(u);break;default:this._logger.log(R.Warning,`Invalid message type: ${u.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(l){let o,u;try{[u,o]=this._handshakeProtocol.parseHandshakeResponse(l)}catch(d){const f="Error parsing handshake response: "+d;this._logger.log(R.Error,f);const m=new Error(f);throw this._handshakeRejecter(m),m}if(o.error){const d="Server returned handshake error: "+o.error;this._logger.log(R.Error,d);const f=new Error(d);throw this._handshakeRejecter(f),f}else this._logger.log(R.Debug,"Server handshake complete.");return this._handshakeResolver(),u}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let l=this._nextKeepAlive-new Date().getTime();l<0&&(l=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===Ce.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},l)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(l){const o=l.target.toLowerCase(),u=this._methods[o];if(!u){this._logger.log(R.Warning,`No client method with the name '${o}' found.`),l.invocationId&&(this._logger.log(R.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)));return}const d=u.slice(),f=!!l.invocationId;let m,y,p;for(const j of d)try{const C=m;m=await j.apply(this,l.arguments),f&&m&&C&&(this._logger.log(R.Error,`Multiple results provided for '${o}'. Sending error to server.`),p=this._createCompletionMessage(l.invocationId,"Client provided multiple results.",null)),y=void 0}catch(C){y=C,this._logger.log(R.Error,`A callback for the method '${o}' threw error '${C}'.`)}p?await this._sendWithProtocol(p):f?(y?p=this._createCompletionMessage(l.invocationId,`${y}`,null):m!==void 0?p=this._createCompletionMessage(l.invocationId,null,m):(this._logger.log(R.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),p=this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(p)):m&&this._logger.log(R.Error,`Result given for '${o}' method but server is not expecting a result.`)}_connectionClosed(l){this._logger.log(R.Debug,`HubConnection.connectionClosed(${l}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||l||new zt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(l||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ce.Disconnecting?this._completeClose(l):this._connectionState===Ce.Connected&&this._reconnectPolicy?this._reconnect(l):this._connectionState===Ce.Connected&&this._completeClose(l)}_completeClose(l){if(this._connectionStarted){this._connectionState=Ce.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(l??new Error("Connection closed.")),this._messageBuffer=void 0),ze.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(o=>o.apply(this,[l]))}catch(o){this._logger.log(R.Error,`An onclose callback called with error '${l}' threw error '${o}'.`)}}}async _reconnect(l){const o=Date.now();let u=0,d=l!==void 0?l:new Error("Attempting to reconnect due to a unknown error."),f=this._getNextRetryDelay(u++,0,d);if(f===null){this._logger.log(R.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(l);return}if(this._connectionState=Ce.Reconnecting,l?this._logger.log(R.Information,`Connection reconnecting because of error '${l}'.`):this._logger.log(R.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(m=>m.apply(this,[l]))}catch(m){this._logger.log(R.Error,`An onreconnecting callback called with error '${l}' threw error '${m}'.`)}if(this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;f!==null;){if(this._logger.log(R.Information,`Reconnect attempt number ${u} will start in ${f} ms.`),await new Promise(m=>{this._reconnectDelayHandle=setTimeout(m,f)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ce.Connected,this._logger.log(R.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(m=>m.apply(this,[this.connection.connectionId]))}catch(m){this._logger.log(R.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${m}'.`)}return}catch(m){if(this._logger.log(R.Information,`Reconnect attempt failed because of error '${m}'.`),this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ce.Disconnecting&&this._completeClose();return}d=m instanceof Error?m:new Error(m.toString()),f=this._getNextRetryDelay(u++,Date.now()-o,d)}}this._logger.log(R.Information,`Reconnect retries have been exhausted after ${Date.now()-o} ms and ${u} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(l,o,u){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:o,previousRetryCount:l,retryReason:u})}catch(d){return this._logger.log(R.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${l}, ${o}) threw error '${d}'.`),null}}_cancelCallbacksWithError(l){const o=this._callbacks;this._callbacks={},Object.keys(o).forEach(u=>{const d=o[u];try{d(null,l)}catch(f){this._logger.log(R.Error,`Stream 'error' callback called with '${l}' threw error: ${Vo(f)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(l,o,u,d){if(u)return d.length!==0?{arguments:o,streamIds:d,target:l,type:ue.Invocation}:{arguments:o,target:l,type:ue.Invocation};{const f=this._invocationId;return this._invocationId++,d.length!==0?{arguments:o,invocationId:f.toString(),streamIds:d,target:l,type:ue.Invocation}:{arguments:o,invocationId:f.toString(),target:l,type:ue.Invocation}}}_launchStreams(l,o){if(l.length!==0){o||(o=Promise.resolve());for(const u in l)l[u].subscribe({complete:()=>{o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u)))},error:d=>{let f;d instanceof Error?f=d.message:d&&d.toString?f=d.toString():f="Unknown error",o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u,f)))},next:d=>{o=o.then(()=>this._sendWithProtocol(this._createStreamItemMessage(u,d)))}})}}_replaceStreamingParams(l){const o=[],u=[];for(let d=0;d0)&&(o=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(l);const u=await this._innerClient.send(l);return o&&u.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(l),await this._innerClient.send(l)):u}_setAuthorizationHeader(l){l.headers||(l.headers={}),this._accessToken?l.headers[Bn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&l.headers[Bn.Authorization]&&delete l.headers[Bn.Authorization]}getCookieString(l){return this._innerClient.getCookieString(l)}}var Xe;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(Xe||(Xe={}));var it;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(it||(it={}));let Op=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class kd{get pollAborted(){return this._pollAbort.aborted}constructor(l,o,u){this._httpClient=l,this._logger=o,this._pollAbort=new Op,this._options=u,this._running=!1,this.onreceive=null,this.onclose=null}async connect(l,o){if(qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._url=l,this._logger.log(R.Trace,"(LongPolling transport) Connecting."),o===it.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[u,d]=Cs(),f={[u]:d,...this._options.headers},m={abortSignal:this._pollAbort.signal,headers:f,timeout:1e5,withCredentials:this._options.withCredentials};o===it.Binary&&(m.responseType="arraybuffer");const y=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${y}.`);const p=await this._httpClient.get(y,m);p.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${p.statusCode}.`),this._closeError=new Fn(p.statusText||"",p.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,m)}async _poll(l,o){try{for(;this._running;)try{const u=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${u}.`);const d=await this._httpClient.get(u,o);d.statusCode===204?(this._logger.log(R.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):d.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${d.statusCode}.`),this._closeError=new Fn(d.statusText||"",d.statusCode),this._running=!1):d.content?(this._logger.log(R.Trace,`(LongPolling transport) data received. ${jr(d.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(d.content)):this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(u){this._running?u instanceof oa?this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=u,this._running=!1):this._logger.log(R.Trace,`(LongPolling transport) Poll errored after shutdown: ${u.message}`)}}finally{this._logger.log(R.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(l){return this._running?Vd(this._logger,"LongPolling",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(R.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(R.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const l={},[o,u]=Cs();l[o]=u;const d={headers:{...l,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let f;try{await this._httpClient.delete(this._url,d)}catch(m){f=m}f?f instanceof Fn&&(f.statusCode===404?this._logger.log(R.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(R.Trace,`(LongPolling transport) Error sending a DELETE request: ${f}`)):this._logger.log(R.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(R.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let l="(LongPolling transport) Firing onclose event.";this._closeError&&(l+=" Error: "+this._closeError),this._logger.log(R.Trace,l),this.onclose(this._closeError)}}}class Up{constructor(l,o,u,d){this._httpClient=l,this._accessToken=o,this._logger=u,this._options=d,this.onreceive=null,this.onclose=null}async connect(l,o){return qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(R.Trace,"(SSE transport) Connecting."),this._url=l,this._accessToken&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((u,d)=>{let f=!1;if(o!==it.Text){d(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let m;if(ze.isBrowser||ze.isWebWorker)m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials});else{const y=this._httpClient.getCookieString(l),p={};p.Cookie=y;const[j,C]=Cs();p[j]=C,m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials,headers:{...p,...this._options.headers}})}try{m.onmessage=y=>{if(this.onreceive)try{this._logger.log(R.Trace,`(SSE transport) data received. ${jr(y.data,this._options.logMessageContent)}.`),this.onreceive(y.data)}catch(p){this._close(p);return}},m.onerror=y=>{f?this._close():d(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},m.onopen=()=>{this._logger.log(R.Information,`SSE connected to ${this._url}`),this._eventSource=m,f=!0,u()}}catch(y){d(y);return}})}async send(l){return this._eventSource?Vd(this._logger,"SSE",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(l){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(l))}}class Fp{constructor(l,o,u,d,f,m){this._logger=u,this._accessTokenFactory=o,this._logMessageContent=d,this._webSocketConstructor=f,this._httpClient=l,this.onreceive=null,this.onclose=null,this._headers=m}async connect(l,o){qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(R.Trace,"(WebSockets transport) Connecting.");let u;return this._accessTokenFactory&&(u=await this._accessTokenFactory()),new Promise((d,f)=>{l=l.replace(/^http/,"ws");let m;const y=this._httpClient.getCookieString(l);let p=!1;if(ze.isNode||ze.isReactNative){const j={},[C,S]=Cs();j[C]=S,u&&(j[Bn.Authorization]=`Bearer ${u}`),y&&(j[Bn.Cookie]=y),m=new this._webSocketConstructor(l,void 0,{headers:{...j,...this._headers}})}else u&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(u)}`);m||(m=new this._webSocketConstructor(l)),o===it.Binary&&(m.binaryType="arraybuffer"),m.onopen=j=>{this._logger.log(R.Information,`WebSocket connected to ${l}.`),this._webSocket=m,p=!0,d()},m.onerror=j=>{let C=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?C=j.error:C="There was an error with the transport",this._logger.log(R.Information,`(WebSockets transport) ${C}.`)},m.onmessage=j=>{if(this._logger.log(R.Trace,`(WebSockets transport) data received. ${jr(j.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(j.data)}catch(C){this._close(C);return}},m.onclose=j=>{if(p)this._close(j);else{let C=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?C=j.error:C="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",f(new Error(C))}}})}send(l){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(R.Trace,`(WebSockets transport) sending data. ${jr(l,this._logMessageContent)}.`),this._webSocket.send(l),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(l){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(R.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(l)&&(l.wasClean===!1||l.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${l.code} (${l.reason||"no reason given"}).`)):l instanceof Error?this.onclose(l):this.onclose())}_isCloseEvent(l){return l&&typeof l.wasClean=="boolean"&&typeof l.code=="number"}}const Sd=100;class Bp{constructor(l,o={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,qe.isRequired(l,"url"),this._logger=wp(o.logger),this.baseUrl=this._resolveUrl(l),o=o||{},o.logMessageContent=o.logMessageContent===void 0?!1:o.logMessageContent,typeof o.withCredentials=="boolean"||o.withCredentials===void 0)o.withCredentials=o.withCredentials===void 0?!0:o.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");o.timeout=o.timeout===void 0?100*1e3:o.timeout;let u=null,d=null;if(ze.isNode&&typeof require<"u"){const f=typeof __webpack_require__=="function"?__non_webpack_require__:require;u=f("ws"),d=f("eventsource")}!ze.isNode&&typeof WebSocket<"u"&&!o.WebSocket?o.WebSocket=WebSocket:ze.isNode&&!o.WebSocket&&u&&(o.WebSocket=u),!ze.isNode&&typeof EventSource<"u"&&!o.EventSource?o.EventSource=EventSource:ze.isNode&&!o.EventSource&&typeof d<"u"&&(o.EventSource=d),this._httpClient=new zp(o.httpClient||new Tp(this._logger),o.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=o,this.onreceive=null,this.onclose=null}async start(l){if(l=l||it.Binary,qe.isIn(l,it,"transferFormat"),this._logger.log(R.Debug,`Starting connection with transfer format '${it[l]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(l),await this._startInternalPromise,this._connectionState==="Disconnecting"){const o="Failed to start the HttpConnection before stop() was called.";return this._logger.log(R.Error,o),await this._stopPromise,Promise.reject(new zt(o))}else if(this._connectionState!=="Connected"){const o="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(R.Error,o),Promise.reject(new zt(o))}this._connectionStarted=!0}send(l){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ca(this.transport)),this._sendQueue.send(l))}async stop(l){if(this._connectionState==="Disconnected")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(o=>{this._stopPromiseResolver=o}),await this._stopInternal(l),await this._stopPromise}async _stopInternal(l){this._stopError=l;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(o){this._logger.log(R.Error,`HttpConnection.transport.stop() threw error '${o}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(R.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(l){let o=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Xe.WebSockets)this.transport=this._constructTransport(Xe.WebSockets),await this._startTransport(o,l);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let u=null,d=0;do{if(u=await this._getNegotiationResponse(o),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new zt("The connection was stopped during negotiation.");if(u.error)throw new Error(u.error);if(u.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(u.url&&(o=u.url),u.accessToken){const f=u.accessToken;this._accessTokenFactory=()=>f,this._httpClient._accessToken=f,this._httpClient._accessTokenFactory=void 0}d++}while(u.url&&d0?Promise.reject(new gp(`Unable to connect to the server with any of the available transports. ${m.join(" ")}`,m)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(l){switch(l){case Xe.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Fp(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Xe.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Up(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Xe.LongPolling:return new kd(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${l}.`)}}_startTransport(l,o){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async u=>{let d=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(l,o),await this.features.resend()}catch{d=!0}else{this._stopConnection(u);return}d&&this._stopConnection(u)}:this.transport.onclose=u=>this._stopConnection(u),this.transport.connect(l,o)}_resolveTransportOrError(l,o,u,d){const f=Xe[l.transport];if(f==null)return this._logger.log(R.Debug,`Skipping transport '${l.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${l.transport}' because it is not supported by this client.`);if(Hp(o,f))if(l.transferFormats.map(y=>it[y]).indexOf(u)>=0){if(f===Xe.WebSockets&&!this._options.WebSocket||f===Xe.ServerSentEvents&&!this._options.EventSource)return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it is not supported in your environment.'`),new mp(`'${Xe[f]}' is not supported in your environment.`,f);this._logger.log(R.Debug,`Selecting transport '${Xe[f]}'.`);try{return this.features.reconnect=f===Xe.WebSockets?d:void 0,this._constructTransport(f)}catch(y){return y}}else return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it does not support the requested transfer format '${it[u]}'.`),new Error(`'${Xe[f]}' does not support ${it[u]}.`);else return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it was disabled by the client.`),new pp(`'${Xe[f]}' is disabled by the client.`,f)}_isITransport(l){return l&&typeof l=="object"&&"connect"in l}_stopConnection(l){if(this._logger.log(R.Debug,`HttpConnection.stopConnection(${l}) called while in state ${this._connectionState}.`),this.transport=void 0,l=this._stopError||l,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(R.Debug,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(R.Warning,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${l}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),l?this._logger.log(R.Error,`Connection disconnected with error '${l}'.`):this._logger.log(R.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(o=>{this._logger.log(R.Error,`TransportSendQueue.stop() threw error '${o}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(l)}catch(o){this._logger.log(R.Error,`HttpConnection.onclose(${l}) threw error '${o}'.`)}}}_resolveUrl(l){if(l.lastIndexOf("https://",0)===0||l.lastIndexOf("http://",0)===0)return l;if(!ze.isBrowser)throw new Error(`Cannot resolve '${l}'.`);const o=window.document.createElement("a");return o.href=l,this._logger.log(R.Information,`Normalizing '${l}' to '${o.href}'.`),o.href}_resolveNegotiateUrl(l){const o=new URL(l);o.pathname.endsWith("/")?o.pathname+="negotiate":o.pathname+="/negotiate";const u=new URLSearchParams(o.searchParams);return u.has("negotiateVersion")||u.append("negotiateVersion",this._negotiateVersion.toString()),u.has("useStatefulReconnect")?u.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&u.append("useStatefulReconnect","true"),o.search=u.toString(),o.toString()}}function Hp(a,l){return!a||(l&a)!==0}class ca{constructor(l){this._transport=l,this._buffer=[],this._executing=!0,this._sendBufferedData=new Al,this._transportResult=new Al,this._sendLoopPromise=this._sendLoop()}send(l){return this._bufferData(l),this._transportResult||(this._transportResult=new Al),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(l){if(this._buffer.length&&typeof this._buffer[0]!=typeof l)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof l}`);this._buffer.push(l),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Al;const l=this._transportResult;this._transportResult=void 0;const o=typeof this._buffer[0]=="string"?this._buffer.join(""):ca._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(o),l.resolve()}catch(u){l.reject(u)}}}static _concatBuffers(l){const o=l.map(f=>f.byteLength).reduce((f,m)=>f+m),u=new Uint8Array(o);let d=0;for(const f of l)u.set(new Uint8Array(f),d),d+=f.byteLength;return u.buffer}}class Al{constructor(){this.promise=new Promise((l,o)=>[this._resolver,this._rejecter]=[l,o])}resolve(){this._resolver()}reject(l){this._rejecter(l)}}const Wp="json";class Vp{constructor(){this.name=Wp,this.version=2,this.transferFormat=it.Text}parseMessages(l,o){if(typeof l!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!l)return[];o===null&&(o=wr.instance);const u=Nt.parse(l),d=[];for(const f of u){const m=JSON.parse(f);if(typeof m.type!="number")throw new Error("Invalid payload.");switch(m.type){case ue.Invocation:this._isInvocationMessage(m);break;case ue.StreamItem:this._isStreamItemMessage(m);break;case ue.Completion:this._isCompletionMessage(m);break;case ue.Ping:break;case ue.Close:break;case ue.Ack:this._isAckMessage(m);break;case ue.Sequence:this._isSequenceMessage(m);break;default:o.log(R.Information,"Unknown message type '"+m.type+"' ignored.");continue}d.push(m)}return d}writeMessage(l){return Nt.write(JSON.stringify(l))}_isInvocationMessage(l){this._assertNotEmptyString(l.target,"Invalid payload for Invocation message."),l.invocationId!==void 0&&this._assertNotEmptyString(l.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(l){if(this._assertNotEmptyString(l.invocationId,"Invalid payload for StreamItem message."),l.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(l){if(l.result&&l.error)throw new Error("Invalid payload for Completion message.");!l.result&&l.error&&this._assertNotEmptyString(l.error,"Invalid payload for Completion message."),this._assertNotEmptyString(l.invocationId,"Invalid payload for Completion message.")}_isAckMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(l,o){if(typeof l!="string"||l==="")throw new Error(o)}}const Qp={trace:R.Trace,debug:R.Debug,info:R.Information,information:R.Information,warn:R.Warning,warning:R.Warning,error:R.Error,critical:R.Critical,none:R.None};function qp(a){const l=Qp[a.toLowerCase()];if(typeof l<"u")return l;throw new Error(`Unknown log level: ${a}`)}class Kp{configureLogging(l){if(qe.isRequired(l,"logging"),Jp(l))this.logger=l;else if(typeof l=="string"){const o=qp(l);this.logger=new Ol(o)}else this.logger=new Ol(l);return this}withUrl(l,o){return qe.isRequired(l,"url"),qe.isNotEmpty(l,"url"),this.url=l,typeof o=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...o}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:o},this}withHubProtocol(l){return qe.isRequired(l,"protocol"),this.protocol=l,this}withAutomaticReconnect(l){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return l?Array.isArray(l)?this.reconnectPolicy=new _d(l):this.reconnectPolicy=l:this.reconnectPolicy=new _d,this}withServerTimeout(l){return qe.isRequired(l,"milliseconds"),this._serverTimeoutInMilliseconds=l,this}withKeepAliveInterval(l){return qe.isRequired(l,"milliseconds"),this._keepAliveIntervalInMilliseconds=l,this}withStatefulReconnect(l){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=l==null?void 0:l.bufferSize,this}build(){const l=this.httpConnectionOptions||{};if(l.logger===void 0&&(l.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const o=new Bp(this.url,l);return aa.create(o,this.logger||wr.instance,this.protocol||new Vp,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Jp(a){return a.log!==void 0}class Xp{constructor(){xt(this,"connection",null);xt(this,"state","Disconnected");xt(this,"startPromise",null);xt(this,"permanentRetryTimer",null);xt(this,"isAuthenticated",!1);xt(this,"stateListeners",new Set);xt(this,"ackListeners",new Set);xt(this,"deviceStatusListeners",new Set);xt(this,"healthReportListeners",new Set);xt(this,"notificationListeners",new Set);xt(this,"cancelledListeners",new Set);Ns.subscribe(()=>{this.stop()})}getState(){return this.state}setState(l){this.state!==l&&(this.state=l,this.stateListeners.forEach(o=>o(l)))}onStateChange(l){return this.stateListeners.add(l),l(this.state),()=>this.stateListeners.delete(l)}onAckReceiptReceived(l){return this.ackListeners.add(l),()=>this.ackListeners.delete(l)}onDeviceStatusChanged(l){return this.deviceStatusListeners.add(l),()=>this.deviceStatusListeners.delete(l)}onHealthReportReceived(l){return this.healthReportListeners.add(l),()=>this.healthReportListeners.delete(l)}onNewNotificationBroadcast(l){return this.notificationListeners.add(l),()=>this.notificationListeners.delete(l)}onNotificationCancelled(l){return this.cancelledListeners.add(l),()=>this.cancelledListeners.delete(l)}async start(){var o,u;if(!Ss()){this.setState("Disconnected");return}if(this.isAuthenticated=!0,((o=this.connection)==null?void 0:o.state)===Ce.Connected){this.setState("Connected");return}return this.startPromise?this.startPromise:(this.connection||this.buildConnection(),this.setState(((u=this.connection)==null?void 0:u.state)===Ce.Reconnecting?"Reconnecting":"Connecting"),this.startPromise=(async()=>{try{this.connection&&this.connection.state===Ce.Disconnected&&(await this.connection.start(),this.setState("Connected"),this.clearPermanentRetryTimer())}catch(d){console.warn("SignalR start failed:",d),this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}finally{this.startPromise=null}})(),this.startPromise)}async stop(){if(this.isAuthenticated=!1,this.clearPermanentRetryTimer(),this.setState("Disconnected"),this.startPromise){try{await this.startPromise}catch{}this.startPromise=null}if(this.connection)try{await this.connection.stop()}catch(l){console.warn("Error stopping SignalR connection:",l)}finally{this.connection=null}}buildConnection(){this.connection=new Kp().withUrl("/hubs/teacher",{accessTokenFactory:()=>Ss()||""}).withAutomaticReconnect([0,2e3,5e3,1e4,3e4]).configureLogging(R.Warning).build(),this.connection.onreconnecting(()=>{this.setState("Reconnecting")}),this.connection.onreconnected(()=>{this.setState("Connected"),this.clearPermanentRetryTimer()}),this.connection.onclose(()=>{this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}),this.connection.on("OnAckReceiptReceived",l=>{this.ackListeners.forEach(o=>o(l))}),this.connection.on("OnDeviceStatusChanged",l=>{this.deviceStatusListeners.forEach(o=>o(l))}),this.connection.on("OnHealthReportReceived",l=>{this.healthReportListeners.forEach(o=>o(l))}),this.connection.on("OnNewNotificationBroadcast",l=>{this.notificationListeners.forEach(o=>o(l))}),this.connection.on("OnNotificationCancelled",l=>{this.cancelledListeners.forEach(o=>o(l))})}schedulePermanentRetry(){this.permanentRetryTimer||!this.isAuthenticated||(this.permanentRetryTimer=setInterval(()=>{var l;if(!this.isAuthenticated){this.clearPermanentRetryTimer();return}((l=this.connection)==null?void 0:l.state)===Ce.Disconnected&&this.start()},3e4))}clearPermanentRetryTimer(){this.permanentRetryTimer&&(clearInterval(this.permanentRetryTimer),this.permanentRetryTimer=null)}}const Ot=new Xp,Qd=g.createContext(void 0),Gp=({children:a})=>{const[l,o]=g.useState(()=>{try{const j=localStorage.getItem("classnotify_user");return j?JSON.parse(j):null}catch{return null}}),[u,d]=g.useState(Ss()),[f,m]=g.useState(!0);g.useEffect(()=>{const j=Ns.subscribe(()=>{Ot.stop(),xr(),d(null),o(null)});return()=>j()},[]),g.useEffect(()=>{(async()=>{var S,$;if(Ss())try{const D=await oe.getMe();o(D),localStorage.setItem("classnotify_user",JSON.stringify(D)),Ns.reset(),Ot.start()}catch(D){((S=D==null?void 0:D.message)!=null&&S.includes("未授权")||($=D==null?void 0:D.message)!=null&&$.includes("401"))&&(xr(),d(null),o(null))}else xr(),o(null),d(null);m(!1)})()},[]);const y=async(j,C)=>{const S=await oe.login(j,C);if(!S.success||!S.token||!S.role)throw new Error(S.errorMessage||"登录失败");fp(S.token),d(S.token);const $={userId:S.userId||"",name:S.fullName||j,role:S.role,tenantId:S.tenantId||""};return o($),localStorage.setItem("classnotify_user",JSON.stringify($)),Ns.reset(),Ot.start(),S.role},p=()=>{Ot.stop(),xr(),d(null),o(null),Ns.reset()};return n.jsx(Qd.Provider,{value:{user:l,token:u,login:y,logout:p,isLoading:f},children:a})},Sr=()=>{const a=g.useContext(Qd);if(!a)throw new Error("useAuth must be used within an AuthProvider");return a};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yp=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qd=(...a)=>a.filter((l,o,u)=>!!l&&l.trim()!==""&&u.indexOf(l)===o).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Zp={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e0=g.forwardRef(({color:a="currentColor",size:l=24,strokeWidth:o=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...y},p)=>g.createElement("svg",{ref:p,...Zp,width:l,height:l,stroke:a,strokeWidth:u?Number(o)*24/Number(l):o,className:qd("lucide",d),...y},[...m.map(([j,C])=>g.createElement(j,C)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ae=(a,l)=>{const o=g.forwardRef(({className:u,...d},f)=>g.createElement(e0,{ref:f,iconNode:l,className:qd(`lucide-${Yp(a)}`,u),...d}));return o.displayName=`${a}`,o};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ua=ae("Activity",t0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],js=ae("ArrowRight",n0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s0=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ul=ae("Bell",s0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r0=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Qt=ae("Building2",r0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fl=ae("Check",l0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sn=ae("CircleAlert",i0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pt=ae("CircleCheck",o0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Go=ae("CircleX",a0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Kn=ae("Clock",c0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u0=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]],d0=ae("CloudRain",u0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Yo=ae("Copy",h0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],m0=ae("Eye",f0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],x0=ae("Flame",p0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Nr=ae("GraduationCap",g0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Zo=ae("History",v0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y0=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ut=ae("KeyRound",y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w0=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],gr=ae("Layers",w0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kn=ae("LoaderCircle",j0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ea=ae("LockOpen",N0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bs=ae("Lock",b0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _0=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],k0=ae("LogOut",_0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S0=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],C0=ae("Megaphone",S0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E0=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],T0=ae("Menu",E0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vn=ae("Monitor",P0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I0=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],Kd=ae("PenLine",I0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qn=ae("Plus",R0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L0=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],br=ae("Radio",L0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],bt=ae("RefreshCw",D0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],M0=ae("RotateCcw",$0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A0=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Cd=ae("School",A0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Cr=ae("Search",z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],_r=ae("Send",O0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Bl=ae("ShieldAlert",U0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_s=ae("ShieldCheck",F0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],H0=ae("Shield",B0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Jd=ae("Sparkles",W0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],da=ae("Trash2",V0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ks=ae("TriangleAlert",Q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Xd=ae("User",q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Hn=ae("Users",K0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J0=[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]],X0=ae("Vibrate",J0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Gd=ae("Volume2",G0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kr=ae("X",Y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ex=ae("ZoomIn",Z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tx=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],nx=ae("ZoomOut",tx),ha=()=>{const[a,l]=g.useState(Ot.getState());return g.useEffect(()=>Ot.onStateChange(l),[]),a==="Connected"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"云端已连接"]}):a==="Reconnecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),"正在重连"]}):a==="Connecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400 animate-pulse"}),"正在连接..."]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),"连接断开"]})},sx=()=>{const{user:a,logout:l}=Sr(),o=qn(),[u,d]=g.useState(!1);if(g.useEffect(()=>{d(!1)},[o.pathname]),!a)return null;const f=m=>o.pathname===m;return n.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"flex items-center justify-between h-16",children:[n.jsxs("div",{className:"flex items-center space-x-4",children:[n.jsxs(ge,{to:"/",className:"flex items-center space-x-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:n.jsx(Ul,{className:"w-5 h-5 text-white"})}),n.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),n.jsxs("span",{className:"text-xs px-2.5 py-1 rounded-full font-medium flex items-center gap-1.5 border bg-slate-900 border-slate-800 text-slate-300",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-amber-400"}),n.jsx("span",{className:"text-amber-400 font-semibold",children:"超级运维后台"})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(Cd,{className:"w-3.5 h-3.5 text-sky-400"}),n.jsx("span",{className:"text-sky-400 font-semibold",children:"学校管理后台"})]}),a.role==="Teacher"&&n.jsxs(n.Fragment,{children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]})]}),n.jsx("div",{className:"hidden sm:block",children:n.jsx(ha,{})})]}),n.jsxs("nav",{className:"hidden md:flex items-center space-x-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ge,{to:"/admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"总览"]}),n.jsxs(ge,{to:"/admin/tenants",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Qt,{className:"w-4 h-4"}),"学校租户"]}),n.jsxs(ge,{to:"/admin/users",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"用户中枢"]}),n.jsxs(ge,{to:"/admin/devices",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Vn,{className:"w-4 h-4"}),"设备集控"]}),n.jsxs(ge,{to:"/admin/broadcast",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400 border border-rose-500/30":"text-slate-400 hover:text-rose-300 hover:bg-slate-900"}`,children:[n.jsx(br,{className:"w-4 h-4"}),"应急广播"]}),n.jsxs(ge,{to:"/admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"激活码"]}),n.jsxs(ge,{to:"/admin/history",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Zo,{className:"w-4 h-4"}),"审计"]})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ge,{to:"/school-admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Cd,{className:"w-4 h-4"}),"学校概览"]}),n.jsxs(ge,{to:"/school-admin/classes",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"班级管理"]}),n.jsxs(ge,{to:"/school-admin/teachers",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"教师账号"]}),n.jsxs(ge,{to:"/school-admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/school-admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"本校激活码"]})]}),a.role==="Teacher"&&n.jsxs(ge,{to:"/teacher",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/teacher")?"bg-emerald-600/20 text-emerald-400 border border-emerald-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Ul,{className:"w-4 h-4"}),"呼叫与回执"]})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsxs("div",{className:"hidden sm:flex flex-col text-right",children:[n.jsx("span",{className:"text-sm font-medium text-slate-200",children:a.name}),n.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":a.tenantId})]}),n.jsx("button",{onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 transition-colors",title:"退出登录",children:n.jsx(k0,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>d(!u),className:"md:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-900 border border-slate-800 transition-colors","aria-label":"展开菜单",children:u?n.jsx(kr,{className:"w-5 h-5"}):n.jsx(T0,{className:"w-5 h-5"})})]})]}),u&&n.jsxs("div",{className:"md:hidden py-3 px-2 border-t border-slate-800/80 bg-slate-950/95 space-y-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ge,{to:"/admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gr,{className:"w-4 h-4 text-indigo-400"}),"总览大盘"]})}),n.jsx(ge,{to:"/admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/30":"text-amber-400 bg-amber-500/10 hover:bg-amber-500/20"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"设备激活码生成与管理"]}),n.jsx("span",{className:"text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded border border-amber-500/30 font-bold",children:"重点"})]})}),n.jsx(ge,{to:"/admin/tenants",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"学校租户"]})}),n.jsx(ge,{to:"/admin/users",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hn,{className:"w-4 h-4 text-indigo-400"}),"用户中枢"]})}),n.jsx(ge,{to:"/admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"}),"设备集控"]})}),n.jsx(ge,{to:"/admin/broadcast",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})}),n.jsx(ge,{to:"/admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"审计历史"]})})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ge,{to:"/school-admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"学校概览"}),n.jsx(ge,{to:"/school-admin/classes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"班级管理"}),n.jsx(ge,{to:"/school-admin/teachers",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"教师账号"}),n.jsx(ge,{to:"/school-admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/codes")?"bg-sky-600/20 text-sky-400":"text-amber-400 font-semibold"}`,children:"本校激活码"})]}),a.role==="Teacher"&&n.jsx(ge,{to:"/teacher",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/teacher")?"bg-emerald-600/20 text-emerald-400":"text-slate-300 hover:bg-slate-900"}`,children:"呼叫与回执"})]})]})})},Qo=({allowedRoles:a,children:l})=>{const{user:o,isLoading:u}=Sr();return u?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户权限..."}):o?a.includes(o.role)?l?n.jsx(n.Fragment,{children:l}):n.jsx(Bd,{}):o.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):o.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},rx=()=>{const[a,l]=g.useState(""),[o,u]=g.useState(""),[d,f]=g.useState(null),[m,y]=g.useState(!1),{login:p}=Sr(),j=Wl(),C=async(S=a,$=o)=>{f(null),y(!0);try{const D=await p(S,$);j(D==="SuperAdmin"?"/admin":D==="SchoolAdmin"?"/school-admin":"/teacher")}catch(D){f(D.message||"登录失败,请检查账号密码")}finally{y(!1)}};return n.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/40 relative overflow-hidden",children:[n.jsx("div",{className:"absolute w-96 h-96 bg-indigo-500/10 rounded-full blur-3xl -top-20 -left-20 pointer-events-none"}),n.jsx("div",{className:"absolute w-96 h-96 bg-violet-500/10 rounded-full blur-3xl -bottom-20 -right-20 pointer-events-none"}),n.jsx("div",{className:"w-full max-w-md relative z-10",children:n.jsxs("div",{className:"glass-panel p-8 border-slate-800",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center mx-auto mb-4 shadow-xl shadow-indigo-500/25",children:n.jsx(Ul,{className:"w-8 h-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white",children:"ClassNotify 控制台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1.5",children:"智慧教室通知与设备集控一体化系统"})]}),d&&n.jsxs("div",{className:"mb-6 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-sm flex items-center gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),d]}),n.jsxs("form",{onSubmit:S=>{S.preventDefault(),C()},className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsxs("div",{className:"relative",children:[n.jsx(Xd,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"text",value:a,onChange:S=>l(S.target.value),placeholder:"请输入账号",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录密码"}),n.jsxs("div",{className:"relative",children:[n.jsx(bs,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"password",value:o,onChange:S=>u(S.target.value),placeholder:"请输入密码",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:m?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在验证身份..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"登 录"}),n.jsx(js,{className:"w-4 h-4"})]})})]})]})})]})},lx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState([]),[m,y]=g.useState(null),[p,j]=g.useState([]),[C,S]=g.useState(!0),$=async()=>{try{const[D,H,F,I,q]=await Promise.all([oe.getAdminMetrics(),oe.getTenants(),oe.getAdminNotifications(6),oe.getSystemHealth().catch(()=>null),oe.getAuditLogs(6).catch(()=>[])]);l(D),u(H),f(F),I&&y(I),q&&j(q)}catch(D){console.error("Failed to load admin dashboard data",D)}finally{S(!1)}};return g.useEffect(()=>{$();const D=setInterval($,1e4);return()=>clearInterval(D)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域云控超管总览"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时管控多校区实体、网格化终端生命周期、底层微内核与紧急调度通道"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 self-start sm:self-auto",children:[n.jsxs(ge,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold shadow-md shadow-amber-500/20 active:scale-95 transition-all",children:[n.jsx(ut,{className:"w-4 h-4"}),"生成设备激活码"]}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 rounded-xl bg-slate-900/80 border border-slate-800 text-xs",children:[m!=null&&m.databaseConnected?n.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),n.jsxs("span",{className:"font-medium",children:["PostgreSQL 正常 (",m.databaseLatencyMs.toFixed(1),"ms)"]})]}):n.jsxs("div",{className:"flex items-center gap-2 text-rose-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-500"}),n.jsx("span",{className:"font-medium",children:"数据库异常断开"})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsxs("div",{className:"text-slate-400",children:[n.jsx("span",{children:"在线屏: "}),n.jsx("span",{className:"text-white font-mono",children:(m==null?void 0:m.onlineDevices)??(a==null?void 0:a.onlineDevices)??0})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsx("div",{className:"text-slate-400 font-mono text-[11px]",children:n.jsxs("span",{children:["运行: ",(m==null?void 0:m.uptime)||"99.98%"]})})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"入驻学校 / 租户"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.totalTenants)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"所校区"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"总设备数量"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.totalDevices)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台教室终端"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800 relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"在线设备 (实时连通)"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(ua,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),C?"-":(a==null?void 0:a.onlineDevices)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 离线 ",C?"-":(a==null?void 0:a.offlineDevices)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"今日呼叫通知"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 text-amber-400 flex items-center justify-center",children:n.jsx(Ul,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.todayNotifications)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"次下发"})]})]})]}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"核心管控中枢入口"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4",children:[n.jsxs(ge,{to:"/admin/tenants",className:"glass-panel p-4 border-slate-800 hover:border-indigo-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-indigo-400",children:"学校租户"}),n.jsx("div",{className:"text-xs text-slate-400",children:"入驻、变更与冻结"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-indigo-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/users",className:"glass-panel p-4 border-slate-800 hover:border-sky-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Hn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-sky-400",children:"用户中枢"}),n.jsx("div",{className:"text-xs text-slate-400",children:"跨校开户、改密与封禁"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-sky-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/devices",className:"glass-panel p-4 border-slate-800 hover:border-emerald-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-emerald-400",children:"设备集控"}),n.jsx("div",{className:"text-xs text-slate-400",children:"心跳、远程指令与清退"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-emerald-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/codes",className:"glass-panel p-4 border-slate-800 hover:border-amber-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-sm font-semibold text-white group-hover:text-amber-400 flex items-center gap-1.5",children:["激活码大盘",n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-300 font-normal",children:"快速生成"})]}),n.jsx("div",{className:"text-xs text-slate-400",children:"生成、绑定与废除"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-amber-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/broadcast",className:"glass-panel p-4 border-slate-800 hover:border-rose-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 text-rose-400 flex items-center justify-center",children:n.jsx(br,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-rose-400",children:"应急广播"}),n.jsx("div",{className:"text-xs text-slate-400",children:"全域群发与强置顶"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-rose-400 transition-transform group-hover:translate-x-1"})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[n.jsxs("div",{className:"lg:col-span-2 glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"各校区终端在线统计"]}),n.jsx(ge,{to:"/admin/tenants",className:"text-xs text-indigo-400 hover:underline",children:"管理学校 →"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"pb-3 font-medium",children:"学校名称"}),n.jsx("th",{className:"pb-3 font-medium",children:"班级数"}),n.jsx("th",{className:"pb-3 font-medium",children:"设备数"}),n.jsx("th",{className:"pb-3 font-medium",children:"在线状态"}),n.jsx("th",{className:"pb-3 font-medium text-right",children:"在线率"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o.map(D=>{const H=D.deviceCount>0?Math.round(D.onlineCount/D.deviceCount*100):0;return n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsxs("td",{className:"py-3 font-medium text-white flex items-center gap-2",children:[n.jsx("span",{children:D.name}),n.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:["(",D.id,")"]})]}),n.jsx("td",{className:"py-3 text-slate-300",children:D.classroomCount}),n.jsx("td",{className:"py-3 text-slate-300",children:D.deviceCount}),n.jsx("td",{className:"py-3",children:n.jsxs("span",{className:"text-xs text-slate-300",children:[D.onlineCount," / ",D.deviceCount," 在线"]})}),n.jsx("td",{className:"py-3 text-right",children:n.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${H>=80?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":H>0?"bg-amber-500/10 text-amber-400 border border-amber-500/30":"bg-slate-800 text-slate-400"}`,children:[H,"%"]})})]},D.id)})})]})})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(_s,{className:"w-4 h-4 text-amber-400"}),"管理员关键操作审计"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"不可篡改"})]}),n.jsx("div",{className:"space-y-3",children:p.length===0?n.jsx("div",{className:"text-center py-8 text-xs text-slate-500",children:"暂无审计记录"}):p.map(D=>n.jsxs("div",{className:"glass-card p-3 text-xs space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-indigo-300 font-mono",children:D.action}),n.jsx("span",{className:"text-[10px] text-slate-500",children:new Date(D.occurredAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-slate-300 text-[11px] line-clamp-1",children:D.details||D.targetId}),n.jsxs("div",{className:"flex items-center justify-between text-slate-500 text-[10px]",children:[n.jsxs("span",{children:["操作者: ",D.actorUsername]}),n.jsx("span",{className:"font-mono",children:D.targetType})]})]},D.id))})]})]})]})},ix=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(null),[C,S]=g.useState(null),[$,D]=g.useState(""),[H,F]=g.useState(""),[I,q]=g.useState(!1),G=async()=>{try{const b=await oe.getAllDevices();l(b)}catch(b){console.error("Failed to load devices",b)}finally{u(!1)}};g.useEffect(()=>{G();const b=setInterval(G,5e3);return()=>clearInterval(b)},[]);const Z=async(b,ne,Ee)=>{j(`${b}_${ne}`),y(null);try{const je=await oe.sendDeviceCommand(b,ne,Ee);y({deviceId:b,message:je.message,success:!0}),G()}catch(je){y({deviceId:b,message:je.message||"远程指令下发失败",success:!1})}finally{j(null)}},te=b=>{S(b),D(b.hostname||""),F(b.classroomId||"")},O=async b=>{if(b.preventDefault(),!!C){q(!0);try{await oe.updateDevice(C.deviceId,{hostname:$.trim()||void 0,classroomId:H.trim()||void 0}),y({deviceId:C.deviceId,message:"设备信息更新成功",success:!0}),S(null),G()}catch(ne){y({deviceId:C.deviceId,message:ne.message||"更新设备失败",success:!1})}finally{q(!1)}}},K=async b=>{if(window.confirm(`高危操作确认:确定要注销并清退设备 [${b.deviceId} (${b.hostname||b.classroomName})] 吗? 清退后该设备将无法接入,需重新生成激活码绑定!`)){j(`decommission_${b.deviceId}`);try{await oe.decommissionDevice(b.deviceId),y({deviceId:b.deviceId,message:"设备已成功清退并注销",success:!0}),G()}catch(ne){y({deviceId:b.deviceId,message:ne.message||"清退设备失败",success:!1})}finally{j(null)}}},fe=b=>{if(!b)return"从无心跳";const ne=Math.floor((Date.now()-new Date(b).getTime())/1e3);return ne<10?"刚刚 (几秒前)":ne<60?`${ne} 秒前`:ne<3600?`${Math.floor(ne/60)} 分钟前`:`${Math.floor(ne/3600)} 小时前`},pe=a.filter(b=>b.tenantName.toLowerCase().includes(d.toLowerCase())||b.classroomName.toLowerCase().includes(d.toLowerCase())||b.deviceId.toLowerCase().includes(d.toLowerCase())||b.hostname&&b.hostname.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备集控中心"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时监控教室终端健康心跳与服务状态,支持在线秒级下发或离线指令入队补发、元数据变更与清退"})]}),n.jsxs("div",{className:"flex items-center gap-2 self-start sm:self-auto",children:[n.jsxs("button",{onClick:()=>{u(!0),G()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新状态"]}),n.jsxs(ge,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-600/25 transition-all",children:[n.jsx(ut,{className:"w-3.5 h-3.5 text-amber-300"}),"生成新设备激活码"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between transition-all ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsxs("span",{children:["[设备 ",m.deviceId,"] ",m.message]})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:b=>f(b.target.value),placeholder:"按学校、班级、设备编号或计算机名过滤...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"设备编号 / 主机名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"运行状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"心跳与 IP"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"版本"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"运维指令与管理"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:pe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在同步设备状态...":"暂无匹配的设备"})}):pe.map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:b.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:b.tenantName})]}),n.jsxs("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:[n.jsx("div",{children:b.deviceId}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-sans mt-0.5 flex items-center gap-1",children:[n.jsx(Vn,{className:"w-3 h-3 text-slate-500"}),n.jsx("span",{children:b.hostname||"Classroom-PC"})]})]}),n.jsx("td",{className:"py-4 px-4",children:b.isOnline?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),n.jsx("span",{children:"在线 (实时连通)"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-400",title:"指令将入队,上线时自动补发",children:[n.jsx(Kn,{className:"w-3 h-3 text-amber-500"}),n.jsx("span",{children:"离线 (支持离线入队)"})]})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:fe(b.lastHeartbeat)}),n.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5 font-mono",children:b.remoteIp||"127.0.0.1"})]}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-300 font-mono",children:["v",b.clientVersion||"2.1.0"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>Z(b.deviceId,"self_check"),disabled:p===`${b.deviceId}_self_check`,className:"px-2 py-1 rounded-lg bg-indigo-600/10 hover:bg-indigo-600/20 border border-indigo-500/30 text-indigo-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发远程自检指令 (若离线将入队补发)",children:[n.jsx(ua,{className:"w-3 h-3"}),"自检"]}),n.jsxs("button",{onClick:()=>Z(b.deviceId,"restart_client"),disabled:p===`${b.deviceId}_restart_client`,className:"px-2 py-1 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"远程重启前台 WPF Client 弹窗进程",children:[n.jsx(M0,{className:"w-3 h-3"}),"重启"]}),n.jsxs("button",{onClick:()=>Z(b.deviceId,"refresh_config"),disabled:p===`${b.deviceId}_refresh_config`,className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发配置刷新指令",children:[n.jsx(bt,{className:"w-3 h-3"}),"刷新"]}),n.jsx("button",{onClick:()=>te(b),className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 transition-colors",title:"重命名或调整班级绑定",children:n.jsx(Kd,{className:"w-3.5 h-3.5"})}),n.jsx("button",{onClick:()=>K(b),disabled:p===`decommission_${b.deviceId}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"清退并注销设备",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},b.deviceId))})]})})}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"调整设备元数据"}),n.jsxs("p",{className:"text-xs text-slate-400",children:["设备唯一识别码: ",n.jsx("span",{className:"font-mono text-indigo-400",children:C.deviceId})]}),n.jsxs("form",{onSubmit:O,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"计算机名 / 主机标识 (Hostname)"}),n.jsx("input",{type:"text",value:$,onChange:b=>D(b.target.value),placeholder:"例如: LAB-BUILDING-201-PC",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"所属班级编号 (Classroom ID)"}),n.jsx("input",{type:"text",value:H,onChange:b=>F(b.target.value),placeholder:"例如: cls_801",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>S(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:I,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:I?"保存中...":"确认保存"})]})]})]})})]})},ox=()=>{const[a]=dp(),[l,o]=g.useState([]),[u,d]=g.useState([]),[f,m]=g.useState(!0),[y,p]=g.useState(null),[j,C]=g.useState(""),[S,$]=g.useState(""),[D,H]=g.useState(!1),[F,I]=g.useState(""),[q,G]=g.useState([]),[Z,te]=g.useState(!1),[O,K]=g.useState(""),[fe,pe]=g.useState(!1),[b,ne]=g.useState(""),[Ee,je]=g.useState(!1),[_e,Ue]=g.useState(null),$e=async()=>{try{const[T,N]=await Promise.all([oe.getAdminActivationCodes(),oe.getTenants()]);o(T),d(N),N.length>0&&!F&&I(N[0].id)}catch(T){console.error("Failed to load activation codes",T)}finally{m(!1)}};g.useEffect(()=>{$e()},[]),g.useEffect(()=>{const T=a.get("tenantId"),N=a.get("openGenerate")==="true";T&&($(T),I(T),N&&H(!0))},[a]),g.useEffect(()=>{F&&(te(!0),oe.getAdminClasses(F).then(T=>{G(T),T.length>0?(K(T[0].id),pe(!1)):(K(""),pe(!0))}).catch(T=>{console.warn("Could not load classes for tenant:",F,T),G([]),pe(!0)}).finally(()=>te(!1)))},[F]);const Te=T=>{navigator.clipboard.writeText(T),p(T),setTimeout(()=>p(null),2e3)},V=async T=>{T.preventDefault();const N=fe?b.trim():O.trim();if(!F||!N){alert("请选择学校及目标班级");return}je(!0);try{const L=await oe.generateAdminCode(F,N),ie=u.find(he=>he.id===F),ce=q.find(he=>he.id===N);Ue({code:L.code,schoolName:(ie==null?void 0:ie.name)||F,className:(ce==null?void 0:ce.displayName)||N}),H(!1),ne(""),$e()}catch(L){alert(L.message||"生成激活码失败")}finally{je(!1)}},k=async T=>{if(window.confirm(`确定要废弃/删除激活码 [${T}] 吗?废弃后将无法用于设备初始化绑定。`))try{await oe.deleteActivationCode(T),$e()}catch(N){alert(N.message||"删除激活码失败")}},W=l.filter(T=>{const N=!S||T.tenantId===S,L=T.code.toLowerCase().includes(j.toLowerCase())||T.classroomName.toLowerCase().includes(j.toLowerCase())||T.tenantName.toLowerCase().includes(j.toLowerCase());return N&&L});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-4 h-4"})}),n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备激活码大盘"})]}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m(!0),$e()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${f?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{Ue(null),H(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold transition-all shadow-lg shadow-amber-500/20 active:scale-95",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]})]}),_e&&n.jsxs("div",{className:"glass-panel p-5 border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:n.jsx(Jd,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-emerald-300",children:"激活码生成成功!"}),n.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["归属:",n.jsx("span",{className:"font-medium text-white",children:_e.schoolName})," / ",n.jsx("span",{className:"font-medium text-white",children:_e.className}),"(有效期 7 天,一次性硬件绑定)"]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"px-4 py-1.5 rounded-xl bg-slate-900 border border-emerald-500/50 font-mono text-xl font-bold text-emerald-400 tracking-wider",children:_e.code}),n.jsx("button",{onClick:()=>Te(_e.code),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors",children:y===_e.code?n.jsxs(n.Fragment,{children:[n.jsx(Fl,{className:"w-3.5 h-3.5"}),"已复制"]}):n.jsxs(n.Fragment,{children:[n.jsx(Yo,{className:"w-3.5 h-3.5"}),"一键复制"]})})]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:T=>C(T.target.value),placeholder:"搜索激活码、班级或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:S,onChange:T=>$(T.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsxs("option",{value:"",children:["全部学校 (",u.length,")"]}),u.map(T=>n.jsxs("option",{value:T.id,children:[T.name," (",T.id,")"]},T.id))]})]}),n.jsxs("div",{className:"ml-auto text-xs text-slate-400",children:["共 ",n.jsx("span",{className:"text-white font-medium",children:W.length})," 个激活码"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:W.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-400",children:n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[n.jsx(ut,{className:"w-8 h-8 text-slate-600"}),n.jsx("div",{className:"text-sm font-medium",children:f?"正在读取激活码...":"暂无匹配的激活码"}),n.jsx("div",{className:"text-xs text-slate-500",children:"点击右上角“生成新激活码”即可为任意学校教室开通绑定码"}),n.jsxs("button",{onClick:()=>H(!0),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium",children:[n.jsx(Qn,{className:"w-3.5 h-3.5"}),"立即生成激活码"]})]})})}):W.map(T=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-mono font-bold text-indigo-400 text-base",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.code}),n.jsx("button",{onClick:()=>Te(T.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:y===T.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]})}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:T.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:T.tenantName})]}),n.jsx("td",{className:"py-4 px-4",children:T.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx(Pt,{className:"w-3 h-3"}),"已激活绑定"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx(Kn,{className:"w-3 h-3"}),"等待激活"]})}),n.jsx("td",{className:"py-4 px-4 text-xs font-mono text-slate-300",children:T.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:T.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-400",children:[new Date(T.expiresAt).toLocaleDateString()," ",new Date(T.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:()=>Te(T.code),className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:y===T.code?"已复制":"复制"}),n.jsx("button",{onClick:()=>k(T.code),className:"p-1 rounded text-slate-500 hover:text-rose-400 transition-colors",title:"废弃/删除此激活码",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},T.code))})]})})}),D&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl rounded-2xl animate-in zoom-in-95 duration-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-amber-400"}),"生成班级设备激活码"]}),n.jsxs("form",{onSubmit:V,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属学校 / 租户"}),n.jsx("select",{value:F,onChange:T=>I(T.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:u.map(T=>n.jsxs("option",{value:T.id,children:[T.name," (",T.id,") ",T.isActive?"":"[已冻结]"]},T.id))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-slate-300",children:"目标班级"}),n.jsx("button",{type:"button",onClick:()=>pe(!fe),className:"text-[11px] text-amber-400 hover:underline",children:fe?"从班级列表选择":"手动输入班级ID"})]}),Z?n.jsxs("div",{className:"text-xs text-slate-400 py-2.5 px-3 bg-slate-900 rounded-xl border border-slate-800 flex items-center gap-2",children:[n.jsx(bt,{className:"w-3.5 h-3.5 animate-spin"}),"正在读取该校班级列表..."]}):fe?n.jsx("input",{type:"text",value:b,onChange:T=>ne(T.target.value),placeholder:"输入班级编号,如 cls_801",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}):q.length>0?n.jsx("select",{value:O,onChange:T=>K(T.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:q.map(T=>n.jsxs("option",{value:T.id,children:[T.displayName," (",T.id,")"]},T.id))}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-xs text-amber-400/90 flex items-center gap-1.5",children:[n.jsx(Sn,{className:"w-3.5 h-3.5 shrink-0"}),"该校暂无预设班级,请手动输入班级代码:"]}),n.jsx("input",{type:"text",value:b,onChange:T=>ne(T.target.value),placeholder:"如 cls_801 或 cls_new",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]})]}),n.jsxs("div",{className:"p-3 bg-slate-900/60 rounded-xl border border-slate-800 text-xs text-slate-400 space-y-1",children:[n.jsx("div",{className:"text-slate-300 font-medium",children:"💡 使用说明:"}),n.jsx("div",{children:"1. 激活码生成后有效期为 7 天;"}),n.jsx("div",{children:"2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>H(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Ee,className:"px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold disabled:opacity-50 transition-all shadow-md shadow-amber-500/20",children:Ee?"生成中...":"立即生成激活码"})]})]})]})})]})},ax=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),m=async()=>{try{const p=await oe.getAdminNotifications(100);l(p)}catch(p){console.error("Failed to load notifications",p)}finally{u(!1)}};g.useEffect(()=>{m();const p=setInterval(m,8e3);return()=>clearInterval(p)},[]);const y=a.filter(p=>p.className.toLowerCase().includes(d.toLowerCase())||p.senderName.toLowerCase().includes(d.toLowerCase())||p.message.toLowerCase().includes(d.toLowerCase())||p.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网呼叫历史与回执审计"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"追踪全网每条通知从下发、教室大屏接收、到学生点击确认的全流程时间戳与 ACK 回执"})]}),n.jsxs("button",{onClick:()=>{u(!0),m()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700 self-start sm:self-auto",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新审计"]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:p=>f(p.target.value),placeholder:"搜索消息内容、班级或教师姓名...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"目标班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"通知正文"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"发起老师"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"下发时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"回执状态 (ACK)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"确认时间"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:y.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在加载审计数据...":"暂无呼叫历史记录"})}):y.map(p=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:p.className}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:p.classId})]}),n.jsxs("td",{className:"py-4 px-4 text-slate-200 max-w-md",children:[n.jsx("div",{className:"font-medium text-sm",children:p.message}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500 mt-0.5",children:p.id})]}),n.jsx("td",{className:"py-4 px-4 text-slate-300 text-xs",children:p.senderName}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(p.createdAt).toLocaleTimeString()}),n.jsxs("td",{className:"py-4 px-4",children:[p.status==="Acknowledged"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),"学生已点击确认"]}),p.status==="Delivered"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/30",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),"已送达教室大屏"]}),p.status==="Sent"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),"云端下发中"]}),p.status==="Timeout"&&n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"超时自动关闭"})]}),n.jsx("td",{className:"py-4 px-4 text-right text-xs text-slate-400",children:p.confirmedAt?n.jsx("span",{className:"text-emerald-400 font-mono",children:new Date(p.confirmedAt).toLocaleTimeString()}):n.jsx("span",{className:"text-slate-600",children:"-"})})]},p.id))})]})})})]})},cx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(!1),[C,S]=g.useState({id:"",name:""}),[$,D]=g.useState(!1),[H,F]=g.useState(null),[I,q]=g.useState({name:"",isActive:!0}),[G,Z]=g.useState(!1),te=async()=>{try{const b=await oe.getTenants();l(b)}catch(b){console.error("Failed to load tenants",b)}finally{u(!1)}};g.useEffect(()=>{te()},[]);const O=async b=>{if(b.preventDefault(),!(!C.id.trim()||!C.name.trim())){D(!0);try{await oe.createTenant({id:C.id.trim(),name:C.name.trim()}),y({text:`学校 [${C.name}] 创建成功!`,success:!0}),j(!1),S({id:"",name:""}),te()}catch(ne){y({text:ne.message||"创建学校失败",success:!1})}finally{D(!1)}}},K=b=>{F(b),q({name:b.name,isActive:b.isActive})},fe=async b=>{if(b.preventDefault(),!(!H||!I.name.trim())){Z(!0);try{await oe.updateTenant(H.id,{name:I.name.trim(),isActive:I.isActive}),y({text:`学校 [${I.name}] 配置已更新`,success:!0}),F(null),te()}catch(ne){y({text:ne.message||"更新学校配置失败",success:!1})}finally{Z(!1)}}},pe=a.filter(b=>b.name.toLowerCase().includes(d.toLowerCase())||b.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"学校租户生命周期管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"统筹多校区租户实体,支持新校区入驻配置、基础信息变更与服务启停冻结"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{u(!0),te()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建学校"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:m.text})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:b=>f(b.target.value),placeholder:"按学校标识代码 (ID) 或名称搜索...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校名称 / 标识码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级总数"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"终端大屏 (在线/总计)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"服务状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"接入时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"管理操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:pe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在读取租户列表...":"暂无匹配的学校租户"})}):pe.map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 font-bold",children:n.jsx(Qt,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-white",children:b.name}),n.jsx("div",{className:"text-xs text-slate-500 font-mono mt-0.5",children:b.id})]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700",children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-indigo-400"}),n.jsxs("span",{children:[b.classroomCount," 个班级"]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"font-semibold text-emerald-400",children:[b.onlineCount," 在线"]}),n.jsx("span",{className:"text-slate-500",children:"/"}),n.jsxs("span",{className:"text-slate-400",children:[b.deviceCount," 总屏"]})]})}),n.jsx("td",{className:"py-4 px-4",children:b.isActive?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"正常运营"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"已停用冻结"})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(b.createdAt).toLocaleDateString()}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsxs(ge,{to:`/admin/codes?tenantId=${b.id}&openGenerate=true`,className:"px-2.5 py-1.5 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"为此学校生成班级设备激活码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成激活码"]}),n.jsxs("button",{onClick:()=>K(b),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",children:[n.jsx(Kd,{className:"w-3 h-3"}),"编辑配置"]})]})})]},b.id))})]})})}),p&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"接入新学校租户"}),n.jsxs("form",{onSubmit:O,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校唯一标识代码 (Tenant ID)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: t_beijing_no8 或 bj_highschool",value:C.id,onChange:b=>S({...C,id:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"只能包含小写字母、数字和下划线,作为多租户隔离主键不可篡改"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称 (Display Name)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 北京市第四中学",value:C.name,onChange:b=>S({...C,name:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:$,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:$?"正在创建...":"确认接入"})]})]})]})}),H&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["编辑学校配置: ",H.id]}),n.jsxs("form",{onSubmit:fe,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称"}),n.jsx("input",{type:"text",required:!0,value:I.name,onChange:b=>q({...I,name:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"运营状态"}),n.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!0,onChange:()=>q({...I,isActive:!0}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-emerald-400",children:"正常运营"})]}),n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!1,onChange:()=>q({...I,isActive:!1}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-rose-400",children:"停用冻结 (拒绝该校任何指令)"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>F(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:G,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:G?"保存中...":"保存更改"})]})]})]})})]})},ux=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState(null),[H,F]=g.useState(!1),[I,q]=g.useState({tenantId:"",username:"",password:"",fullName:"",role:"Teacher"}),[G,Z]=g.useState(!1),[te,O]=g.useState(null),[K,fe]=g.useState(""),[pe,b]=g.useState(!1),[ne,Ee]=g.useState(null),je=async()=>{try{const[k,W]=await Promise.all([oe.getUsers(p||void 0,C||void 0),oe.getTenants()]);l(k),u(W)}catch(k){console.error("Failed to load user management data",k)}finally{f(!1)}};g.useEffect(()=>{je()},[p,C]);const _e=async k=>{var W;if(k.preventDefault(),!I.tenantId||!I.username||!I.password||!I.fullName){D({text:"请填写所有必填字段",success:!1});return}Z(!0);try{await oe.createUser(I),D({text:`用户 [${I.username}] 创建成功!`,success:!0}),F(!1),q({tenantId:((W=o[0])==null?void 0:W.id)||"",username:"",password:"",fullName:"",role:"Teacher"}),je()}catch(T){D({text:T.message||"创建用户失败",success:!1})}finally{Z(!1)}},Ue=async k=>{if(k.preventDefault(),!(!te||!K.trim())){b(!0);try{await oe.resetPassword(te.id,K.trim()),D({text:`用户 [${te.username}] 的密码已重置成功`,success:!0}),O(null),fe("")}catch(W){D({text:W.message||"重置密码失败",success:!1})}finally{b(!1)}}},$e=async k=>{const W=!k.isLocked,T=W?`确定要锁定账号 [${k.username}] 吗?锁定后该用户将无法登录系统。`:`确定要解锁账号 [${k.username}] 吗?`;if(window.confirm(T)){Ee(`lock_${k.id}`);try{await oe.setUserLock(k.id,W),D({text:`用户 [${k.username}] 已成功${W?"锁定":"解锁"}`,success:!0}),je()}catch(N){D({text:N.message||"操作失败",success:!1})}finally{Ee(null)}}},Te=async k=>{if(k.role==="SuperAdmin"){alert("超级管理员账号不可删除");return}if(window.confirm(`警告:确定要永久删除用户 [${k.username} (${k.fullName})] 吗?此操作不可逆!`)){Ee(`delete_${k.id}`);try{await oe.deleteUser(k.id),D({text:`用户 [${k.username}] 已被删除`,success:!0}),je()}catch(W){D({text:W.message||"删除用户失败",success:!1})}finally{Ee(null)}}},V=a.filter(k=>k.username.toLowerCase().includes(m.toLowerCase())||k.fullName.toLowerCase().includes(m.toLowerCase())||k.tenantName.toLowerCase().includes(m.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"多租户统一用户中枢"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"全网教职工与校级管理员统一管控,支持跨校账号开户、密码强行重置、异常封禁与权限审计"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{f(!0),je()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{o.length>0&&!I.tenantId&&q(k=>({...k,tenantId:o[0].id})),F(!0)},className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建用户"]})]})]}),$&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${$.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[$.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:$.text})]}),n.jsx("button",{onClick:()=>D(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:m,onChange:k=>y(k.target.value),placeholder:"搜索用户名、姓名或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:p,onChange:k=>j(k.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部学校 (全网)"}),o.map(k=>n.jsxs("option",{value:k.id,children:[k.name," (",k.id,")"]},k.id))]})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Nr,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:C,onChange:k=>S(k.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部角色"}),n.jsx("option",{value:"SuperAdmin",children:"平台超级管理员"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员"}),n.jsx("option",{value:"Teacher",children:"普通授课教师"})]})]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"用户姓名 / 登录名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"归属学校"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"角色身份"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"生命周期操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:V.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:d?"正在同步用户中枢...":"暂无匹配的用户"})}):V.map(k=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:k.fullName}),n.jsx("div",{className:"text-xs text-slate-400 font-mono mt-0.5",children:k.username})]}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:k.tenantName}),n.jsx("div",{className:"text-[11px] text-slate-500 font-mono",children:k.tenantId})]}),n.jsx("td",{className:"py-4 px-4",children:k.role==="SuperAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Bl,{className:"w-3 h-3"}),"超级管理员"]}):k.role==="SchoolAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-indigo-500/10 border border-indigo-500/30 text-indigo-400",children:[n.jsx(Qt,{className:"w-3 h-3"}),"校区管理员"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-300",children:[n.jsx(Nr,{className:"w-3 h-3"}),"授课老师"]})}),n.jsx("td",{className:"py-4 px-4",children:k.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-rose-500/15 text-rose-400 border border-rose-500/30",children:[n.jsx(bs,{className:"w-3 h-3"}),"已锁定封禁"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:k.lastLoginAt?new Date(k.lastLoginAt).toLocaleString():"尚未登录"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>O(k),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"强制重置登录密码",children:[n.jsx(ut,{className:"w-3 h-3 text-amber-400"}),"重置密码"]}),k.role!=="SuperAdmin"&&n.jsxs("button",{onClick:()=>$e(k),disabled:ne===`lock_${k.id}`,className:`px-2 py-1 rounded-lg border text-xs font-medium transition-colors inline-flex items-center gap-1 ${k.isLocked?"bg-emerald-600/15 border-emerald-500/30 text-emerald-300 hover:bg-emerald-600/25":"bg-rose-600/15 border-rose-500/30 text-rose-300 hover:bg-rose-600/25"}`,title:k.isLocked?"解除账号锁定":"锁定账号",children:[k.isLocked?n.jsx(ea,{className:"w-3 h-3"}):n.jsx(bs,{className:"w-3 h-3"}),k.isLocked?"解锁":"锁定"]}),k.role!=="SuperAdmin"&&n.jsx("button",{onClick:()=>Te(k),disabled:ne===`delete_${k.id}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"删除用户",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},k.id))})]})})}),H&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"开通新用户账号"}),n.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"归属学校"}),n.jsxs("select",{required:!0,value:I.tenantId,onChange:k=>q({...I,tenantId:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"-- 请选择学校 --"}),o.map(k=>n.jsxs("option",{value:k.id,children:[k.name," (",k.id,")"]},k.id))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户角色"}),n.jsxs("select",{value:I.role,onChange:k=>q({...I,role:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"Teacher",children:"普通授课老师 (Teacher)"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"})]}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"平台超级管理员只可通过系统底层配置文件委任,禁止通过控制台赋予。"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: teacher_li 或 admin_no4",value:I.username,onChange:k=>q({...I,username:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户真实姓名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 李老师",value:I.fullName,onChange:k=>q({...I,fullName:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始登录密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"设置 6 位以上密码",value:I.password,onChange:k=>q({...I,password:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>F(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:G,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:G?"正在创建...":"确认开户"})]})]})]})}),te&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["重置用户密码: ",te.username]}),n.jsxs("p",{className:"text-xs text-slate-400",children:["为归属于 [",te.tenantName,"] 的 [",te.fullName,"] 强行设置新密码。"]}),n.jsxs("form",{onSubmit:Ue,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"请输入新密码",value:K,onChange:k=>fe(k.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>{O(null),fe("")},className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:pe,className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold shadow-lg shadow-amber-500/25 transition-all disabled:opacity-50",children:pe?"重置中...":"确认重置"})]})]})]})})]})},dx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState([]),[m,y]=g.useState(!1),[p,j]=g.useState({tenantId:"",title:"⚠️ 全校紧急预警通报",message:"",voice:!0,shake:!0,durationSeconds:30}),[C,S]=g.useState(!1),[$,D]=g.useState(!1),[H,F]=g.useState(null),I=[{title:"⚠️ 消防紧急疏散演练",content:"全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速、有序撤离至操场,不要慌乱!",duration:60,shake:!0,voice:!0,icon:x0},{title:"⛈️ 恶劣雷雨大风避险通报",content:"气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁学生前往走廊与室外活动!",duration:45,shake:!0,voice:!0,icon:d0},{title:"📢 临时紧急集合通知",content:"请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学保持教室内安静自习。",duration:30,shake:!1,voice:!0,icon:Hn},{title:"🔔 全校临时作息调整",content:"因突发教学安排,今天下午放学时间调整为 16:30,请任课老师提醒学生整理个人物品按时离校。",duration:30,shake:!1,voice:!0,icon:C0}],q=async()=>{try{const b=await oe.getTenants();l(b)}catch(b){console.error("Failed to load tenants",b)}finally{u(!1)}},G=async()=>{y(!0);try{const b=await oe.getAdminNotifications(15);f(b)}catch(b){console.error("Failed to load recent broadcasts",b)}finally{y(!1)}};g.useEffect(()=>{q(),G()},[]);const Z=b=>{j(ne=>({...ne,title:b.title,message:b.content,durationSeconds:b.duration,shake:b.shake,voice:b.voice}))},te=b=>{if(b.preventDefault(),!p.message.trim()){alert("请输入广播通知正文");return}S(!0)},O=async()=>{D(!0);try{const b=await oe.sendEmergencyBroadcast({...p,tenantId:p.tenantId||void 0});F({dispatchedCount:b.dispatchedCount,targetSchools:b.targetSchools,message:b.message,success:!0,timestamp:new Date().toLocaleTimeString()}),S(!1),j(ne=>({...ne,message:""})),G()}catch(b){F({dispatchedCount:0,targetSchools:0,message:b.message||"应急广播下发失败",success:!1,timestamp:new Date().toLocaleTimeString()}),S(!1)}finally{D(!1)}},K=a.find(b=>b.id===p.tenantId),fe=K?K.classroomCount:a.reduce((b,ne)=>b+(ne.classroomCount||0),0),pe=K?K.deviceCount:a.reduce((b,ne)=>b+(ne.deviceCount||0),0);return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(br,{className:"w-5 h-5 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域紧急应急广播"}),n.jsx("p",{className:"text-sm text-slate-400 mt-0.5",children:"超级管理员最高优先调度通道,覆盖全网多校区所有教室大屏终端,支持强置顶、TTS 语音播报与视效抖动"})]})]})}),H&&n.jsx("div",{className:`p-5 rounded-xl border transition-all animate-in fade-in slide-in-from-top-2 ${H.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[H.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0 mt-0.5"}):n.jsx(ks,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-sm",children:H.success?"全域紧急广播指令已成功下发":"广播下发遇到异常"}),n.jsx("p",{className:"text-xs text-slate-300 mt-1",children:H.message}),H.success&&n.jsxs("div",{className:"flex flex-wrap gap-4 mt-3 text-xs",children:[n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["目标学校: ",n.jsx("strong",{className:"text-white",children:H.targetSchools})," 所"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["投递教室班级: ",n.jsx("strong",{className:"text-emerald-400",children:H.dispatchedCount})," 间"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-400 font-mono",children:["下发时间: ",H.timestamp]})]})]})]}),n.jsx("button",{onClick:()=>F(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-4 h-4"})})]})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"应急广播预设模板 (点击快速填装)"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:I.map((b,ne)=>{const Ee=b.icon;return n.jsxs("button",{type:"button",onClick:()=>Z(b),className:"glass-panel p-3.5 border-slate-800 text-left hover:border-indigo-500/50 hover:bg-slate-800/40 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-slate-200 group-hover:text-indigo-400 mb-1",children:[n.jsx(Ee,{className:"w-4 h-4 text-indigo-400"}),n.jsx("span",{children:b.title})]}),n.jsx("p",{className:"text-[11px] text-slate-500 line-clamp-2",children:b.content})]},ne)})})]}),n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:te,className:"space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Qt,{className:"w-3.5 h-3.5 text-indigo-400"}),"目标广播范围"]}),n.jsxs("span",{className:"text-[11px] text-slate-400 font-normal",children:["预计覆盖 ",fe," 班级 / ",pe," 大屏"]})]}),n.jsxs("select",{value:p.tenantId||"",onChange:b=>j({...p,tenantId:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"🚨 全网所有学校与所有教室大屏 (全域覆盖)"}),a.map(b=>n.jsxs("option",{value:b.id,children:["仅该校: ",b.name," (",b.classroomCount," 班级, ",b.deviceCount," 大屏)"]},b.id))]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1.5",children:[n.jsx(Bl,{className:"w-3.5 h-3.5 text-rose-400"}),"广播标题"]}),n.jsx("input",{type:"text",required:!0,value:p.title,onChange:b=>j({...p,title:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",placeholder:"例如: ⚠️ 全校紧急避险预警"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"广播正文内容 (将同步在所有大屏全屏高显并由 Windows TTS 朗读)"}),n.jsx("textarea",{required:!0,rows:4,value:p.message,onChange:b=>j({...p,message:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 font-sans",placeholder:"请输入紧急通报具体事项,语言力求简明扼要..."})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 pt-2 border-t border-slate-800",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-indigo-400"}),"展示持续时长: ",p.durationSeconds," 秒"]}),n.jsx("input",{type:"range",min:10,max:300,step:5,value:p.durationSeconds,onChange:b=>j({...p,durationSeconds:parseInt(b.target.value,10)}),className:"w-full accent-indigo-500 cursor-pointer"}),n.jsxs("div",{className:"flex justify-between text-[11px] text-slate-500 mt-1",children:[n.jsx("span",{children:"10秒"}),n.jsx("span",{children:"60秒"}),n.jsx("span",{children:"5分钟"})]})]}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.voice,onChange:b=>j({...p,voice:b.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-emerald-400"}),"TTS 语音朗读"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"大屏端通过系统扬声器朗读"})]})]})}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.shake,onChange:b=>j({...p,shake:b.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(X0,{className:"w-3.5 h-3.5 text-rose-400"}),"窗口视效震颤"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"高频强抖动提醒上课师生"})]})]})})]}),n.jsx("div",{className:"pt-2 flex justify-end",children:n.jsxs("button",{type:"submit",disabled:$||!p.message.trim(),className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-sm font-semibold shadow-xl shadow-rose-600/30 transition-all disabled:opacity-50",children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"下发全域紧急广播..."})]})})]})}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"最近全网广播与呼叫调度记录"]}),n.jsx("button",{onClick:G,disabled:m,className:"text-xs text-indigo-400 hover:text-indigo-300 disabled:opacity-50",children:m?"刷新中...":"刷新记录"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs",children:[n.jsx("thead",{className:"text-[11px] uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2.5 px-3",children:"发起时间"}),n.jsx("th",{className:"py-2.5 px-3",children:"调度类型"}),n.jsx("th",{className:"py-2.5 px-3",children:"目标班级/范围"}),n.jsx("th",{className:"py-2.5 px-3",children:"通知内容"}),n.jsx("th",{className:"py-2.5 px-3 text-right",children:"投递状态"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"py-8 text-center text-slate-500",children:m?"正在加载历史记录...":"暂无最近调度记录"})}):d.slice(0,8).map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/20",children:[n.jsx("td",{className:"py-3 px-3 font-mono text-slate-400 whitespace-nowrap",children:new Date(b.createdAt).toLocaleTimeString()}),n.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:b.priority==="Urgent"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/20 font-medium",children:[n.jsx(ks,{className:"w-3 h-3"}),"紧急通报"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/20",children:"日常呼叫"})}),n.jsx("td",{className:"py-3 px-3 text-white font-medium whitespace-nowrap",children:b.className||"全域广播"}),n.jsx("td",{className:"py-3 px-3 text-slate-300 max-w-xs truncate",children:b.message}),n.jsx("td",{className:"py-3 px-3 text-right whitespace-nowrap",children:b.status==="Cancelled"?n.jsx("span",{className:"text-slate-400",children:"已撤回关闭"}):b.status==="Acknowledged"?n.jsx("span",{className:"text-emerald-400 font-medium",children:"已确认"}):b.status==="Delivered"?n.jsx("span",{className:"text-sky-400",children:"大屏已接收"}):n.jsx("span",{className:"text-slate-400",children:"已发送"})})]},b.id))})]})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-lg w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(Bl,{className:"w-6 h-6 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"全域极高优先级应急调度二次核验"}),n.jsx("p",{className:"text-xs text-rose-400/90 font-medium mt-0.5",children:"请谨慎操作:此指令将强制穿透终端并在全网大屏置顶展示"})]})]}),n.jsxs("div",{className:"space-y-3 mb-5",children:[n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 space-y-2 text-xs",children:[n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"目标受众范围:"}),n.jsx("span",{className:"text-white font-semibold",children:p.tenantId?`${(K==null?void 0:K.name)||p.tenantId} (${fe} 班级)`:`全域所有学校 (${a.length} 所学校, 约 ${fe} 班级)`})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"广播标题:"}),n.jsx("span",{className:"text-white font-medium",children:p.title})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"展示时长与视效:"}),n.jsxs("span",{className:"text-slate-200",children:[p.durationSeconds," 秒 · ",p.voice?"TTS 语音":"无声音"," · ",p.shake?"视效抖动":"无抖动"]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3 rounded-xl border border-slate-800/80 text-xs",children:[n.jsx("span",{className:"text-slate-500 text-[11px] block mb-1",children:"播报正文内容:"}),n.jsx("p",{className:"text-slate-200 font-sans leading-relaxed",children:p.message})]}),n.jsx("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-[11px] text-rose-300/90 leading-relaxed",children:"⚠️ 确认后,云端将在毫秒内将此通报广播下发至所选教室大屏。终端如果处于上课或展示课件状态,也将直接浮现全屏红框强提醒!"})]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:$,onClick:()=>S(!1),className:"px-4 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"放弃下发"}),n.jsx("button",{type:"button",disabled:$,onClick:O,className:"px-5 py-2.5 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/30 transition-all flex items-center gap-2 disabled:opacity-50",children:$?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在全域调度广播..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"确认立即全网广播"})]})})]})]})})]})},hx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),p=async()=>{f(!0),y(null);try{const[j,C]=await Promise.all([oe.getSchoolOverview(),oe.getSchoolDevices()]);l(j),u(C)}catch(j){y((j==null?void 0:j.message)||"加载学校总览与设备数据失败")}finally{f(!1)}};return g.useEffect(()=>{p();const j=Ot.onDeviceStatusChanged(S=>{u($=>{const D=S.state===1||String(S.state).toLowerCase()==="online",H=$.map(I=>I.deviceId===S.deviceId?{...I,isOnline:D,lastHeartbeat:S.lastHeartbeat,clientVersion:S.agentVersion||I.clientVersion}:I),F=H.filter(I=>I.isOnline).length;return l(I=>I?{...I,onlineCount:F}:null),H})}),C=Ot.onHealthReportReceived(S=>{u($=>$.map(D=>D.deviceId===S.deviceId?{...D,healthStatus:S.overallStatus,lastHeartbeat:S.timestamp||new Date().toISOString()}:D))});return()=>{j(),C()}},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:(a==null?void 0:a.tenantName)||"本校管理后台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"管理本校班级配置、多媒体教室设备绑定与科任教师账号"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:p,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"已建班级"}),n.jsx(gr,{className:"w-4 h-4 text-sky-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.classCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"个教学班"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教室终端"}),n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.deviceCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台已安装"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"实时在线"}),n.jsx(ua,{className:"w-4 h-4 text-emerald-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),d?"-":(a==null?void 0:a.onlineCount)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 总 ",d?"-":(a==null?void 0:a.deviceCount)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教师账号"}),n.jsx(Hn,{className:"w-4 h-4 text-amber-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.teacherCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"位老师"})]})]})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-sky-400"}),"本校各教室设备状态与健康体检"]}),n.jsx(ge,{to:"/school-admin/classes",className:"text-xs text-sky-400 hover:text-sky-300 font-medium flex items-center gap-1",children:"班级管理"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"设备编号"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"在线状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"健康状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最后心跳"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"版本"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在同步设备列表..."})]})})}):o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-500",children:"暂无已绑定的教室设备,请前往【本校激活码】生成激活码并在教室电脑安装"})}):o.map(j=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-3.5 px-4 font-medium text-white",children:j.classroomName}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:j.deviceId}),n.jsx("td",{className:"py-3.5 px-4",children:j.isOnline?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"在线"]}):n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线"})}),n.jsx("td",{className:"py-3.5 px-4",children:j.healthStatus==="Degraded"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Bl,{className:"w-3 h-3 text-amber-400"}),"亚健康"]}):j.healthStatus==="Healthy"||j.isOnline&&!j.healthStatus?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(_s,{className:"w-3 h-3 text-emerald-400"}),"健康"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线未检"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400",children:j.lastHeartbeat?new Date(j.lastHeartbeat).toLocaleTimeString():"无"}),n.jsxs("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:["v",j.clientVersion||"2.1.0"]})]},j.deviceId))})]})})]})]})},fx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState(""),[H,F]=g.useState(!1),[I,q]=g.useState(null),G=async()=>{try{const O=await oe.getSchoolClasses();l(O)}catch(O){console.error("Failed to load classes",O)}finally{u(!1)}};g.useEffect(()=>{G()},[]);const Z=async O=>{if(O.preventDefault(),!(!m||!p)){F(!0);try{await oe.createSchoolClass({id:m,displayName:p,grade:C,roomNumber:$}),f(!1),y(""),j(""),S(""),D(""),G()}catch(K){alert(K.message||"创建班级失败")}finally{F(!1)}}},te=async O=>{try{const K=await oe.generateSchoolCode(O);q({classId:O,code:K.code})}catch(K){alert(K.message||"生成激活码失败")}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校班级管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"维护学校全部教学班级,并为各班级生成设备激活码"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建教学班"]})]}),I&&n.jsxs("div",{className:"p-4 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsxs("span",{className:"font-semibold",children:["【",I.classId,"】激活码已生成:"]}),n.jsx("span",{className:"font-mono text-base font-bold text-white ml-2 bg-slate-900 px-2 py-1 rounded",children:I.code}),n.jsx("span",{className:"text-xs text-emerald-400/80 ml-3",children:"(请在教室电脑运行 ClassNotifySetup.exe 输入该激活码完成绑定)"})]}),n.jsx("button",{onClick:()=>{navigator.clipboard.writeText(I.code),alert("激活码已复制!")},className:"px-3 py-1 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium",children:"复制激活码"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级编号 (ClassId)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"年级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教室位置"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:a.map(O=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-semibold text-white",children:O.displayName}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:O.id}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:O.grade||"-"}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:O.roomNumber||"-"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("button",{onClick:()=>te(O.id),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sky-600/10 hover:bg-sky-600/20 border border-sky-500/30 text-sky-400 text-xs font-medium transition-colors",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成安装激活码"]})})]},O.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(gr,{className:"w-5 h-5 text-sky-400"}),"新建教学班级"]}),n.jsxs("form",{onSubmit:Z,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级编号 (唯一识别码)"}),n.jsx("input",{type:"text",value:m,onChange:O=>y(O.target.value),placeholder:"如 cls_803 或 cls_grade7_1",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级显示名称"}),n.jsx("input",{type:"text",value:p,onChange:O=>j(O.target.value),placeholder:"如 八年级(3)班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"年级 (可选)"}),n.jsx("input",{type:"text",value:C,onChange:O=>S(O.target.value),placeholder:"如 初二 / 高一",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教室位置 (可选)"}),n.jsx("input",{type:"text",value:$,onChange:O=>D(O.target.value),placeholder:"如 教学楼 303",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"创建中...":"确认创建"})]})]})]})})]})},mx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState("Teacher"),[H,F]=g.useState(!1),[I,q]=g.useState(null),[G,Z]=g.useState(""),[te,O]=g.useState(!1),[K,fe]=g.useState(null),[pe,b]=g.useState(!1),[ne,Ee]=g.useState(null),je=(V,k)=>{Ee({type:V,text:k}),setTimeout(()=>{Ee(W=>(W==null?void 0:W.text)===k?null:W)},4e3)},_e=async()=>{try{const V=await oe.getSchoolTeachers();l(V)}catch(V){je("error",(V==null?void 0:V.message)||"加载教师列表失败")}finally{u(!1)}};g.useEffect(()=>{_e()},[]);const Ue=async V=>{if(V.preventDefault(),!(!m||!p||!C)){F(!0);try{await oe.createSchoolTeacher({username:m,password:p,fullName:C,role:$}),f(!1),y(""),j(""),S(""),je("success",`教师账号 ${C} 开设成功`),_e()}catch(k){alert(k.message||"创建教师账号失败")}finally{F(!1)}}},$e=async V=>{if(V.preventDefault(),!(!I||!G)){if(G.length<6){alert("新密码长度不能少于 6 位");return}O(!0);try{await oe.resetSchoolTeacherPassword(I.id,G),je("success",`已成功将教师 [${I.fullName}] 的密码重置`),q(null),Z("")}catch(k){alert(k.message||"重置密码失败")}finally{O(!1)}}},Te=async()=>{if(!K)return;b(!0);const V=!K.isLocked;try{await oe.setSchoolTeacherLock(K.id,V),je("success",`已成功${V?"停用":"启用"}教师 [${K.fullName}] 账号`),fe(null),_e()}catch(k){alert(k.message||"操作失败")}finally{b(!1)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教师账号管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"为科任教师开设 ClassNotify 网页控制台与后续 Android 移动端登录权限"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"开设教师账号"]})]}),ne&&n.jsxs("div",{className:`p-3.5 rounded-xl border text-xs flex items-center justify-between transition-all ${ne.type==="success"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[ne.type==="success"?n.jsx(Pt,{className:"w-4 h-4 text-emerald-400 shrink-0"}):n.jsx(ks,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:ne.text})]}),n.jsx("button",{onClick:()=>Ee(null),className:"text-slate-400 hover:text-white",children:n.jsx(kr,{className:"w-3.5 h-3.5"})})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教师姓名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"登录账号"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"权限角色"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(kn,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-sky-400"}),n.jsx("span",{children:"正在加载教师列表..."})]})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:"暂未开设任何教师账号,请点击右上角按钮添加"})}):a.map(V=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-semibold text-white flex items-center gap-2",children:[V.role==="SchoolAdmin"?n.jsx(H0,{className:"w-4 h-4 text-sky-400"}):n.jsx(Nr,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:V.fullName})]}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:V.username}),n.jsx("td",{className:"py-4 px-4 text-xs",children:V.role==="SchoolAdmin"?n.jsx("span",{className:"px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/30",children:"学校管理员"}):n.jsx("span",{className:"px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:"任课教师"})}),n.jsx("td",{className:"py-4 px-4",children:V.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/30 text-xs font-medium",children:[n.jsx(bs,{className:"w-3 h-3"}),"已停用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 text-xs font-medium",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常可用"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400 font-mono",children:V.lastLoginAt?new Date(V.lastLoginAt).toLocaleString():n.jsxs("span",{className:"text-slate-600 flex items-center gap-1",children:[n.jsx(Kn,{className:"w-3 h-3"}),"从未登录"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>{q(V),Z("")},className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-slate-800 hover:bg-slate-700 text-sky-400 hover:text-sky-300 text-xs font-medium border border-slate-700 transition-colors",title:"重置登录密码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"重置密码"})]}),n.jsx("button",{type:"button",onClick:()=>fe(V),className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${V.isLocked?"bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 border-rose-500/30"}`,title:V.isLocked?"恢复账号":"停用账号",children:V.isLocked?n.jsxs(n.Fragment,{children:[n.jsx(ea,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"恢复"})]}):n.jsxs(n.Fragment,{children:[n.jsx(bs,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"停用"})]})})]})})]},V.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(Hn,{className:"w-5 h-5 text-sky-400"}),"开设新账号"]}),n.jsxs("form",{onSubmit:Ue,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教师真实姓名"}),n.jsx("input",{type:"text",value:C,onChange:V=>S(V.target.value),placeholder:"如 王老师 / 李明",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsx("input",{type:"text",value:m,onChange:V=>y(V.target.value),placeholder:"如 teacher_wang",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录初始密码"}),n.jsx("input",{type:"password",value:p,onChange:V=>j(V.target.value),placeholder:"••••••••",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"角色权限"}),n.jsxs("select",{value:$,onChange:V=>D(V.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",children:[n.jsx("option",{value:"Teacher",children:"普通科任教师 (仅呼叫与回执)"}),n.jsx("option",{value:"SchoolAdmin",children:"学校管理员 (可管理班级与账号)"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"开设计算中...":"确认开通"})]})]})]})}),I&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-sky-500/10 border border-sky-500/20 text-sky-400",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"重置教师密码"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",I.fullName," (",I.username,")"]})]})]}),n.jsxs("form",{onSubmit:$e,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"请输入新密码 (不少于 6 位)"}),n.jsx("input",{type:"text",autoFocus:!0,required:!0,minLength:6,value:G,onChange:V=>Z(V.target.value),placeholder:"例如: Teacher@2026",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm font-mono focus:ring-2 focus:ring-sky-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"密码重置后请告知教师,教师下一次在网页端或移动端即可使用此新密码登录。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",disabled:te,onClick:()=>q(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:te||G.length<6,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50 flex items-center gap-1.5",children:te?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在重置..."})]}):n.jsx("span",{children:"确认重置密码"})})]})]})]})}),K&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:`p-2.5 rounded-xl border ${K.isLocked?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-rose-500/10 border-rose-500/20 text-rose-400"}`,children:K.isLocked?n.jsx(ea,{className:"w-5 h-5"}):n.jsx(bs,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:K.isLocked?"恢复启用教师账号?":"停用该教师账号?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",K.fullName," (",K.username,")"]})]})]}),n.jsx("p",{className:"text-xs text-slate-300 leading-relaxed mb-5",children:K.isLocked?"恢复启用后,该教师可重新登录控制台并向关联班级发送上课通知。":"停用后,该教师将无法登录网页控制台与 Android 移动端,且无法继续发送呼叫通知。教师的历史发送记录与回执将完整保留。"}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:pe,onClick:()=>fe(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"button",disabled:pe,onClick:Te,className:`px-4 py-2 rounded-xl text-white text-xs font-semibold shadow-lg transition-all flex items-center gap-1.5 disabled:opacity-50 ${K.isLocked?"bg-emerald-600 hover:bg-emerald-500 shadow-emerald-600/25":"bg-rose-600 hover:bg-rose-500 shadow-rose-600/25"}`,children:pe?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"处理中..."})]}):n.jsx("span",{children:K.isLocked?"确认恢复启用":"确认停用账号"})})]})]})})]})},px=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),[p,j]=g.useState(null),[C,S]=g.useState(!1),[$,D]=g.useState(""),[H,F]=g.useState(!1),[I,q]=g.useState(null),G=async()=>{f(!0),y(null);try{const[O,K]=await Promise.all([oe.getSchoolCodes(),oe.getSchoolClasses()]);l(O),u(K),K.length>0&&!$&&D(K[0].id)}catch(O){y((O==null?void 0:O.message)||"加载本校激活码数据失败")}finally{f(!1)}};g.useEffect(()=>{G()},[]);const Z=O=>{navigator.clipboard.writeText(O),j(O),setTimeout(()=>j(null),2e3)},te=async O=>{if(O.preventDefault(),!!$){F(!0),q(null);try{await oe.generateSchoolCode($),S(!1),G()}catch(K){q((K==null?void 0:K.message)||"生成激活码失败")}finally{F(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教室终端激活码"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理本校教室电脑安装所需的 8 位一次性硬件绑定激活码"})]}),n.jsxs("button",{onClick:()=>{q(null),S(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:G,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在加载本校激活码..."})]})})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-500",children:"本校暂无生成的激活码,请点击右上角生成"})}):a.map(O=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-mono font-bold text-sky-400 text-base flex items-center gap-2",children:[n.jsx("span",{children:O.code}),n.jsx("button",{onClick:()=>Z(O.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:p===O.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:O.classroomName||O.classroomId}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:O.classroomId})]}),n.jsx("td",{className:"py-4 px-4",children:O.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:[n.jsx(Pt,{className:"w-3.5 h-3.5 text-slate-500"}),"已激活使用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),"待激活 (可用)"]})}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:O.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:O.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsxs("span",{children:[new Date(O.expiresAt).toLocaleDateString()," 到期"]})]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsx("button",{onClick:()=>Z(O.code),className:"text-xs text-slate-400 hover:text-white underline underline-offset-4",children:p===O.code?"已复制":"复制用于安装"})})]},O.code))})]})})}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-sky-400"}),"生成本校班级设备激活码"]}),I&&n.jsx("div",{className:"mb-4 p-3 rounded-lg bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs",children:I}),n.jsxs("form",{onSubmit:te,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标班级"}),o.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-2 bg-amber-500/10 rounded-lg border border-amber-500/30",children:"本校暂无班级,请先前往“班级管理”创建班级。"}):n.jsx("select",{value:$,onChange:O=>D(O.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0,children:o.map(O=>n.jsxs("option",{value:O.id,children:[O.displayName," (",O.id,")"]},O.id))})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>S(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H||o.length===0,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"生成中...":"立即生成"})]})]})]})})]})};function Ed(a){if(typeof a=="string")switch(a.toLowerCase()){case"acknowledged":case"confirmed":return"Acknowledged";case"delivered":return"Delivered";case"sent":return"Sent";case"cancelled":case"canceled":return"Cancelled";case"timeout":return"Timeout";case"failed":return"Failed";default:return"Sent"}switch(a){case 5:return"Cancelled";case 2:return"Acknowledged";case 1:return"Delivered";case 0:return"Sent";case 3:return"Timeout";case 4:return"Failed";default:return"Sent"}}const xx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(""),[d,f]=g.useState(""),[m,y]=g.useState(""),[p,j]=g.useState(!0),[C,S]=g.useState(!0),[$,D]=g.useState(!1),[H,F]=g.useState(15),[I,q]=g.useState(!1),[G,Z]=g.useState([]),[te,O]=g.useState(!0),[K,fe]=g.useState(null),[pe,b]=g.useState(null),[ne,Ee]=g.useState(null),[je,_e]=g.useState(!1),[Ue,$e]=g.useState(null),[Te,V]=g.useState(1),k=async(U,de,ot,be)=>{b({notificationId:U,deviceId:de,className:ot,capturedAt:be}),_e(!0),$e(null),Ee(null),V(1);try{const We=await oe.getVisualReceiptBlob(U,de),Le=URL.createObjectURL(We);Ee(Le)}catch(We){$e((We==null?void 0:We.message)||"获取视觉核验图像失败")}finally{_e(!1)}},W=()=>{ne&&URL.revokeObjectURL(ne),Ee(null),b(null),$e(null),V(1)},[T,N]=g.useState(null),[L,ie]=g.useState(!1),ce=async()=>{if(T){ie(!0);try{await oe.cancelNotification(T.id),Z(U=>U.map(de=>de.id===T.id?{...de,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:de)),N(null)}catch(U){alert(U.message||"提前关闭通知失败")}finally{ie(!1)}}},he=na.useRef(a);g.useEffect(()=>{he.current=a},[a]);const ve=["请带各科作业本到办公室","马上到操场集合整队","课代表请到教研室领试卷","午休时间请教室内保持安静","请班长负责维护自习纪律","放学后值日生留下来打扫卫生"],ke=async()=>{O(!0),fe(null);try{const U=await oe.getTeacherClasses();l(U),U.length>0&&!o&&u(U[0].id);const de=await oe.getTeacherHistory(void 0,20);Z(de.map(ot=>({...ot,status:Ed(ot.status)})))}catch(U){fe((U==null?void 0:U.message)||"加载班级或历史记录失败")}finally{O(!1)}};g.useEffect(()=>{ke()},[]),g.useEffect(()=>{const U=Ot.onAckReceiptReceived(be=>{Z(We=>We.map(Le=>{if(Le.id===be.messageId){const Jn=Ed(be.status);return{...Le,status:Jn,confirmedAt:be.timestamp||Le.confirmedAt||new Date().toISOString()}}return Le}))}),de=Ot.onNewNotificationBroadcast(be=>{Z(We=>{if(We.some(nn=>nn.id===be.id))return We;const Le=he.current.find(nn=>nn.id===be.classId);return[{id:be.id,tenantId:be.tenantId,classId:be.classId,className:(Le==null?void 0:Le.displayName)||be.classId,senderName:"教师",message:be.message,priority:be.type===2?"Urgent":"Normal",createdAt:be.createdAt,status:"Sent"},...We]})}),ot=Ot.onNotificationCancelled(be=>{Z(We=>We.map(Le=>Le.id===be?{...Le,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:Le))});return()=>{U(),de(),ot()}},[]);const Ne=async U=>{if(U.preventDefault(),!(!o||!m.trim())){q(!0);try{const de=a.find(Le=>Le.id===o),ot=d.trim()?`🔔 老师呼叫: ${d.trim()}`:`📢 ${(de==null?void 0:de.displayName)||"班级"}通知`,be=await oe.sendNotification({classId:o,studentName:d.trim()||void 0,title:ot,message:m.trim(),type:$?2:0,voice:p,shake:C,durationSeconds:H}),We=m.trim();y(""),f(""),be!=null&&be.messageId&&Z(Le=>Le.some(nn=>nn.id===be.messageId)?Le:[{id:be.messageId,tenantId:"",classId:o,className:(de==null?void 0:de.displayName)||o,senderName:"教师",message:We,priority:$?"Urgent":"Normal",createdAt:new Date().toISOString(),status:"Sent"},...Le])}catch(de){alert(de.message||"呼叫发送失败")}finally{q(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"教师呼叫工作台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"向指定教室大屏下发即时点呼与通知,支持语音朗读(TTS)与学生回执确认"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),K&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:K})]}),n.jsxs("button",{onClick:ke,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[n.jsx("div",{className:"lg:col-span-7 space-y-5",children:n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:Ne,className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-2",children:"目标授课班级"}),a.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-3 bg-amber-500/10 rounded-xl border border-amber-500/30",children:"未查询到可用班级,请联系学校管理员添加班级"}):n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:a.map(U=>{const de=o===U.id;return n.jsxs("button",{type:"button",onClick:()=>u(U.id),className:`p-3 rounded-xl border text-left transition-all relative ${de?"bg-indigo-600/20 border-indigo-500/50 text-white shadow-lg shadow-indigo-600/10":"bg-slate-900/60 border-slate-800 text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[n.jsx("div",{className:"font-semibold text-sm truncate",children:U.displayName}),n.jsx("div",{className:"text-[11px] text-slate-500 truncate mt-0.5",children:U.roomNumber||U.id}),de&&n.jsx(Fl,{className:"w-4 h-4 text-indigo-400 absolute top-3 right-3"})]},U.id)})})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Xd,{className:"w-3.5 h-3.5 text-slate-400"}),"指定学生姓名(可选,点呼场景使用)"]}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"留空则为全班广播"})]}),n.jsx("input",{type:"text",value:d,onChange:U=>f(U.target.value),placeholder:"如:张三、李四(支持单人或多人)",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsx("span",{children:"呼叫通知内容"}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:[m.length,"/200 字"]})]}),n.jsx("textarea",{rows:4,value:m,onChange:U=>y(U.target.value.slice(0,200)),placeholder:"请输入需要大屏弹窗展示并朗读的内容...",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600",required:!0})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Jd,{className:"w-3.5 h-3.5 text-amber-400"}),"快捷点呼短语推荐"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:ve.map((U,de)=>n.jsx("button",{type:"button",onClick:()=>y(U),className:"px-2.5 py-1 rounded-lg bg-slate-900 border border-slate-800 text-xs text-slate-300 hover:text-white hover:bg-slate-800 hover:border-slate-700 transition-colors",children:U},de))})]}),n.jsxs("div",{className:"pt-2 border-t border-slate-800/80 grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:p,onChange:U=>j(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-indigo-400"}),"TTS 语音朗读"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"教室音响朗读2遍"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:C,onChange:U=>S(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsx("span",{className:"font-medium text-slate-200 block",children:"窗口抖动震颤"}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"强制吸引注意力"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:$,onChange:U=>D(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-rose-600 focus:ring-rose-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(ks,{className:"w-3.5 h-3.5 text-rose-400"}),"紧急通知"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"红色全屏强提醒"})]})]})]}),n.jsx("button",{type:"submit",disabled:I||!o||!m.trim(),className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 text-white font-semibold text-sm shadow-lg shadow-indigo-600/25 flex items-center justify-center gap-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:I?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在秒级投递至教室大屏..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"立即下发到教室大屏"})]})})]})})}),n.jsx("div",{className:"lg:col-span-5 space-y-4",children:n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-emerald-400"}),"实时回执动态 (ACK)"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"SignalR 实时推送"})]}),n.jsx("div",{className:"space-y-3 max-h-[580px] overflow-y-auto pr-1",children:te&&G.length===0?n.jsxs("div",{className:"text-center py-16 text-xs text-slate-500",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin mx-auto mb-2 text-indigo-400"}),n.jsx("span",{children:"正在加载历史动态..."})]}):G.length===0?n.jsx("div",{className:"text-center py-16 text-xs text-slate-500",children:"暂无发送记录,在左侧选择班级即可下发第一条呼叫"}):G.map(U=>n.jsxs("div",{className:"glass-card p-4 space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-sm text-white",children:U.className}),n.jsx("span",{className:"text-[11px] font-mono text-slate-500",children:new Date(U.createdAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-xs text-slate-300 bg-slate-950/50 p-2.5 rounded-lg border border-slate-800/80",children:U.message}),n.jsxs("div",{className:"pt-1.5 border-t border-slate-800/60 flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-slate-400 text-[11px]",children:"回执阶段:"}),U.status==="Cancelled"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-slate-400 font-medium",children:[n.jsx(Go,{className:"w-3.5 h-3.5 text-slate-400"}),n.jsx("span",{children:"已提前关闭撤回"})]}),U.status==="Acknowledged"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(Pt,{className:"w-4 h-4 text-emerald-400"}),n.jsxs("span",{children:["学生已点击确认 (",U.confirmedAt?new Date(U.confirmedAt).toLocaleTimeString():"刚刚",")"]})]}),U.status==="Delivered"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sky-400 font-medium",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"教室大屏已接收"})]}),U.status==="Sent"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"云端投递中..."})]}),U.status==="Timeout"&&n.jsx("div",{className:"text-slate-400 text-xs",children:n.jsx("span",{children:"超时已自动关闭"})}),U.status==="Failed"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-rose-400 font-medium",children:[n.jsx(ks,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"投递失败"})]})]}),(U.status==="Sent"||U.status==="Delivered")&&!U.isCancelled&&n.jsx("div",{className:"flex items-center justify-end pt-1",children:n.jsxs("button",{type:"button",onClick:()=>N(U),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded bg-rose-500/10 hover:bg-rose-500/20 text-rose-300 text-[11px] font-medium transition-colors border border-rose-500/30",title:"在大屏端停止TTS并关闭弹窗",children:[n.jsx(kr,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"提前关闭 / 撤回"})]})}),U.receipts&&U.receipts.length>0&&(()=>{const de=U.receipts.find(be=>be.visualReceiptState==="Available"),ot=U.receipts.find(be=>be.visualReceiptState==="Expired");return de?n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-xs",children:[n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(_s,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:"视觉核验:已完成"})]}),n.jsxs("button",{type:"button",onClick:()=>k(U.id,de.deviceId,U.className,de.visualReceiptCapturedAt),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-indigo-600/30 hover:bg-indigo-600/50 text-indigo-300 text-[11px] font-medium transition-colors border border-indigo-500/30",children:[n.jsx(m0,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"查看大屏实际展示"})]})]}):ot?n.jsx("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-[11px] text-slate-500",children:n.jsxs("div",{className:"inline-flex items-center gap-1",children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsx("span",{children:"视觉核验:已按 24h 策略自动销毁"})]})}):null})()]},U.id))})]})})]}),pe&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel w-full max-w-3xl bg-slate-900 border-slate-800 rounded-2xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-800 bg-slate-950/60",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_s,{className:"w-5 h-5 text-emerald-400"}),n.jsxs("h3",{className:"font-semibold text-white text-base",children:[pe.className," · 通知视觉核验"]})]}),n.jsx("button",{type:"button",onClick:W,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 flex-1 overflow-auto flex flex-col items-center justify-center min-h-[320px] bg-slate-950/40",children:[je&&n.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 text-sm",children:[n.jsx(kn,{className:"w-8 h-8 animate-spin text-indigo-400"}),n.jsx("span",{children:"正在安全解密并加载现场回执画面..."})]}),Ue&&n.jsxs("div",{className:"flex flex-col items-center gap-2 text-rose-400 text-sm",children:[n.jsx(Sn,{className:"w-8 h-8 text-rose-400"}),n.jsx("span",{children:Ue})]}),ne&&!je&&n.jsxs("div",{className:"flex flex-col items-center w-full",children:[n.jsx("div",{className:"overflow-auto max-h-[60vh] max-w-full flex items-center justify-center p-2 rounded-xl bg-black/60 border border-slate-800",children:n.jsx("img",{src:ne,alt:"教室大屏实际展示画面",style:{transform:`scale(${Te})`,transformOrigin:"center center",transition:"transform 0.2s"},className:"rounded-lg shadow-lg object-contain max-h-[55vh]"})}),n.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[n.jsx("button",{type:"button",onClick:()=>V(U=>Math.max(.5,+(U-.25).toFixed(2))),disabled:Te<=.5,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"缩小",children:n.jsx(nx,{className:"w-4 h-4"})}),n.jsxs("span",{className:"text-xs font-mono text-slate-300 min-w-[50px] text-center",children:[Math.round(Te*100),"%"]}),n.jsx("button",{type:"button",onClick:()=>V(U=>Math.min(3,+(U+.25).toFixed(2))),disabled:Te>=3,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"放大",children:n.jsx(ex,{className:"w-4 h-4"})}),n.jsx("button",{type:"button",onClick:()=>V(1),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"重置"})]})]})]}),n.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between text-[11px] text-slate-400 gap-2",children:[n.jsx("span",{children:pe.capturedAt?`捕获时间: ${new Date(pe.capturedAt).toLocaleString()}`:""}),n.jsx("span",{className:"text-amber-400/90 text-right",children:"该现场画面仅用于核验通知是否成功显示,并将在捕获后 24 小时自动销毁。"})]})]})}),T&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-400",children:n.jsx(ks,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"提前关闭并撤回通知?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["目标班级: ",T.className]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 mb-4 text-xs text-slate-300",children:[n.jsx("div",{className:"text-slate-400 text-[11px] mb-1",children:"通知内容:"}),n.jsx("p",{className:"line-clamp-3",children:T.message})]}),n.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-[11px] text-amber-300/90 mb-5 leading-relaxed",children:["💡 确认后,云端将立即向教室大屏发出关闭指令,大屏将",n.jsx("strong",{children:"立即停止 TTS 语音播报"}),"并",n.jsx("strong",{children:"收起弹窗窗口"}),"。"]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:L,onClick:()=>N(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"button",disabled:L,onClick:ce,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/25 transition-all flex items-center gap-1.5 disabled:opacity-50",children:L?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在撤回..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"确认提前关闭"})]})})]})]})})]})},gx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户身份..."}):a?n.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col",children:[n.jsx(sx,{}),n.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n.jsx(Bd,{})})]}):n.jsx(Vt,{to:"/login",replace:!0})},vx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在初始化..."}):a?a.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):a.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},yx=()=>n.jsxs(Zm,{children:[n.jsx(Qe,{path:"/login",element:n.jsx(rx,{})}),n.jsx(Qe,{path:"/",element:n.jsx(vx,{})}),n.jsxs(Qe,{element:n.jsx(gx,{}),children:[n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SuperAdmin"]}),children:[n.jsx(Qe,{path:"/admin",element:n.jsx(lx,{})}),n.jsx(Qe,{path:"/admin/tenants",element:n.jsx(cx,{})}),n.jsx(Qe,{path:"/admin/users",element:n.jsx(ux,{})}),n.jsx(Qe,{path:"/admin/devices",element:n.jsx(ix,{})}),n.jsx(Qe,{path:"/admin/broadcast",element:n.jsx(dx,{})}),n.jsx(Qe,{path:"/admin/codes",element:n.jsx(ox,{})}),n.jsx(Qe,{path:"/admin/history",element:n.jsx(ax,{})})]}),n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SchoolAdmin"]}),children:[n.jsx(Qe,{path:"/school-admin",element:n.jsx(hx,{})}),n.jsx(Qe,{path:"/school-admin/classes",element:n.jsx(fx,{})}),n.jsx(Qe,{path:"/school-admin/teachers",element:n.jsx(mx,{})}),n.jsx(Qe,{path:"/school-admin/codes",element:n.jsx(px,{})})]}),n.jsx(Qe,{element:n.jsx(Qo,{allowedRoles:["Teacher"]}),children:n.jsx(Qe,{path:"/teacher",element:n.jsx(xx,{})})})]}),n.jsx(Qe,{path:"*",element:n.jsx(Vt,{to:"/",replace:!0})})]}),wx=()=>n.jsx(Gp,{children:n.jsx(op,{children:n.jsx(yx,{})})});om.createRoot(document.getElementById("root")).render(n.jsx(na.StrictMode,{children:n.jsx(wx,{})})); /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/assets/index-DYQz3G89.css SIZE: 36341 chars SHA256: B1B268B90712BE5D9B908A9DC136D98C5880051D2EF9C3C07419FB28E2EFE51F ===================================================================== */ *,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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}body{min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}body *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.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}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-5rem}.-top-20{top:-5rem}.left-3\.5{left:.875rem}.right-3{right:.75rem}.top-0{top:0}.top-3{top:.75rem}.top-3\.5{top:.875rem}.z-10{z-index:10}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.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}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.max-h-\[55vh\]{max-height:55vh}.max-h-\[580px\]{max-height:580px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[320px\]{min-height:320px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-full{width:100%}.min-w-\[50px\]{min-width:50px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.transform{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 ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@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-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.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-6{gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-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-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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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))}.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-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/50{border-color:#10b98180}.border-indigo-500\/20{border-color:#6366f133}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/50{border-color:#6366f180}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-sky-500\/20{border-color:#0ea5e933}.border-sky-500\/30{border-color:#0ea5e94d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/40{border-color:#1e293b66}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/25{background-color:#f59e0b40}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/15{background-color:#05966926}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-950\/20{background-color:#022c2233}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/10{background-color:#4f46e51a}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-600\/30{background-color:#4f46e54d}.bg-rose-400{--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/15{background-color:#f43f5e26}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity, 1))}.bg-rose-600\/15{background-color:#e11d4826}.bg-rose-600\/20{background-color:#e11d4833}.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-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1))}.bg-sky-600\/10{background-color:#0284c71a}.bg-sky-600\/20{background-color:#0284c733}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/50{background-color:#02061780}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/70{background-color:#020617b3}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/95{background-color:#020617f2}.bg-transparent{background-color:transparent}.bg-violet-500\/10{background-color:#8b5cf61a}.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))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b 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-indigo-600{--tw-gradient-from: #4f46e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-950{--tw-gradient-from: #020617 var(--tw-gradient-from-position);--tw-gradient-to: rgb(2 6 23 / 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)}.via-slate-200{--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #e2e8f0 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-900{--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #0f172a var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-950\/40{--tw-gradient-to: rgb(30 27 75 / .4) var(--tw-gradient-to-position)}.to-slate-400{--tw-gradient-to: #94a3b8 var(--tw-gradient-to-position)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.to-violet-600{--tw-gradient-to: #7c3aed var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.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-8{padding:2rem}.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}.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-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pr-1{padding-right:.25rem}.pr-4{padding-right:1rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-\[\'Inter\'\,system-ui\,-apple-system\,sans-serif\]{font-family:Inter,system-ui,-apple-system,sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.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-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/90{color:#fcd34de6}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/90{color:#fbbf24e6}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.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-400\/80{color:#34d399cc}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-300\/90{color:#fda4afe6}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-400\/90{color:#fb7185e6}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / 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))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.accent-indigo-500{accent-color:#6366f1}.opacity-70{opacity:.7}.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-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-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-amber-500\/10{--tw-shadow-color: rgb(245 158 11 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/25{--tw-shadow-color: rgb(245 158 11 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-600\/25{--tw-shadow-color: rgb(5 150 105 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/25{--tw-shadow-color: rgb(99 102 241 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/10{--tw-shadow-color: rgb(79 70 229 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/25{--tw-shadow-color: rgb(79 70 229 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/30{--tw-shadow-color: rgb(79 70 229 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/25{--tw-shadow-color: rgb(225 29 72 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/30{--tw-shadow-color: rgb(225 29 72 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-600\/25{--tw-shadow-color: rgb(2 132 199 / .25);--tw-shadow: var(--tw-shadow-colored)}.blur-3xl{--tw-blur: blur(64px);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-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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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-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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.glass-panel{border-radius:1rem;border-width:1px;border-color:#1e293bcc;background-color:#0f172ab3;--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);--tw-backdrop-blur: blur(24px);-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)}.glass-card{border-radius:.75rem;border-width:1px;border-color:#33415580;background-color:#1e293b66;--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);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.glass-card:hover{border-color:#475569b3;background-color:#1e293b99}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:border-amber-500\/50:hover{border-color:#f59e0b80}.hover\:border-emerald-500\/50:hover{border-color:#10b98180}.hover\:border-indigo-500\/50:hover{border-color:#6366f180}.hover\:border-rose-500\/50:hover{border-color:#f43f5e80}.hover\:border-rose-700\/50:hover{border-color:#be123c80}.hover\:border-sky-500\/50:hover{border-color:#0ea5e980}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-amber-500:hover{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-600\/25:hover{background-color:#05966940}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-600\/20:hover{background-color:#4f46e533}.hover\:bg-indigo-600\/50:hover{background-color:#4f46e580}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-500\/20:hover{background-color:#f43f5e33}.hover\:bg-rose-600\/25:hover{background-color:#e11d4840}.hover\:bg-rose-900\/40:hover{background-color:#88133766}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-600\/20:hover{background-color:#0284c733}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/20:hover{background-color:#1e293b33}.hover\:bg-slate-800\/25:hover{background-color:#1e293b40}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-indigo-500:hover{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-500:hover{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.hover\:to-violet-500:hover{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-rose-300:hover{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.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}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.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:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/50:focus{--tw-ring-color: rgb(99 102 241 / .5)}.focus\:ring-rose-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(244 63 94 / var(--tw-ring-opacity, 1))}.focus\:ring-sky-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1))}.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))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:translate-x-1{--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))}.group:hover .group-hover\:text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:block{display:block}.sm\:flex{display:flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media(min-width:768px){.md\:flex{display:flex}.md\:hidden{display:none}.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}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media(min-width:1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}} /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/index.html SIZE: 957 chars SHA256: 9021E66A9ACB97367F2B73B40BC60729A3C323A4DE1A6D715777B6EE718BC24A ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/DeviceCommandTimeoutWorker.cs SIZE: 4641 chars SHA256: 7B98FB1CB55A595434BA263D5F231EF9756259456771FB3A18F1DB0BC35180ED ===================================================================== */ using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Server.Hubs; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace ClassNotify.Server.Services; /// /// 后台受控远程命令超时与生命周期流转服务 /// 严格兑现封板要求: /// 1. Pending 超时 -> 自动标记 Expired 并推 TeacherHub /// 2. Dispatched 超过 TTL 或持续无心跳响应 -> 自动标记 TimedOut 并推 TeacherHub /// 3. 定期持久化状态至 PostgreSQL 实体 /// public class DeviceCommandTimeoutWorker : BackgroundService { private readonly IServiceScopeFactory _scopeFactory; private readonly IHubContext _teacherHub; private readonly ILogger _logger; private readonly TimeSpan _checkInterval; public DeviceCommandTimeoutWorker( IServiceScopeFactory scopeFactory, IHubContext teacherHub, ILogger logger, TimeSpan? checkInterval = null) { _scopeFactory = scopeFactory; _teacherHub = teacherHub; _logger = logger; _checkInterval = checkInterval ?? TimeSpan.FromSeconds(10); } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("DeviceCommandTimeoutWorker started (CheckInterval: {Interval}s)", _checkInterval.TotalSeconds); while (!stoppingToken.IsCancellationRequested) { try { await ProcessTimeoutsAsync(stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } catch (Exception ex) { _logger.LogError(ex, "Error processing device command timeouts and expirations"); } try { await Task.Delay(_checkInterval, stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } } _logger.LogInformation("DeviceCommandTimeoutWorker stopped."); } public async Task ProcessTimeoutsAsync(CancellationToken cancellationToken = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; // Fetch all active non-terminal commands var activeCommands = await db.DeviceCommands .Where(c => c.Status == DeviceCommandStatuses.Pending || c.Status == DeviceCommandStatuses.Dispatched) .ToListAsync(cancellationToken); if (activeCommands.Count == 0) return 0; var transitioned = new List(); foreach (var cmd in activeCommands) { if (Domain.Entities.DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { transitioned.Add(cmd); _logger.LogWarning("Command {CommandId} (Device {DeviceId}, Tenant {TenantId}) transitioned to terminal status '{Status}': {Reason}", cmd.Id, cmd.DeviceId, cmd.TenantId, cmd.Status, cmd.ResultMessage); } } if (transitioned.Count == 0) return 0; // 1. SAVE TO DATABASE FIRST - Fail-safe against broadcasting ghost states await db.SaveChangesAsync(cancellationToken); // 2. BROADCAST TO TEACHERHUB ONLY AFTER DB PERSISTENCE SUCCEEDS foreach (var cmd in transitioned) { var resultDto = new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? (cmd.Status == DeviceCommandStatuses.Expired ? -2 : -4), ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? 0, Timestamp = now }; try { await _teacherHub.Clients.Group($"t:{cmd.TenantId}:teachers").OnDeviceCommandStatusChanged(resultDto); } catch (Exception ex) { _logger.LogWarning(ex, "Failed to broadcast command status change for {CommandId} to TeacherHub", cmd.Id); } } return transitioned.Count; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/ISecurityService.cs SIZE: 5589 chars SHA256: 384B29A4F41C8164C59E630449F659F2074980EB554D8CD7193994AA71539D3D ===================================================================== */ using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Models; namespace ClassNotify.Server.Services; public sealed record DeviceConnectionRegistrationResult( string CurrentConnectionId, string? ReplacedConnectionId); public interface ISecurityService { // Auth & Identity Task LoginTeacherAsync(TeacherLoginDto dto, string? remoteIp = null); Task ActivateDeviceAsync(DeviceActivationRequestDto dto); Task ValidateDeviceAsync(string deviceId, string deviceToken); // Tenant & Classrooms Task GetClassroomAsync(string tenantId, string classId); Task> GetClassroomsAsync(string tenantId); Task CreateClassroomAsync(string tenantId, CreateClassroomDto dto); Task GetTenantAsync(string tenantId); Task> GetTenantsOverviewAsync(); // Users Task> GetUsersAsync(string tenantId); Task CreateUserAsync(string tenantId, CreateTeacherDto dto); // Devices & Metrics Task GetAdminMetricsAsync(); Task> GetAllDevicesAsync(); Task> GetTenantDevicesAsync(string tenantId); Task RegisterDeviceConnectionAsync(string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion); Task UnregisterDeviceConnectionAsync(string connectionId); bool IsCurrentDeviceConnection(string deviceId, string connectionId); Task UpdateDeviceHeartbeatAsync(string connectionId); string? GetDeviceConnectionId(string deviceId); // Activation Codes Task GenerateActivationCodeAsync(string tenantId, string classId, string? actor = null, string? actorRole = null, string? ip = null); Task> GetActivationCodesAsync(string? tenantId); // Notifications & ACKs (PostgreSQL & NotificationReceipt per-device isolation) Task RecordNotificationAsync(NotificationDto notification, string? senderUserId, string senderName); Task RecordAckAsync(string messageId, string authenticatedDeviceId, AckReceiptDto ack); Task ValidateNotificationTargetAsync(string messageId, string tenantId, string classroomId); Task> GetNotificationsAsync(string? tenantId, string? classId, int limit = 50); Task> GetPendingNotificationsForDeviceAsync(string deviceId); Task CancelNotificationAsync(string notificationId, string actorUserId, string actorUsername, string role, string tenantId, string? ip, CancellationToken ct = default); Task ResetSchoolTeacherPasswordAsync(string schoolAdminTenantId, string teacherUserId, string newPassword, string actorUsername, string? ip, CancellationToken ct = default); Task SetSchoolTeacherLockAsync(string schoolAdminTenantId, string teacherUserId, bool isLocked, string actorUsername, string? ip, CancellationToken ct = default); Task GetBroadcastReceiptSummaryAsync(string broadcastId, CancellationToken ct = default); // Device Commands (P1 Batch 10) Task CreateDeviceCommandAsync(string? callerTenantId, string deviceId, string commandType, string? parameters, string createdBy, string? actorRole = null, string? ip = null); Task MarkCommandDispatchedAsync(string commandId); Task RecordCommandResultAsync(DeviceCommandResultDto result, string callerDeviceId, string? callerTenantId); Task GetDeviceCommandAsync(string commandId, string? callerTenantId = null); Task> GetPendingCommandsForDeviceAsync(string deviceId); Task> GetDeviceCommandHistoryAsync(string? tenantId, string? deviceId, string? status, int limit = 50); // SuperAdmin Control Plane Extensions Task CreateTenantAsync(string id, string name, string? actor = null, string? actorRole = null, string? ip = null); Task UpdateTenantAsync(string id, string name, bool isActive, string? actor = null, string? actorRole = null, string? ip = null); Task> GetAllUsersAdminAsync(string? tenantId, string? role); Task CreateUserAdminAsync(CreateUserAdminRequest req, string? actor = null, string? actorRole = null, string? ip = null); Task ResetPasswordAsync(string userId, string newPassword, string? actor = null, string? actorRole = null, string? ip = null); Task SetUserLockAsync(string userId, bool isLocked, string? actor = null, string? actorRole = null, string? ip = null); Task DeleteUserAsync(string userId, string? actor = null, string? actorRole = null, string? ip = null); Task UpdateDeviceAsync(string deviceId, string? hostname, string? classroomId, string? actor = null, string? actorRole = null, string? ip = null); Task DecommissionDeviceAsync(string deviceId, string? actor = null, string? actorRole = null, string? ip = null); Task DeleteActivationCodeAsync(string code, string? actor = null, string? actorRole = null, string? ip = null); Task GetSystemHealthAsync(); Task LogAdminAuditAsync(string actorUsername, string actorRole, string action, string targetType, string targetId, string? details, string? ip); Task> GetAdminAuditLogsAsync(int limit = 100); } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/IVisualReceiptService.cs SIZE: 769 chars SHA256: 2C2D2646C69CCDEDED145F65F9835D23EF76AB9207DF1D164F4B56BB8BC47928 ===================================================================== */ using System.Security.Claims; namespace ClassNotify.Server.Services; public record VisualReceiptUploadResult(bool Success, string Message, int StatusCode, string? ReceiptId = null, DateTimeOffset? CapturedAt = null, DateTimeOffset? ExpiresAt = null); public record VisualReceiptFileResult(bool Success, string? FilePath = null, int StatusCode = 200, string? ErrorMessage = null); public interface IVisualReceiptService { Task SaveVisualReceiptAsync(string notificationId, string deviceId, string deviceToken, byte[] jpegBytes); Task GetVisualReceiptFileAsync(string notificationId, string deviceId, ClaimsPrincipal user); Task CleanupExpiredVisualReceiptsAsync(CancellationToken ct = default); } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/SecurityService.cs SIZE: 89235 chars SHA256: 658EF0791E14B4317A3FBDB93CC045E0DBABABBF96F86CB6257A7007498F1165 ===================================================================== */ using System.Collections.Concurrent; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Security.Cryptography; using System.Text; using ClassNotify.Server.Configuration; using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; namespace ClassNotify.Server.Services; public class LiveConnectionInfo { public string ConnectionId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string? Hostname { get; set; } public string? RemoteIp { get; set; } public string? ClientVersion { get; set; } public DateTimeOffset LastHeartbeat { get; set; } = DateTimeOffset.UtcNow; public LiveConnectionInfo(string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion, DateTimeOffset lastHeartbeat) { ConnectionId = connectionId; DeviceId = deviceId; TenantId = tenantId; ClassroomId = classroomId; Hostname = hostname; RemoteIp = remoteIp; ClientVersion = clientVersion; LastHeartbeat = lastHeartbeat; } } public class SecurityService : ISecurityService { private readonly IServiceScopeFactory _scopeFactory; private readonly ILogger _logger; private readonly IDataProtector _protector; private readonly IPasswordHasher _passwordHasher; private readonly JwtOptions _jwtOptions; // In-memory real-time SignalR live connection registries (NOT in PostgreSQL) private readonly ConcurrentDictionary _liveConnections = new(); private readonly ConcurrentDictionary _deviceToConnection = new(); private readonly ConcurrentDictionary _connectionTenantMap = new(); // Heartbeat DB update throttle map (at most once every 30s per device) private readonly ConcurrentDictionary _lastHeartbeatDbUpdate = new(); public SecurityService( IServiceScopeFactory scopeFactory, IDataProtectionProvider dataProtectionProvider, IPasswordHasher passwordHasher, IOptions jwtOptions, ILogger logger) { _scopeFactory = scopeFactory; _logger = logger; _protector = dataProtectionProvider.CreateProtector("ClassNotify.DeviceTokens.v1"); _passwordHasher = passwordHasher; _jwtOptions = jwtOptions.Value; } #region Auth & Identity public async Task LoginTeacherAsync(TeacherLoginDto dto, string? remoteIp = null) { if (string.IsNullOrWhiteSpace(dto.Username) || string.IsNullOrWhiteSpace(dto.Password)) { return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名与密码不可为空" }; } var normalizedUser = dto.Username.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var user = await db.Users.FirstOrDefaultAsync(u => u.Username == normalizedUser); if (user == null) { _logger.LogWarning("Authentication failed: User '{Username}' not found. Remote IP: {RemoteIp} at {Timestamp}", normalizedUser, remoteIp ?? "unknown", DateTimeOffset.UtcNow); return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名或密码错误" }; } // P0-01 Security Gate: Check if user account is locked if (user.IsLocked) { _logger.LogWarning("Authentication rejected: Account '{Username}' is locked by administrator. Remote IP: {RemoteIp}", normalizedUser, remoteIp ?? "unknown"); return new TeacherLoginResultDto { Success = false, ErrorMessage = "该账号已被管理员锁定封禁,无法登录系统" }; } // P0-02 Security Gate: Check if school tenant is active (non-global users) if (user.TenantId != "global") { var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == user.TenantId); if (tenant != null && !tenant.IsActive) { _logger.LogWarning("Authentication rejected: User '{Username}' belongs to suspended tenant '{TenantId}'.", normalizedUser, user.TenantId); return new TeacherLoginResultDto { Success = false, ErrorMessage = "该账号所属学校已暂停服务或被冻结,请联系平台管理员" }; } } bool passwordValid = false; bool needsRehash = false; // 1. Try modern ASP.NET Core PasswordHasher var verifyResult = _passwordHasher.VerifyHashedPassword(user, user.PasswordHash, dto.Password); if (verifyResult == PasswordVerificationResult.Success) { passwordValid = true; } else if (verifyResult == PasswordVerificationResult.SuccessRehashNeeded) { passwordValid = true; needsRehash = true; } else { // 2. Fallback to legacy SHA256 with fixed salt for backward compatibility if (VerifyLegacyPassword(dto.Password, user.PasswordHash)) { passwordValid = true; needsRehash = true; _logger.LogInformation("Legacy password verified for user '{Username}'. Will upgrade to PasswordHasher.", normalizedUser); } } if (!passwordValid) { _logger.LogWarning("Authentication failed: Invalid credentials for user '{Username}'. Remote IP: {RemoteIp} at {Timestamp}", normalizedUser, remoteIp ?? "unknown", DateTimeOffset.UtcNow); return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名或密码错误" }; } // 3. Automatic on-the-fly hash upgrade if legacy or rehash needed if (needsRehash) { user.PasswordHash = _passwordHasher.HashPassword(user, dto.Password); _logger.LogInformation("Password hash successfully upgraded to ASP.NET Core PasswordHasher for user '{Username}'.", normalizedUser); } // 4. Update LastLoginAt upon successful authentication user.LastLoginAt = DateTimeOffset.UtcNow; await db.SaveChangesAsync(); _logger.LogInformation("User '{Username}' ({UserId}) successfully authenticated from IP {RemoteIp}.", normalizedUser, user.Id, remoteIp ?? "unknown"); var token = GenerateJwtToken(user); return new TeacherLoginResultDto { Success = true, Token = token, UserId = user.Id, FullName = user.FullName, TenantId = user.TenantId, Role = user.Role }; } public async Task ActivateDeviceAsync(DeviceActivationRequestDto dto) { if (string.IsNullOrWhiteSpace(dto.ActivationCode)) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码不可为空" }; } if (string.IsNullOrWhiteSpace(dto.InstallationId) || !dto.InstallationId.StartsWith("inst_") || dto.InstallationId.Length > 50) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "安装实例标识符 (InstallationId) 无效或格式不正确" }; } var normalizedCode = dto.ActivationCode.Trim().ToUpperInvariant(); var normalizedInstId = dto.InstallationId.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); using var tx = await db.Database.BeginTransactionAsync(); try { var code = await db.ActivationCodes.FirstOrDefaultAsync(c => c.Code == normalizedCode); if (code == null) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码无效" }; } if (code.IsUsed) { // P0-09 / P1-02 Idempotency Rule: If same installationId, return original device credentials if (!string.IsNullOrEmpty(code.InstallationId) && string.Equals(code.InstallationId, normalizedInstId, StringComparison.OrdinalIgnoreCase)) { var existingDev = await db.Devices.FirstOrDefaultAsync(d => (!string.IsNullOrEmpty(code.UsedByDeviceId) && d.Id == code.UsedByDeviceId) || d.InstallationId == normalizedInstId); var existingCred = await db.DeviceCredentials.FirstOrDefaultAsync(c => (!string.IsNullOrEmpty(code.UsedByDeviceId) && c.DeviceId == code.UsedByDeviceId) || c.InstallationId == normalizedInstId); var existingCls = await db.Classrooms.FirstOrDefaultAsync(c => c.TenantId == code.TenantId && c.Id == code.ClassroomId); if (existingDev != null && existingCred != null && existingCls != null) { string recoveredToken; try { recoveredToken = _protector.Unprotect(existingCred.EncryptedRecoverableToken); } catch (Exception ex) { _logger.LogError(ex, "Failed to unprotect recoverable token for InstallationId {InstallationId}", normalizedInstId); return new DeviceActivationResultDto { Success = false, ErrorMessage = "解密设备凭据失败,请联系管理员" }; } _logger.LogInformation("Idempotent activation retry for InstallationId {InstallationId}, returning recovered token for Device {DeviceId}", normalizedInstId, existingDev.Id); return new DeviceActivationResultDto { Success = true, DeviceId = existingDev.Id, DeviceToken = recoveredToken, TenantId = existingCls.TenantId, ClassId = existingCls.Id, ClassDisplayName = existingCls.DisplayName }; } } // Different installationId or unable to match installationId -> 409 Conflict return new DeviceActivationResultDto { Success = false, ErrorMessage = "该激活码已被其他设备安装实例使用" }; } if (code.ExpiresAt < DateTimeOffset.UtcNow) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码已过期" }; } var cls = await db.Classrooms.FirstOrDefaultAsync(c => c.TenantId == code.TenantId && c.Id == code.ClassroomId); if (cls == null) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "绑定的班级不存在" }; } var deviceId = $"dev_{Guid.NewGuid():N}"[..12]; var rawToken = $"dtoken_{Guid.NewGuid():N}"; var tokenHash = HashToken(rawToken); var device = new Device { Id = deviceId, TenantId = code.TenantId, ClassroomId = code.ClassroomId, DeviceTokenHash = tokenHash, InstallationId = normalizedInstId, Hostname = dto.Hostname, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; var credRecord = new DeviceCredentialRecord { DeviceId = deviceId, InstallationId = normalizedInstId, DeviceTokenHash = tokenHash, EncryptedRecoverableToken = _protector.Protect(rawToken), CreatedAt = DateTimeOffset.UtcNow }; db.Devices.Add(device); db.DeviceCredentials.Add(credRecord); code.IsUsed = true; code.UsedAt = DateTimeOffset.UtcNow; code.UsedByDeviceId = deviceId; code.InstallationId = normalizedInstId; await db.SaveChangesAsync(); await tx.CommitAsync(); _logger.LogInformation("Device {DeviceId} activated successfully for {TenantId} / {ClassId} ({DisplayName}) [InstallationId: {InstallationId}]", deviceId, cls.TenantId, cls.Id, cls.DisplayName, normalizedInstId); return new DeviceActivationResultDto { Success = true, DeviceId = deviceId, DeviceToken = rawToken, TenantId = cls.TenantId, ClassId = cls.Id, ClassDisplayName = cls.DisplayName }; } catch (Exception ex) { await tx.RollbackAsync(); _logger.LogError(ex, "Exception during device activation transaction for code {Code}", normalizedCode); throw; } } public async Task ValidateDeviceAsync(string deviceId, string deviceToken) { if (string.IsNullOrEmpty(deviceId) || string.IsNullOrEmpty(deviceToken)) { return null; } var tokenHash = HashToken(deviceToken); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var device = await db.Devices.AsNoTracking().FirstOrDefaultAsync(d => d.Id == deviceId && d.DeviceTokenHash == tokenHash && d.IsActive); if (device == null) return null; // P0-02 Security Gate: Verify tenant is active var tenant = await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == device.TenantId); if (tenant != null && !tenant.IsActive) { _logger.LogWarning("Rejecting device {DeviceId} connection: Tenant {TenantId} is suspended/inactive.", deviceId, device.TenantId); return null; } return device; } #endregion #region Tenants & Classrooms public async Task GetTenantAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId && t.IsActive); } public async Task> GetTenantsOverviewAsync() { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var tenants = await db.Tenants.AsNoTracking().Where(t => t.Id != "global").ToListAsync(); var classrooms = await db.Classrooms.AsNoTracking().ToListAsync(); var devices = await db.Devices.AsNoTracking().ToListAsync(); var liveSnapshots = _liveConnections.Values.ToList(); return tenants.Select(t => { var classCount = classrooms.Count(c => c.TenantId == t.Id); var deviceCount = devices.Count(d => d.TenantId == t.Id); var onlineCount = liveSnapshots.Count(c => c.TenantId == t.Id); return new TenantAdminDto { Id = t.Id, Name = t.Name, ClassroomCount = classCount, DeviceCount = deviceCount, OnlineCount = onlineCount, IsActive = t.IsActive, CreatedAt = t.CreatedAt }; }).ToList(); } public async Task GetClassroomAsync(string tenantId, string classId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Classrooms.AsNoTracking().FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == classId); } public async Task> GetClassroomsAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Classrooms.AsNoTracking().Where(c => c.TenantId == tenantId).ToListAsync(); } public async Task CreateClassroomAsync(string tenantId, CreateClassroomDto dto) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); if (await db.Classrooms.AnyAsync(c => c.TenantId == tenantId && c.Id == dto.Id)) { return false; } db.Classrooms.Add(new Classroom { Id = dto.Id, TenantId = tenantId, DisplayName = dto.DisplayName, Grade = dto.Grade, RoomNumber = dto.RoomNumber, CreatedAt = DateTimeOffset.UtcNow }); await db.SaveChangesAsync(); return true; } #endregion #region Users public async Task> GetUsersAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Users.AsNoTracking().Where(u => u.TenantId == tenantId).ToListAsync(); } public async Task CreateUserAsync(string tenantId, CreateTeacherDto dto) { if (string.IsNullOrWhiteSpace(dto.Password) || dto.Password.Length < 8) { _logger.LogWarning("CreateUser rejected: Password must be at least 8 characters long."); return false; } // P0 Verification Gate: Strictly enforce role whitelist to prevent SuperAdmin privilege escalation if (dto.Role != "Teacher" && dto.Role != "SchoolAdmin") { _logger.LogWarning("CreateUser rejected: Role '{Role}' is not allowed via standard user creation API.", dto.Role); return false; } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); // P0-02 Security Gate: Verify school tenant is active var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { _logger.LogWarning("CreateUser rejected: School tenant '{TenantId}' does not exist or is suspended.", tenantId); return false; } if (await db.Users.AnyAsync(u => u.Username == dto.Username.Trim())) { return false; } var user = new User { Id = $"usr_{Guid.NewGuid():N}"[..12], TenantId = tenantId, Username = dto.Username.Trim(), FullName = dto.FullName, Role = dto.Role, CreatedAt = DateTimeOffset.UtcNow }; // Strictly use modern PasswordHasher for new user creation user.PasswordHash = _passwordHasher.HashPassword(user, dto.Password); db.Users.Add(user); await db.SaveChangesAsync(); return true; } #endregion #region Devices & Live SignalR Connections public async Task GetAdminMetricsAsync() { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var totalTenants = await db.Tenants.CountAsync(t => t.Id != "global"); var totalClassrooms = await db.Classrooms.CountAsync(); var totalDevices = await db.Devices.CountAsync(); var onlineDevices = _liveConnections.Count; var startOfToday = DateTimeOffset.UtcNow.Date; var todayNotifications = await db.Notifications.CountAsync(n => n.CreatedAt >= startOfToday); return new AdminMetricsDto { TotalTenants = totalTenants, TotalClassrooms = totalClassrooms, TotalDevices = totalDevices, OnlineDevices = onlineDevices, TodayNotifications = todayNotifications, AbnormalDevices = 0 }; } public async Task> GetAllDevicesAsync() { return await BuildDeviceAdminDtosAsync(null); } public async Task> GetTenantDevicesAsync(string tenantId) { return await BuildDeviceAdminDtosAsync(tenantId); } private async Task> BuildDeviceAdminDtosAsync(string? tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Devices.AsNoTracking(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(d => d.TenantId == tenantId); } var devices = await query.ToListAsync(); var tenants = await db.Tenants.AsNoTracking().ToDictionaryAsync(t => t.Id, t => t.Name); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); var liveSnapshot = _liveConnections.ToDictionary(k => k.Key, v => v.Value); return devices.Select(d => { var isOnline = _deviceToConnection.TryGetValue(d.Id, out var connId) && liveSnapshot.ContainsKey(connId); liveSnapshot.TryGetValue(connId ?? string.Empty, out var connInfo); tenants.TryGetValue(d.TenantId, out var tName); classrooms.TryGetValue($"{d.TenantId}_{d.ClassroomId}", out var cName); return new DeviceAdminDto { DeviceId = d.Id, TenantId = d.TenantId, TenantName = tName ?? d.TenantId, ClassroomId = d.ClassroomId, ClassroomName = cName ?? d.ClassroomId, Hostname = d.Hostname, IsOnline = isOnline, LastHeartbeat = isOnline ? connInfo?.LastHeartbeat : d.LastHeartbeatAt, ClientVersion = isOnline ? connInfo?.ClientVersion : null, RemoteIp = isOnline ? connInfo?.RemoteIp : null, ServiceRunning = isOnline, ClientRunning = isOnline }; }).ToList(); } public Task RegisterDeviceConnectionAsync( string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion) { string? replacedConnectionId = null; if (_deviceToConnection.TryGetValue(deviceId, out var existingConnId)) { replacedConnectionId = existingConnId; _liveConnections.TryRemove(existingConnId, out _); _connectionTenantMap.TryRemove(existingConnId, out _); _logger.LogInformation("Replacing previous ConnectionId {OldConnId} with {NewConnId} for Device {DeviceId}", existingConnId, connectionId, deviceId); } _deviceToConnection[deviceId] = connectionId; var liveInfo = new LiveConnectionInfo(connectionId, deviceId, tenantId, classroomId, hostname, remoteIp, clientVersion, DateTimeOffset.UtcNow); _liveConnections[connectionId] = liveInfo; _connectionTenantMap[connectionId] = (tenantId, classroomId, deviceId); _logger.LogInformation("Device {DeviceId} connected via SignalR. ConnectionId={ConnId}, IP={RemoteIp}", deviceId, connectionId, remoteIp); return Task.FromResult(new DeviceConnectionRegistrationResult(connectionId, replacedConnectionId)); } public Task UnregisterDeviceConnectionAsync(string connectionId) { if (_connectionTenantMap.TryRemove(connectionId, out var info)) { _liveConnections.TryRemove(connectionId, out _); if (_deviceToConnection.TryGetValue(info.DeviceId, out var currentConnId) && currentConnId == connectionId) { _deviceToConnection.TryRemove(info.DeviceId, out _); _logger.LogInformation("Unregistered active device connection {ConnId} for Device {DeviceId}", connectionId, info.DeviceId); return Task.FromResult(true); } else { _logger.LogWarning("Ignored stale disconnect for {ConnId} (Device {DeviceId} active connection is {CurrentConnId})", connectionId, info.DeviceId, currentConnId); return Task.FromResult(false); } } return Task.FromResult(false); } public bool IsCurrentDeviceConnection(string deviceId, string connectionId) { return _deviceToConnection.TryGetValue(deviceId, out var currentConnId) && currentConnId == connectionId; } public Task UpdateDeviceHeartbeatAsync(string connectionId) { if (_liveConnections.TryGetValue(connectionId, out var info)) { info.LastHeartbeat = DateTimeOffset.UtcNow; // Throttled DB heartbeat update (every 30s) var now = DateTimeOffset.UtcNow; var lastUpdate = _lastHeartbeatDbUpdate.GetOrAdd(info.DeviceId, DateTimeOffset.MinValue); if (now - lastUpdate >= TimeSpan.FromSeconds(30)) { _lastHeartbeatDbUpdate[info.DeviceId] = now; _ = Task.Run(async () => { try { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var dev = await db.Devices.FindAsync(info.DeviceId); if (dev != null) { dev.LastHeartbeatAt = now; await db.SaveChangesAsync(); } } catch { } }); } } return Task.CompletedTask; } public string? GetDeviceConnectionId(string deviceId) { return _deviceToConnection.TryGetValue(deviceId, out var connId) ? connId : null; } #endregion #region Activation Codes public async Task GenerateActivationCodeAsync(string tenantId, string classId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var tenant = await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { throw new InvalidOperationException($"租户不存在或已被禁用: {tenantId}"); } var classroomExists = await db.Classrooms.AnyAsync(c => c.TenantId == tenantId && c.Id == classId); if (!classroomExists) { db.Classrooms.Add(new Classroom { Id = classId, TenantId = tenantId, DisplayName = classId, CreatedAt = DateTimeOffset.UtcNow }); await db.SaveChangesAsync(); } var code = $"{tenantId[..Math.Min(4, tenantId.Length)].ToUpperInvariant()}-{Guid.NewGuid():N}"[..12].ToUpperInvariant(); db.ActivationCodes.Add(new ActivationCode { Code = code, TenantId = tenantId, ClassroomId = classId, ExpiresAt = DateTimeOffset.UtcNow.AddDays(7), IsUsed = false }); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "GENERATE_ACTIVATION_CODE", TargetType = "ActivationCode", TargetId = code, Details = $"为学校 {tenantId} 班级 {classId} 生成激活码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return code; } catch { await tx.RollbackAsync(); throw; } } public async Task> GetActivationCodesAsync(string? tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.ActivationCodes.AsNoTracking(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(c => c.TenantId == tenantId); } var codes = await query.OrderByDescending(c => c.ExpiresAt).ToListAsync(); var tenants = await db.Tenants.AsNoTracking().ToDictionaryAsync(t => t.Id, t => t.Name); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); return codes.Select(c => { tenants.TryGetValue(c.TenantId, out var tName); classrooms.TryGetValue($"{c.TenantId}_{c.ClassroomId}", out var cName); return new ActivationCodeDto { Code = c.Code, TenantId = c.TenantId, TenantName = tName ?? c.TenantId, ClassroomId = c.ClassroomId, ClassroomName = cName ?? c.ClassroomId, ExpiresAt = c.ExpiresAt, IsUsed = c.IsUsed, UsedAt = c.UsedAt, UsedByDeviceId = c.UsedByDeviceId }; }).ToList(); } #endregion #region Notifications & NotificationReceipts (PostgreSQL) public async Task RecordNotificationAsync(NotificationDto notification, string? senderUserId, string senderName) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notifEntity = new Notification { Id = notification.Id, TenantId = notification.TenantId, ClassroomId = notification.ClassId, BroadcastId = notification.BroadcastId, SenderUserId = senderUserId, SenderName = senderName, Message = notification.Message, Title = notification.Title, Priority = notification.Type.ToString(), CreatedAt = notification.CreatedAt, ExpiresAt = notification.ExpiresAt, Voice = notification.Voice, Shake = notification.Shake, DurationSeconds = notification.DurationSeconds }; db.Notifications.Add(notifEntity); // Find active devices for this classroom and create initial Receipt with Status = "Sent" var targetDevices = await db.Devices.AsNoTracking() .Where(d => d.TenantId == notification.TenantId && d.ClassroomId == notification.ClassId && d.IsActive) .ToListAsync(); foreach (var dev in targetDevices) { db.NotificationReceipts.Add(new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = notification.Id, DeviceId = dev.Id, Status = "Sent", UpdatedAt = DateTimeOffset.UtcNow }); } await db.SaveChangesAsync(); } public async Task RecordAckAsync(string messageId, string authenticatedDeviceId, AckReceiptDto ack) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var receipt = await db.NotificationReceipts .FirstOrDefaultAsync(r => r.NotificationId == messageId && r.DeviceId == authenticatedDeviceId); if (receipt == null) { // If receipt didn't exist (e.g. device activated after notification or direct delivery), create it receipt = new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = messageId, DeviceId = authenticatedDeviceId, Status = "Sent", UpdatedAt = DateTimeOffset.UtcNow }; db.NotificationReceipts.Add(receipt); } // State Machine Protection: // Rank: Sent (0) -> DeviceReceived (1) -> Displayed (2) -> Acknowledged (3) // Terminal states: Timeout, Failed, Cancelled. // Rule: Never resurrect a Cancelled receipt, and never regress from Acknowledged to any lower rank or failure. if (receipt.Status == "Cancelled" || receipt.Status == "Acknowledged") { _logger.LogInformation("Receipt {ReceiptId} (Dev {DevId}) is terminal {Status}. Ignoring subsequent {NewStatus}.", receipt.Id, authenticatedDeviceId, receipt.Status, ack.Status); return; } switch (ack.Status) { case AckStatus.Delivered: // Client WPF displayed window on screen receipt.DeviceReceivedAt ??= ack.Timestamp; receipt.DisplayedAt ??= ack.Timestamp; if (receipt.Status != "Displayed" && receipt.Status != "Acknowledged") { receipt.Status = "Displayed"; } break; case AckStatus.Acknowledged: receipt.DeviceReceivedAt ??= ack.Timestamp; receipt.DisplayedAt ??= ack.Timestamp; receipt.AcknowledgedAt = ack.Timestamp; receipt.Status = "Acknowledged"; break; case AckStatus.Timeout: if (receipt.Status != "Acknowledged") { receipt.Status = "Timeout"; } break; case AckStatus.Failed: if (receipt.Status != "Acknowledged") { receipt.Status = "Failed"; receipt.FailedAt = ack.Timestamp; receipt.FailureReason = ack.Remark; } break; case AckStatus.Sent: default: break; } receipt.UpdatedAt = DateTimeOffset.UtcNow; await db.SaveChangesAsync(); } public async Task ValidateNotificationTargetAsync(string messageId, string tenantId, string classroomId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Notifications.AsNoTracking() .AnyAsync(n => n.Id == messageId && n.TenantId == tenantId && n.ClassroomId == classroomId); } public async Task> GetNotificationsAsync(string? tenantId, string? classId, int limit = 50) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Notifications.AsNoTracking().Include(n => n.Receipts).AsQueryable(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(n => n.TenantId == tenantId); } if (!string.IsNullOrEmpty(classId)) { query = query.Where(n => n.ClassroomId == classId); } var notifications = await query.OrderByDescending(n => n.CreatedAt).Take(limit).ToListAsync(); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); return notifications.Select(n => { classrooms.TryGetValue($"{n.TenantId}_{n.ClassroomId}", out var cName); // Compute aggregate status across all device receipts string status = "Sent"; DateTimeOffset? confirmedAt = null; if (n.IsCancelled) { status = "Cancelled"; } else if (n.Receipts.Any(r => r.Status == "Acknowledged")) { status = "Acknowledged"; confirmedAt = n.Receipts.FirstOrDefault(r => r.Status == "Acknowledged")?.AcknowledgedAt; } else if (n.Receipts.Any(r => r.Status == "Displayed" || r.Status == "DeviceReceived")) { status = "Delivered"; } else if (n.Receipts.Any(r => r.Status == "Failed")) { status = "Failed"; } else if (n.Receipts.Any(r => r.Status == "Timeout")) { status = "Timeout"; } else if ((n.Receipts.Any() && n.Receipts.All(r => r.Status == "Expired")) || (n.ExpiresAt.HasValue && n.ExpiresAt.Value <= DateTimeOffset.UtcNow)) { status = "Expired"; } return new NotificationRecordDto { Id = n.Id, TenantId = n.TenantId, ClassId = n.ClassroomId, ClassName = cName ?? n.ClassroomId, SenderName = n.SenderName, Message = n.Message, Priority = n.Priority, CreatedAt = n.CreatedAt, Status = status, IsCancelled = n.IsCancelled, CancelledAt = n.CancelledAt, CancelledBy = n.CancelledBy, ConfirmedAt = confirmedAt, ExpiresAt = n.ExpiresAt, Receipts = n.Receipts.Select(r => new NotificationReceiptViewDto { DeviceId = r.DeviceId, Status = r.Status, DisplayedAt = r.DisplayedAt, VisualReceiptState = r.VisualReceiptState, VisualReceiptCapturedAt = r.VisualReceiptCapturedAt, VisualReceiptExpiresAt = r.VisualReceiptExpiresAt }).ToList() }; }).ToList(); } public async Task> GetPendingNotificationsForDeviceAsync(string deviceId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; // Query pending receipts for this authenticated device (excluding cancelled notifications) var pendingReceipts = await db.NotificationReceipts .Include(r => r.Notification) .Where(r => r.DeviceId == deviceId && r.Status == "Sent" && r.Notification != null && !r.Notification.IsCancelled) .ToListAsync(); var validDtos = new List(); bool hasStateChanges = false; foreach (var receipt in pendingReceipts) { if (receipt.Notification == null) continue; if (receipt.Notification.IsCancelled) { receipt.Status = "Cancelled"; receipt.UpdatedAt = now; hasStateChanges = true; continue; } // Check if notification has expired (or is legacy Batch 8 record where ExpiresAt is NULL) if (!receipt.Notification.ExpiresAt.HasValue || receipt.Notification.ExpiresAt.Value <= now) { receipt.Status = "Expired"; receipt.UpdatedAt = now; hasStateChanges = true; _logger.LogInformation("Receipt {ReceiptId} for Device {DeviceId} (Msg {MsgId}) marked Expired (ExpiresAt: {ExpiresAt}).", receipt.Id, deviceId, receipt.NotificationId, receipt.Notification.ExpiresAt); } else { var n = receipt.Notification; validDtos.Add(new NotificationDto { Id = n.Id, TenantId = n.TenantId, ClassId = n.ClassroomId, Title = n.Title, Message = n.Message, Type = Enum.TryParse(n.Priority, out var p) ? p : ClassNotify.Shared.Enums.NotificationType.Call, Voice = n.Voice, Shake = n.Shake, DurationSeconds = n.DurationSeconds, CreatedAt = n.CreatedAt, ExpiresAt = n.ExpiresAt }); } } if (hasStateChanges) { await db.SaveChangesAsync(); } return validDtos.OrderBy(d => d.CreatedAt).ToList(); } public async Task CancelNotificationAsync( string notificationId, string actorUserId, string actorUsername, string role, string tenantId, string? ip, CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var snapshot = await db.Notifications .AsNoTracking() .Where(n => n.Id == notificationId) .Select(n => new { n.Id, n.TenantId, n.ClassroomId, n.SenderUserId, n.SenderName, n.Message, n.IsCancelled, n.CancelledAt, n.CancelledBy }) .SingleOrDefaultAsync(ct); if (snapshot == null) throw new KeyNotFoundException("通知记录不存在。"); // ---------- Authorization (Enforced at Service Layer) ---------- switch (role) { case "SuperAdmin": break; case "SchoolAdmin": if (snapshot.TenantId != tenantId) throw new UnauthorizedAccessException("无权撤回其他学校的通知。"); break; case "Teacher": if (snapshot.TenantId != tenantId) throw new UnauthorizedAccessException("无权撤回其他学校的通知。"); // Check ownership: Strict SenderUserId matching (never rely on mutable display name) if (!string.IsNullOrEmpty(snapshot.SenderUserId) && snapshot.SenderUserId != actorUserId) throw new UnauthorizedAccessException("教师只能撤回自己发送的通知。"); break; default: throw new UnauthorizedAccessException("当前角色无通知撤回权限。"); } if (snapshot.IsCancelled) { return new CancelNotificationResult( snapshot.Id, snapshot.TenantId, snapshot.ClassroomId, true, snapshot.CancelledAt, snapshot.CancelledBy); } var now = DateTimeOffset.UtcNow; await using var tx = await db.Database.BeginTransactionAsync(ct); try { // 原子 first-writer-wins var affected = await db.Notifications .Where(n => n.Id == notificationId && !n.IsCancelled) .ExecuteUpdateAsync(setters => setters .SetProperty(n => n.IsCancelled, true) .SetProperty(n => n.CancelledAt, now) .SetProperty(n => n.CancelledBy, actorUsername), ct); if (affected == 0) { var current = await db.Notifications.AsNoTracking() .SingleAsync(n => n.Id == notificationId, ct); await tx.RollbackAsync(ct); return new CancelNotificationResult( current.Id, current.TenantId, current.ClassroomId, true, current.CancelledAt, current.CancelledBy); } // 只终止尚未 Displayed / Acknowledged 的 Receipt await db.NotificationReceipts .Where(r => r.NotificationId == notificationId && (r.Status == "Sent" || r.Status == "DeviceReceived")) .ExecuteUpdateAsync(setters => setters .SetProperty(r => r.Status, "Cancelled") .SetProperty(r => r.UpdatedAt, now), ct); db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = now, ActorUsername = actorUsername, ActorRole = role, Action = "NOTIFICATION_CANCELLED", TargetType = "Notification", TargetId = notificationId, Details = $"提前关闭通知,Tenant={snapshot.TenantId}, Classroom={snapshot.ClassroomId}: {snapshot.Message}", IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return new CancelNotificationResult( notificationId, snapshot.TenantId, snapshot.ClassroomId, false, now, actorUsername); } catch { await tx.RollbackAsync(ct); throw; } } #endregion #region Device Commands (P1 Batch 10) public async Task CreateDeviceCommandAsync(string? callerTenantId, string deviceId, string commandType, string? parameters, string createdBy, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(deviceId)) { throw new ArgumentException("DeviceId cannot be empty", nameof(deviceId)); } // Whitelist check if (!DeviceCommandTypes.IsSupported(commandType)) { throw new ArgumentException($"Unsupported command type '{commandType}'. Whitelist: {string.Join(", ", DeviceCommandTypes.AllSupported)}"); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) { throw new InvalidOperationException($"Target device '{deviceId}' not found"); } // Multi-tenant isolation: non-superadmin caller must match device tenant if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(callerTenantId, device.TenantId, StringComparison.OrdinalIgnoreCase)) { throw new UnauthorizedAccessException($"Device '{deviceId}' does not belong to tenant '{callerTenantId}'"); } // P0-02 Security Gate: Verify tenant is active var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == device.TenantId); if (tenant != null && !tenant.IsActive) { throw new InvalidOperationException($"设备所属学校 [{tenant.Name}] 已停用冻结,无法下发远程运维指令"); } var ttl = DeviceCommandTypes.GetDefaultTtl(commandType); var now = DateTimeOffset.UtcNow; var commandId = $"cmd_{Guid.NewGuid():N}"; var entity = new DeviceCommand { Id = commandId, TenantId = device.TenantId, DeviceId = device.Id, CommandType = commandType, Parameters = parameters, CreatedBy = createdBy, CreatedAt = now, ExpiresAt = now.Add(ttl), Status = DeviceCommandStatuses.Pending }; db.DeviceCommands.Add(entity); // Pre-Audit in the EXACT SAME database transaction: // Ensures DeviceCommand cannot persist without immutable REMOTE_COMMAND_REQUESTED audit db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = now, ActorUsername = createdBy, ActorRole = actorRole ?? "SuperAdmin", Action = "REMOTE_COMMAND_REQUESTED", TargetType = "Device", TargetId = device.Id, Details = $"创建远程控制指令: {commandType} (CommandId: {commandId}, 参数: {parameters ?? "none"})", IpAddress = ip }); await db.SaveChangesAsync(); await tx.CommitAsync(); _logger.LogInformation("Created remote command {CommandId} ({CommandType}) with atomic Pre-Audit for Device {DeviceId} (Tenant {TenantId}) by {CreatedBy}", commandId, commandType, device.Id, device.TenantId, createdBy); return new DeviceCommandDto { CommandId = entity.Id, TenantId = entity.TenantId, DeviceId = entity.DeviceId, CommandType = entity.CommandType, Parameters = entity.Parameters, CreatedBy = entity.CreatedBy, CreatedAt = entity.CreatedAt, ExpiresAt = entity.ExpiresAt, Status = entity.Status }; } catch { await tx.RollbackAsync(); throw; } } public async Task MarkCommandDispatchedAsync(string commandId) { if (string.IsNullOrWhiteSpace(commandId)) return false; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == commandId); if (cmd == null) return false; if (cmd.Status == DeviceCommandStatuses.Pending) { cmd.Status = DeviceCommandStatuses.Dispatched; await db.SaveChangesAsync(); return true; } return false; } public async Task RecordCommandResultAsync(DeviceCommandResultDto result, string callerDeviceId, string? callerTenantId) { if (result == null || string.IsNullOrWhiteSpace(result.CommandId)) { _logger.LogWarning("RecordCommandResultAsync called with empty CommandId"); return null; } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == result.CommandId); if (cmd == null) { _logger.LogWarning("Remote command {CommandId} not found when recording execution result", result.CommandId); return null; } // Security assertion: device and tenant isolation if (!string.Equals(cmd.DeviceId, callerDeviceId, StringComparison.OrdinalIgnoreCase)) { _logger.LogWarning("Rejecting command result: DeviceId mismatch. Target: {TargetDevice}, Caller: {CallerDevice} (Command {CommandId})", cmd.DeviceId, callerDeviceId, result.CommandId); return null; } if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(cmd.TenantId, callerTenantId, StringComparison.OrdinalIgnoreCase)) { _logger.LogWarning("Rejecting command result: TenantId mismatch. Target: {TargetTenant}, Caller: {CallerTenant} (Command {CommandId})", cmd.TenantId, callerTenantId, result.CommandId); return null; } // Idempotency: if already reached terminal state, do not overwrite final outcome if (DeviceCommandStatuses.IsTerminal(cmd.Status)) { _logger.LogInformation("Command {CommandId} already completed with terminal status '{Status}'. Ignoring duplicate result report.", cmd.Id, cmd.Status); return new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? 0, ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? 0, Timestamp = cmd.CompletedAt ?? DateTimeOffset.UtcNow }; } var now = DateTimeOffset.UtcNow; cmd.Status = result.Status; cmd.ResultCode = result.ResultCode; cmd.DurationMs = result.ExecutionDurationMs; cmd.ResultMessage = result.ResultMessage != null && result.ResultMessage.Length > 1000 ? result.ResultMessage[..1000] : result.ResultMessage; cmd.StartedAt ??= result.Timestamp; cmd.CompletedAt = now; await db.SaveChangesAsync(); _logger.LogInformation("Recorded execution result for Command {CommandId} (Device {DeviceId}): Status={Status}, ResultCode={ResultCode}, Duration={Duration}ms", cmd.Id, cmd.DeviceId, cmd.Status, cmd.ResultCode, cmd.DurationMs); return new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? 0, ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? result.ExecutionDurationMs, Timestamp = cmd.CompletedAt ?? now }; } public async Task GetDeviceCommandAsync(string commandId, string? callerTenantId = null) { if (string.IsNullOrWhiteSpace(commandId)) return null; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == commandId); if (cmd == null) return null; if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(cmd.TenantId, callerTenantId, StringComparison.OrdinalIgnoreCase)) { return null; } // Active TTL evaluation: if Pending/Dispatched and past ExpiresAt, transition via Normalizer if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, DateTimeOffset.UtcNow)) { await db.SaveChangesAsync(); } return new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }; } public async Task> GetPendingCommandsForDeviceAsync(string deviceId) { if (string.IsNullOrWhiteSpace(deviceId)) return new List(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var list = await db.DeviceCommands .Where(c => c.DeviceId == deviceId && (c.Status == DeviceCommandStatuses.Pending || c.Status == DeviceCommandStatuses.Dispatched)) .OrderBy(c => c.CreatedAt) .ToListAsync(); var now = DateTimeOffset.UtcNow; var valid = new List(); bool hasExpiredUpdates = false; foreach (var cmd in list) { if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { hasExpiredUpdates = true; _logger.LogInformation("Command {CommandId} for Device {DeviceId} marked {Status} (ExpiresAt: {ExpiresAt}).", cmd.Id, deviceId, cmd.Status, cmd.ExpiresAt); } else { valid.Add(new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }); } } if (hasExpiredUpdates) { await db.SaveChangesAsync(); } return valid; } public async Task> GetDeviceCommandHistoryAsync(string? tenantId, string? deviceId, string? status, int limit = 50) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.DeviceCommands.AsQueryable(); if (!string.IsNullOrEmpty(tenantId)) { query = query.Where(c => c.TenantId == tenantId); } if (!string.IsNullOrEmpty(deviceId)) { query = query.Where(c => c.DeviceId == deviceId); } if (!string.IsNullOrEmpty(status)) { query = query.Where(c => c.Status == status); } var commands = await query .OrderByDescending(c => c.CreatedAt) .Take(Math.Min(limit, 200)) .ToListAsync(); var now = DateTimeOffset.UtcNow; bool hasExpiredUpdates = false; var result = new List(); foreach (var cmd in commands) { if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { hasExpiredUpdates = true; } result.Add(new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }); } if (hasExpiredUpdates) { await db.SaveChangesAsync(); } return result; } #endregion #region Helpers public string GenerateJwtToken(User user) { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.UTF8.GetBytes(_jwtOptions.SigningKey); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, user.Id), new Claim(ClaimTypes.Name, user.FullName), new Claim(ClaimTypes.Role, user.Role), new Claim("tenant_id", user.TenantId), new Claim("token_version", user.TokenVersion.ToString()) }), Issuer = _jwtOptions.Issuer, Audience = _jwtOptions.Audience, Expires = DateTime.UtcNow.AddDays(_jwtOptions.LifetimeDays > 0 ? _jwtOptions.LifetimeDays : 14), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); return tokenHandler.WriteToken(token); } /// /// Legacy SHA256 password verifier for migration of existing accounts. /// STRICTLY PROHIBITED FOR GENERATING NEW PASSWORDS. /// public static bool VerifyLegacyPassword(string plaintextPassword, string legacyHash) { if (string.IsNullOrEmpty(plaintextPassword) || string.IsNullOrEmpty(legacyHash)) { return false; } using var sha = SHA256.Create(); var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(plaintextPassword + "_classnotify_salt")); var computed = Convert.ToBase64String(bytes); return CryptographicOperations.FixedTimeEquals( Encoding.UTF8.GetBytes(computed), Encoding.UTF8.GetBytes(legacyHash)); } private static string HashToken(string token) { using var sha = SHA256.Create(); var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(token)); return Convert.ToBase64String(bytes); } #region SuperAdmin Control Plane Implementations public async Task CreateTenantAsync(string id, string name, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(name)) throw new ArgumentException("学校ID与名称不可为空"); var cleanId = id.Trim().ToLowerInvariant(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { if (await db.Tenants.AnyAsync(t => t.Id == cleanId)) throw new InvalidOperationException($"租户ID '{cleanId}' 已存在"); var tenant = new Tenant { Id = cleanId, Name = name.Trim(), IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; db.Tenants.Add(tenant); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "CREATE_TENANT", TargetType = "Tenant", TargetId = tenant.Id, Details = $"创建学校: {tenant.Name} ({tenant.Id})", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return new TenantAdminDto { Id = tenant.Id, Name = tenant.Name, ClassroomCount = 0, DeviceCount = 0, OnlineCount = 0, IsActive = tenant.IsActive, CreatedAt = tenant.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task UpdateTenantAsync(string id, string name, bool isActive, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == id); if (tenant == null) return null; if (!string.IsNullOrWhiteSpace(name)) tenant.Name = name.Trim(); tenant.IsActive = isActive; if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "UPDATE_TENANT", TargetType = "Tenant", TargetId = tenant.Id, Details = $"更新学校: {tenant.Name}, 启用状态: {tenant.IsActive}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); var classroomCount = await db.Classrooms.CountAsync(c => c.TenantId == id); var deviceCount = await db.Devices.CountAsync(d => d.TenantId == id); var onlineCount = _liveConnections.Values.Count(c => c.TenantId == id); return new TenantAdminDto { Id = tenant.Id, Name = tenant.Name, ClassroomCount = classroomCount, DeviceCount = deviceCount, OnlineCount = onlineCount, IsActive = tenant.IsActive, CreatedAt = tenant.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task> GetAllUsersAdminAsync(string? tenantId, string? role) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Users.Include(u => u.Tenant).AsQueryable(); if (!string.IsNullOrWhiteSpace(tenantId)) query = query.Where(u => u.TenantId == tenantId); if (!string.IsNullOrWhiteSpace(role)) query = query.Where(u => u.Role == role); var list = await query.OrderByDescending(u => u.CreatedAt).ToListAsync(); return list.Select(u => new UserAdminDto { Id = u.Id, TenantId = u.TenantId, TenantName = u.Tenant?.Name ?? u.TenantId, Username = u.Username, FullName = u.FullName, Role = u.Role, IsLocked = u.IsLocked, CreatedAt = u.CreatedAt, LastLoginAt = u.LastLoginAt }).ToList(); } public async Task CreateUserAdminAsync(CreateUserAdminRequest req, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(req.TenantId) || string.IsNullOrWhiteSpace(req.Username) || string.IsNullOrWhiteSpace(req.Password) || string.IsNullOrWhiteSpace(req.FullName)) throw new ArgumentException("所有必填字段均不可为空"); // P1 Gate: Minimum password length 8 characters if (req.Password.Trim().Length < 8) throw new ArgumentException("密码长度不能少于 8 位"); var targetRole = req.Role?.Trim(); if (targetRole != "SchoolAdmin" && targetRole != "Teacher") throw new ArgumentException("角色必须为 'SchoolAdmin' 或 'Teacher'"); var cleanUser = req.Username.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { if (await db.Users.AnyAsync(u => u.Username == cleanUser)) throw new InvalidOperationException($"用户名 '{cleanUser}' 已被占用"); var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == req.TenantId); if (tenant == null) throw new InvalidOperationException($"租户 '{req.TenantId}' 不存在"); // P0-02 Security Gate: Verify tenant is active if (!tenant.IsActive) throw new InvalidOperationException($"学校租户 '{tenant.Name}' 处于停用冻结状态,无法开通新账号"); var user = new User { Id = $"usr_{Guid.NewGuid():N}".Substring(0, 12), TenantId = req.TenantId, Username = cleanUser, FullName = req.FullName.Trim(), Role = targetRole, IsLocked = false, TokenVersion = 1, CreatedAt = DateTimeOffset.UtcNow }; user.PasswordHash = _passwordHasher.HashPassword(user, req.Password); db.Users.Add(user); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "CREATE_USER", TargetType = "User", TargetId = user.Username, Details = $"创建用户: {user.FullName} ({user.Role}),学校: {tenant.Name}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return new UserAdminDto { Id = user.Id, TenantId = user.TenantId, TenantName = tenant.Name, Username = user.Username, FullName = user.FullName, Role = user.Role, IsLocked = user.IsLocked, CreatedAt = user.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task ResetPasswordAsync(string userId, string newPassword, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(newPassword) || newPassword.Trim().Length < 8) throw new ArgumentException("新密码长度不能少于 8 位"); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; user.PasswordHash = _passwordHasher.HashPassword(user, newPassword); user.TokenVersion++; // Permanent invalidation of existing JWTs if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "RESET_PASSWORD", TargetType = "User", TargetId = userId, Details = "管理员重置用户登录密码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task SetUserLockAsync(string userId, bool isLocked, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; user.IsLocked = isLocked; user.TokenVersion++; // Invalidate existing tokens if (!string.IsNullOrEmpty(actor)) { var action = isLocked ? "LOCK_USER" : "UNLOCK_USER"; var detail = isLocked ? "锁定账号 (禁止登录)" : "解锁账号 (恢复登录)"; db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = action, TargetType = "User", TargetId = userId, Details = detail, IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task ResetSchoolTeacherPasswordAsync(string schoolAdminTenantId, string teacherUserId, string newPassword, string actorUsername, string? ip, CancellationToken ct = default) { if (string.IsNullOrWhiteSpace(newPassword) || newPassword.Trim().Length < 8) throw new ArgumentException("新密码长度不得少于 8 位"); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var targetUser = await db.Users .FirstOrDefaultAsync(u => u.Id == teacherUserId, ct); if (targetUser == null) throw new KeyNotFoundException("账号不存在。"); if (targetUser.Role == "SuperAdmin") throw new UnauthorizedAccessException("无权修改超级管理员密码。"); if (targetUser.TenantId != schoolAdminTenantId) throw new UnauthorizedAccessException("无权修改其他学校账号密码。"); if (targetUser.Role != "Teacher") throw new UnauthorizedAccessException("学校管理员无权修改非教师角色账号密码。"); await using var tx = await db.Database.BeginTransactionAsync(ct); try { targetUser.PasswordHash = _passwordHasher.HashPassword(targetUser, newPassword); targetUser.TokenVersion += 1; // 吊销旧 Token db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = "SchoolAdmin", Action = "SCHOOLADMIN_RESET_TEACHER_PASSWORD", TargetType = "User", TargetId = teacherUserId, Details = $"重置教师密码: {targetUser.Username}", IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return true; } catch { await tx.RollbackAsync(ct); throw; } } public async Task SetSchoolTeacherLockAsync(string schoolAdminTenantId, string teacherUserId, bool isLocked, string actorUsername, string? ip, CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var targetUser = await db.Users .FirstOrDefaultAsync(u => u.Id == teacherUserId, ct); if (targetUser == null) throw new KeyNotFoundException("账号不存在。"); if (targetUser.Role == "SuperAdmin") throw new UnauthorizedAccessException("无权锁定超级管理员账号。"); if (targetUser.TenantId != schoolAdminTenantId) throw new UnauthorizedAccessException("无权操作其他学校账号。"); if (targetUser.Role != "Teacher") throw new UnauthorizedAccessException("学校管理员无权启停非教师角色账号。"); if (targetUser.IsLocked == isLocked) return false; await using var tx = await db.Database.BeginTransactionAsync(ct); try { targetUser.IsLocked = isLocked; targetUser.TokenVersion += 1; var action = isLocked ? "SCHOOLADMIN_LOCK_TEACHER" : "SCHOOLADMIN_UNLOCK_TEACHER"; var details = isLocked ? $"停用教师账号: {targetUser.Username}" : $"恢复教师账号: {targetUser.Username}"; db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = "SchoolAdmin", Action = action, TargetType = "User", TargetId = teacherUserId, Details = details, IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return true; } catch { await tx.RollbackAsync(ct); throw; } } public async Task GetBroadcastReceiptSummaryAsync(string broadcastId, CancellationToken ct = default) { if (string.IsNullOrWhiteSpace(broadcastId)) return null; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notifications = await db.Notifications .AsNoTracking() .Include(n => n.Receipts) .Where(n => n.BroadcastId == broadcastId) .ToListAsync(ct); if (notifications.Count == 0) return null; var receipts = notifications .SelectMany(n => n.Receipts) .ToList(); return new BroadcastReceiptSummaryDto { BroadcastId = broadcastId, TargetSchools = notifications.Select(n => n.TenantId).Distinct().Count(), TargetClassrooms = notifications.Count, TargetDevices = receipts.Count, Displayed = receipts.Count(r => NotificationReceiptStatuses.IsDisplayed(r.Status)), Pending = receipts.Count(r => NotificationReceiptStatuses.IsPending(r.Status)), Cancelled = receipts.Count(r => r.Status == NotificationReceiptStatuses.Cancelled), Failed = receipts.Count(r => NotificationReceiptStatuses.IsFailed(r.Status)), CreatedAt = notifications.Min(n => n.CreatedAt) }; } public async Task DeleteUserAsync(string userId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; if (user.Role == "SuperAdmin") throw new InvalidOperationException("无法删除超级管理员"); db.Users.Remove(user); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DELETE_USER", TargetType = "User", TargetId = userId, Details = "删除用户", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task UpdateDeviceAsync(string deviceId, string? hostname, string? classroomId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) return false; if (!string.IsNullOrWhiteSpace(hostname)) device.Hostname = hostname.Trim(); if (!string.IsNullOrWhiteSpace(classroomId)) { var targetClass = classroomId.Trim(); var classExists = await db.Classrooms.AsNoTracking().AnyAsync(c => c.TenantId == device.TenantId && c.Id == targetClass); if (!classExists) { throw new InvalidOperationException($"目标班级不存在或不属于设备所在的学校租户 ({device.TenantId}): {targetClass}"); } device.ClassroomId = targetClass; } if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "UPDATE_DEVICE", TargetType = "Device", TargetId = deviceId, Details = $"更新设备元数据: 主机名={hostname}, 绑定班级={classroomId}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task DecommissionDeviceAsync(string deviceId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) return false; device.IsActive = false; device.LastHeartbeatAt = null; if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DECOMMISSION_DEVICE", TargetType = "Device", TargetId = deviceId, Details = "清退并注销指定设备", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); if (_deviceToConnection.TryRemove(deviceId, out var connId)) { _liveConnections.TryRemove(connId, out _); _connectionTenantMap.TryRemove(connId, out _); } return true; } catch { await tx.RollbackAsync(); throw; } } public async Task DeleteActivationCodeAsync(string code, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var act = await db.ActivationCodes.FirstOrDefaultAsync(a => a.Code == code); if (act == null) return false; db.ActivationCodes.Remove(act); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DELETE_ACTIVATION_CODE", TargetType = "ActivationCode", TargetId = code, Details = "作废/删除激活码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task GetSystemHealthAsync() { bool dbOk = false; double latencyMs = 0; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); try { var sw = System.Diagnostics.Stopwatch.StartNew(); dbOk = await db.Database.CanConnectAsync(); sw.Stop(); latencyMs = sw.Elapsed.TotalMilliseconds; } catch {} var process = System.Diagnostics.Process.GetCurrentProcess(); var uptime = DateTime.UtcNow - process.StartTime.ToUniversalTime(); return new SystemHealthDto { Status = dbOk ? "Healthy" : "Degraded", DatabaseConnected = dbOk, DatabaseLatencyMs = Math.Round(latencyMs, 2), ActiveSignalRConnections = _liveConnections.Count, OnlineDevices = _liveConnections.Count, ServerTime = DateTimeOffset.UtcNow.ToString("o"), Uptime = $"{(int)uptime.TotalHours}h {uptime.Minutes}m {uptime.Seconds}s", MemoryUsedBytes = process.WorkingSet64 }; } public async Task LogAdminAuditAsync(string actorUsername, string actorRole, string action, string targetType, string targetId, string? details, string? ip) { try { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var evt = new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}".Substring(0, 16), OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = actorRole, Action = action, TargetType = targetType, TargetId = targetId, Details = details, IpAddress = ip }; db.AdminAuditEvents.Add(evt); await db.SaveChangesAsync(); } catch (Exception ex) { _logger.LogError(ex, "FATAL SECURITY AUDIT FAILURE: Failed to persist AdminAuditEvent for action {Action} (fail-closed engaged)", action); throw; } } public async Task> GetAdminAuditLogsAsync(int limit = 100) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var list = await db.AdminAuditEvents .OrderByDescending(a => a.OccurredAt) .Take(limit) .ToListAsync(); return list.Select(a => new AdminAuditLogDto { Id = a.Id, OccurredAt = a.OccurredAt, ActorUsername = a.ActorUsername, ActorRole = a.ActorRole, Action = a.Action, TargetType = a.TargetType, TargetId = a.TargetId, Details = a.Details, IpAddress = a.IpAddress }).ToList(); } #endregion #endregion } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/VisualReceiptCleanupWorker.cs SIZE: 1550 chars SHA256: 37010A2C4F9267EE287472B9657DDC3F0EFC8185E2507B0E545FF78A87041E99 ===================================================================== */ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace ClassNotify.Server.Services; public class VisualReceiptCleanupWorker : BackgroundService { private readonly IServiceProvider _serviceProvider; private readonly ILogger _logger; public VisualReceiptCleanupWorker( IServiceProvider serviceProvider, ILogger logger) { _serviceProvider = serviceProvider; _logger = logger; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("VisualReceiptCleanupWorker started (24h retention enforcer)."); while (!stoppingToken.IsCancellationRequested) { try { using var scope = _serviceProvider.CreateScope(); var service = scope.ServiceProvider.GetRequiredService(); await service.CleanupExpiredVisualReceiptsAsync(stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } catch (Exception ex) { _logger.LogError(ex, "Error occurred during visual receipt cleanup execution."); } // Check every 30 minutes await Task.Delay(TimeSpan.FromMinutes(30), stoppingToken); } _logger.LogInformation("VisualReceiptCleanupWorker stopped."); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/VisualReceiptService.cs SIZE: 14413 chars SHA256: 8BD9F45D9B860A76EC3937F1637F884F901B613CCB97D5661675D45A87E725D2 ===================================================================== */ using System.Collections.Concurrent; using System.Security.Claims; using System.Security.Cryptography; using System.Threading; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Services; public class VisualReceiptService : IVisualReceiptService { private static readonly ConcurrentDictionary _receiptLocks = new(); private readonly IServiceScopeFactory _scopeFactory; private readonly ISecurityService _securityService; private readonly IConfiguration _configuration; private readonly ILogger _logger; private readonly string _storageBasePath; public VisualReceiptService( IServiceScopeFactory scopeFactory, ISecurityService securityService, IConfiguration configuration, ILogger logger) { _scopeFactory = scopeFactory; _securityService = securityService; _configuration = configuration; _logger = logger; // Path resolution: config > /var/lib/classnotify/visual-receipts (if linux directory exists or creatable) > AppContext.BaseDirectory var configuredPath = _configuration.GetValue("VisualReceipt:StoragePath"); if (!string.IsNullOrWhiteSpace(configuredPath)) { _storageBasePath = configuredPath; } else if (OperatingSystem.IsLinux()) { _storageBasePath = "/var/lib/classnotify/visual-receipts"; } else { _storageBasePath = Path.Combine(AppContext.BaseDirectory, "visual_receipts"); } try { Directory.CreateDirectory(_storageBasePath); } catch (Exception ex) { _logger.LogWarning(ex, "Failed to create visual receipts storage directory at {Path}, falling back to temp directory.", _storageBasePath); _storageBasePath = Path.Combine(Path.GetTempPath(), "classnotify_visual_receipts"); Directory.CreateDirectory(_storageBasePath); } } public async Task SaveVisualReceiptAsync( string notificationId, string deviceId, string deviceToken, byte[] jpegBytes) { if (string.IsNullOrWhiteSpace(notificationId) || string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(deviceToken)) { return new VisualReceiptUploadResult(false, "缺少必要参数或凭据", 400); } // 1. Payload size check (Max 512 KiB) if (jpegBytes == null || jpegBytes.Length == 0) { return new VisualReceiptUploadResult(false, "图片数据为空", 400); } if (jpegBytes.Length > 524288) { return new VisualReceiptUploadResult(false, "图片文件超过 512 KiB 大小限制", 413); } // 2. JPEG magic bytes check: Starts with 0xFF 0xD8, Ends with 0xFF 0xD9 if (jpegBytes.Length < 4 || jpegBytes[0] != 0xFF || jpegBytes[1] != 0xD8 || jpegBytes[^2] != 0xFF || jpegBytes[^1] != 0xD9) { return new VisualReceiptUploadResult(false, "上传内容不是合法的 JPEG 格式图像", 415); } // 3. Authenticate device token var device = await _securityService.ValidateDeviceAsync(deviceId, deviceToken); if (device == null || !device.IsActive) { return new VisualReceiptUploadResult(false, "设备凭据无效或设备已被禁用", 401); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); // 4. Validate Notification and NotificationReceipt attribution var notification = await db.Notifications.AsNoTracking().FirstOrDefaultAsync(n => n.Id == notificationId); if (notification == null) { return new VisualReceiptUploadResult(false, "目标通知不存在", 404); } // Defense in depth: Check tenant and class isolation if (notification.TenantId != device.TenantId || notification.ClassroomId != device.ClassroomId) { _logger.LogWarning("Cross-tenant/class visual receipt upload spoofing attempt: Device {DevId} ({DevTenant}/{DevClass}) vs Notif {NotifId} ({NotifTenant}/{NotifClass})", deviceId, device.TenantId, device.ClassroomId, notificationId, notification.TenantId, notification.ClassroomId); return new VisualReceiptUploadResult(false, "设备归属与通知目标班级不匹配", 403); } var receipt = await db.NotificationReceipts.FirstOrDefaultAsync(r => r.NotificationId == notificationId && r.DeviceId == deviceId); if (receipt == null) { return new VisualReceiptUploadResult(false, "该设备未被分配此通知回执记录", 403); } // 5. Concurrency & Idempotency: First Successful Receipt Wins with Per-Receipt Mutex var receiptLock = _receiptLocks.GetOrAdd(receipt.Id, _ => new SemaphoreSlim(1, 1)); await receiptLock.WaitAsync(); try { // Fresh check from database inside mutex var currentReceipt = await db.NotificationReceipts.FirstOrDefaultAsync(r => r.Id == receipt.Id); if (currentReceipt == null) { return new VisualReceiptUploadResult(false, "回执记录不存在", 404); } if (currentReceipt.VisualReceiptState == "Available") { _logger.LogInformation("Visual receipt already available for Notification {NotifId} / Device {DevId} (Receipt {ReceiptId}). First-wins idempotent success returned.", notificationId, deviceId, receipt.Id); return new VisualReceiptUploadResult(true, "视觉回执已存在", 200, currentReceipt.Id, currentReceipt.VisualReceiptCapturedAt, currentReceipt.VisualReceiptExpiresAt); } // 6. Compute SHA256 hash string sha256Hex; using (var sha = SHA256.Create()) { var hashBytes = sha.ComputeHash(jpegBytes); sha256Hex = BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant(); } // 7. Atomic file writing with unique temporary file and overwrite: false var now = DateTimeOffset.UtcNow; var dateFolder = now.ToString("yyyyMMdd"); var targetDir = Path.Combine(_storageBasePath, dateFolder); Directory.CreateDirectory(targetDir); var relativePath = $"{dateFolder}/{currentReceipt.Id}.jpg"; var finalFilePath = Path.Combine(_storageBasePath, dateFolder, $"{currentReceipt.Id}.jpg"); var tempFilePath = Path.Combine(_storageBasePath, dateFolder, $"{currentReceipt.Id}_{Guid.NewGuid():N}.tmp"); try { await File.WriteAllBytesAsync(tempFilePath, jpegBytes); File.Move(tempFilePath, finalFilePath, overwrite: false); } catch (IOException ex) when (File.Exists(finalFilePath)) { // File already placed by a winning race; clean up temp and return idempotent success _logger.LogInformation(ex, "Final visual receipt file already exists at {Path}. Cleaned temp and returning first-wins idempotent.", finalFilePath); try { if (File.Exists(tempFilePath)) File.Delete(tempFilePath); } catch { } return new VisualReceiptUploadResult(true, "视觉回执已存在", 200, currentReceipt.Id, currentReceipt.VisualReceiptCapturedAt ?? now, currentReceipt.VisualReceiptExpiresAt ?? now.AddHours(24)); } catch (Exception ex) { _logger.LogError(ex, "Failed to write visual receipt file to {Path}", finalFilePath); try { if (File.Exists(tempFilePath)) File.Delete(tempFilePath); } catch { } return new VisualReceiptUploadResult(false, "服务端写入视觉回执文件失败", 500); } // 8. Update database record with 24-hour retention var expiresAt = now.AddHours(24); currentReceipt.VisualReceiptState = "Available"; currentReceipt.VisualReceiptPath = relativePath; currentReceipt.VisualReceiptCapturedAt = now; currentReceipt.VisualReceiptExpiresAt = expiresAt; currentReceipt.VisualReceiptSizeBytes = jpegBytes.Length; currentReceipt.VisualReceiptSha256 = sha256Hex; currentReceipt.UpdatedAt = now; try { await db.SaveChangesAsync(); _logger.LogInformation("Visual receipt successfully saved for Notification {NotifId} / Device {DevId} (Size: {Size} bytes, SHA256: {Sha256}, Expires: {ExpiresAt})", notificationId, deviceId, jpegBytes.Length, sha256Hex, expiresAt); return new VisualReceiptUploadResult(true, "视觉回执上传成功", 200, currentReceipt.Id, now, expiresAt); } catch (Exception ex) { _logger.LogError(ex, "Database update failed after saving visual receipt file. Compensating by removing file {Path}", finalFilePath); try { if (File.Exists(finalFilePath)) File.Delete(finalFilePath); } catch { } return new VisualReceiptUploadResult(false, "更新回执数据库状态失败", 500); } } finally { receiptLock.Release(); } } public async Task GetVisualReceiptFileAsync(string notificationId, string deviceId, ClaimsPrincipal user) { if (user.Identity?.IsAuthenticated != true) { return new VisualReceiptFileResult(false, null, 401, "未登录或登录凭据无效"); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notification = await db.Notifications.AsNoTracking().FirstOrDefaultAsync(n => n.Id == notificationId); if (notification == null) { return new VisualReceiptFileResult(false, null, 404, "通知记录不存在"); } // Permission check var userRole = user.FindFirst(ClaimTypes.Role)?.Value ?? "Teacher"; var userTenant = user.FindFirst("tenant_id")?.Value; var userId = user.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (userRole != "SuperAdmin") { if (string.IsNullOrEmpty(userTenant) || userTenant != notification.TenantId) { return new VisualReceiptFileResult(false, null, 403, "无权查看非本校通知记录的视觉回执"); } if (userRole == "Teacher") { // Teacher can view notifications sent by themselves or targeting their classroom bool isSender = !string.IsNullOrEmpty(userId) && notification.SenderUserId == userId; if (!isSender) { // Allow teacher within same school to view class notification history // (Consistent with existing NotificationController.GetNotifications policy) } } } var receipt = await db.NotificationReceipts.AsNoTracking() .FirstOrDefaultAsync(r => r.NotificationId == notificationId && r.DeviceId == deviceId); if (receipt == null || receipt.VisualReceiptState == "None") { return new VisualReceiptFileResult(false, null, 404, "该设备无视觉回执记录"); } var now = DateTimeOffset.UtcNow; if (receipt.VisualReceiptState == "Expired" || (receipt.VisualReceiptExpiresAt.HasValue && receipt.VisualReceiptExpiresAt.Value <= now)) { return new VisualReceiptFileResult(false, null, 410, "该视觉回执已按 24 小时隐私保存策略自动销毁"); } if (string.IsNullOrEmpty(receipt.VisualReceiptPath)) { return new VisualReceiptFileResult(false, null, 404, "视觉回执文件路径为空"); } // Prevent path traversal var safeRelativePath = receipt.VisualReceiptPath.Replace('\\', '/').TrimStart('/'); if (safeRelativePath.Contains("..")) { return new VisualReceiptFileResult(false, null, 400, "非法文件路径"); } var fullPath = Path.Combine(_storageBasePath, safeRelativePath); if (!File.Exists(fullPath)) { _logger.LogWarning("Visual receipt file missing on disk: {Path}", fullPath); return new VisualReceiptFileResult(false, null, 404, "视觉回执图像文件已被物理删除"); } return new VisualReceiptFileResult(true, fullPath, 200); } public async Task CleanupExpiredVisualReceiptsAsync(CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; var expiredReceipts = await db.NotificationReceipts .Where(r => r.VisualReceiptState == "Available" && r.VisualReceiptExpiresAt <= now) .Take(200) .ToListAsync(ct); if (expiredReceipts.Count == 0) return 0; int cleanedCount = 0; foreach (var r in expiredReceipts) { if (!string.IsNullOrEmpty(r.VisualReceiptPath)) { var safeRelativePath = r.VisualReceiptPath.Replace('\\', '/').TrimStart('/'); var fullPath = Path.Combine(_storageBasePath, safeRelativePath); try { if (File.Exists(fullPath)) { File.Delete(fullPath); } } catch (Exception ex) { _logger.LogWarning(ex, "Failed to delete expired visual receipt file at {Path}. Retaining Available state in database for retry in next cleanup cycle.", fullPath); continue; // Retain Available state and Path in database! Next worker cycle will retry. } } r.VisualReceiptPath = null; r.VisualReceiptState = "Expired"; r.UpdatedAt = now; cleanedCount++; } if (cleanedCount > 0) { await db.SaveChangesAsync(ct); _logger.LogInformation("Cleaned up {Count} expired visual receipts per 24-hour privacy retention policy.", cleanedCount); } return cleanedCount; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/assets/index-BTx44Hl3.css SIZE: 37445 chars SHA256: F65CF79B1DE0CED1413350D5FD1440120C3282602097ABDE8CD1CB57EDEF423E ===================================================================== */ *,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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}body{min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}body *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.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}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-5rem}.-top-20{top:-5rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.right-0{right:0}.right-2\.5{right:.625rem}.right-3{right:.75rem}.top-0{top:0}.top-2\.5{top:.625rem}.top-3\.5{top:.875rem}.z-10{z-index:10}.z-30{z-index:30}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.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}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-full{height:100%}.max-h-\[52vh\]{max-height:52vh}.max-h-\[58vh\]{max-height:58vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100vh-250px\)\]{max-height:calc(100vh - 250px)}.min-h-\[320px\]{min-height:320px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-36{width:9rem}.w-4{width:1rem}.w-44{width:11rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-full{width:100%}.min-w-\[50px\]{min-width:50px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-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))}.transform{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 spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.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-6{gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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))}.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-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.divide-slate-800\/60>:not([hidden])~:not([hidden]){border-color:#1e293b99}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.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-blue-500\/40{border-color:#3b82f666}.border-blue-500\/60{border-color:#3b82f699}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/50{border-color:#10b98180}.border-indigo-500\/20{border-color:#6366f133}.border-indigo-500\/30{border-color:#6366f14d}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-sky-500\/20{border-color:#0ea5e933}.border-sky-500\/30{border-color:#0ea5e94d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/70{border-color:#1e293bb3}.border-slate-800\/80{border-color:#1e293bcc}.border-transparent{border-color:transparent}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/25{background-color:#f59e0b40}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-600\/10{background-color:#2563eb1a}.bg-blue-600\/20{background-color:#2563eb33}.bg-blue-950\/60{background-color:#17255499}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/15{background-color:#05966926}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-950\/20{background-color:#022c2233}.bg-indigo-400{--tw-bg-opacity: 1;background-color:rgb(129 140 248 / var(--tw-bg-opacity, 1))}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/20{background-color:#4f46e533}.bg-rose-400{--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/15{background-color:#f43f5e26}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity, 1))}.bg-rose-600\/15{background-color:#e11d4826}.bg-rose-600\/20{background-color:#e11d4833}.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-600\/20{background-color:#0284c733}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/70{background-color:#020617b3}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/95{background-color:#020617f2}.bg-transparent{background-color:transparent}.bg-violet-500\/10{background-color:#8b5cf61a}.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))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b 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-indigo-600{--tw-gradient-from: #4f46e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-950{--tw-gradient-from: #020617 var(--tw-gradient-from-position);--tw-gradient-to: rgb(2 6 23 / 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)}.via-slate-200{--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #e2e8f0 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-900{--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #0f172a var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-950\/40{--tw-gradient-to: rgb(30 27 75 / .4) var(--tw-gradient-to-position)}.to-slate-400{--tw-gradient-to: #94a3b8 var(--tw-gradient-to-position)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.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-8{padding:2rem}.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}.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-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-10{padding-left:2.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-\[\'Inter\'\,system-ui\,-apple-system\,sans-serif\]{font-family:Inter,system-ui,-apple-system,sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.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-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/90{color:#fcd34de6}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.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-400\/90{color:#34d399e6}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-rose-200{--tw-text-opacity: 1;color:rgb(254 205 211 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / 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))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-70{opacity:.7}.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-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-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-amber-500\/10{--tw-shadow-color: rgb(245 158 11 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/25{--tw-shadow-color: rgb(245 158 11 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-600\/20{--tw-shadow-color: rgb(37 99 235 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/25{--tw-shadow-color: rgb(99 102 241 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/30{--tw-shadow-color: rgb(79 70 229 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/20{--tw-shadow-color: rgb(225 29 72 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring{--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(3px + 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)}.blur-3xl{--tw-blur: blur(64px);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-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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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-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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.glass-panel{border-radius:1rem;border-width:1px;border-color:#1e293bcc;background-color:#0f172ab3;--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);--tw-backdrop-blur: blur(24px);-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)}.glass-card{border-radius:.75rem;border-width:1px;border-color:#33415580;background-color:#1e293b66;--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);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.glass-card:hover{border-color:#475569b3;background-color:#1e293b99}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:border-blue-500\/40:hover{border-color:#3b82f666}.hover\:border-rose-500\/30:hover{border-color:#f43f5e4d}.hover\:border-rose-500\/40:hover{border-color:#f43f5e66}.hover\:border-rose-700\/50:hover{border-color:#be123c80}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:border-slate-700\/60:hover{border-color:#33415599}.hover\:border-slate-700\/80:hover{border-color:#334155cc}.hover\:bg-amber-500:hover{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-600\/25:hover{background-color:#05966940}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-600\/25:hover{background-color:#e11d4840}.hover\:bg-rose-900\/40:hover{background-color:#88133766}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700\/80:hover{background-color:#334155cc}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/25:hover{background-color:#1e293b40}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-500:hover{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-rose-300:hover{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.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}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500\/50:focus{border-color:#6366f180}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0: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(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)}.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:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/30:focus{--tw-ring-color: rgb(99 102 241 / .3)}.focus\:ring-indigo-500\/50:focus{--tw-ring-color: rgb(99 102 241 / .5)}.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-blue-700:active{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:translate-x-1{--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))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:block{display:block}.sm\:flex{display:flex}.sm\:w-64{width:16rem}.sm\:w-72{width:18rem}.sm\:max-w-none{max-width:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:w-auto{width:auto}.md\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}} /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/assets/index-C6huwYfG.js SIZE: 405500 chars SHA256: E99FCDD2F8E2F72C71FC1EA8AEC3DB5CB2AF28D2F70BE92AE5D7B04A238262FF ===================================================================== */ var sm=Object.defineProperty;var rm=(a,l,i)=>l in a?sm(a,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[l]=i;var wt=(a,l,i)=>rm(a,typeof l!="symbol"?l+"":l,i);function lm(a,l){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function $d(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ta={exports:{}},Lr={},na={exports:{}},je={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ud;function om(){if(ud)return je;ud=1;var a=Symbol.for("react.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),k=Symbol.iterator;function $(g){return g===null||typeof g!="object"?null:(g=k&&g[k]||g["@@iterator"],typeof g=="function"?g:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},W=Object.assign,U={};function I(g,P,se){this.props=g,this.context=P,this.refs=U,this.updater=se||B}I.prototype.isReactComponent={},I.prototype.setState=function(g,P){if(typeof g!="object"&&typeof g!="function"&&g!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,P,"setState")},I.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function L(){}L.prototype=I.prototype;function Y(g,P,se){this.props=g,this.context=P,this.refs=U,this.updater=se||B}var Q=Y.prototype=new L;Q.constructor=Y,W(Q,I.prototype),Q.isPureReactComponent=!0;var J=Array.isArray,oe=Object.prototype.hasOwnProperty,ie={current:null},fe={key:!0,ref:!0,__self:!0,__source:!0};function me(g,P,se){var M,ae={},ye=null,Ie=null;if(P!=null)for(M in P.ref!==void 0&&(Ie=P.ref),P.key!==void 0&&(ye=""+P.key),P)oe.call(P,M)&&!fe.hasOwnProperty(M)&&(ae[M]=P[M]);var _e=arguments.length-2;if(_e===1)ae.children=se;else if(1<_e){for(var Re=Array(_e),et=0;et<_e;et++)Re[et]=arguments[et+2];ae.children=Re}if(g&&g.defaultProps)for(M in _e=g.defaultProps,_e)ae[M]===void 0&&(ae[M]=_e[M]);return{$$typeof:a,type:g,key:ye,ref:Ie,props:ae,_owner:ie.current}}function X(g,P){return{$$typeof:a,type:g.type,key:P,ref:g.ref,props:g.props,_owner:g._owner}}function he(g){return typeof g=="object"&&g!==null&&g.$$typeof===a}function K(g){var P={"=":"=0",":":"=2"};return"$"+g.replace(/[=:]/g,function(se){return P[se]})}var pe=/\/+/g;function V(g,P){return typeof g=="object"&&g!==null&&g.key!=null?K(""+g.key):P.toString(36)}function re(g,P,se,M,ae){var ye=typeof g;(ye==="undefined"||ye==="boolean")&&(g=null);var Ie=!1;if(g===null)Ie=!0;else switch(ye){case"string":case"number":Ie=!0;break;case"object":switch(g.$$typeof){case a:case l:Ie=!0}}if(Ie)return Ie=g,ae=ae(Ie),g=M===""?"."+V(Ie,0):M,J(ae)?(se="",g!=null&&(se=g.replace(pe,"$&/")+"/"),re(ae,P,se,"",function(et){return et})):ae!=null&&(he(ae)&&(ae=X(ae,se+(!ae.key||Ie&&Ie.key===ae.key?"":(""+ae.key).replace(pe,"$&/")+"/")+g)),P.push(ae)),1;if(Ie=0,M=M===""?".":M+":",J(g))for(var _e=0;_e>>1,P=_[g];if(0>>1;gd(ae,E))yed(Ie,ae)?(_[g]=Ie,_[ye]=E,g=ye):(_[g]=ae,_[M]=E,g=M);else if(yed(Ie,E))_[g]=Ie,_[ye]=E,g=ye;else break e}}return q}function d(_,q){var E=_.sortIndex-q.sortIndex;return E!==0?E:_.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,y=m.now();a.unstable_now=function(){return m.now()-y}}var p=[],j=[],S=1,k=null,$=3,B=!1,W=!1,U=!1,I=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,Y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Q(_){for(var q=i(j);q!==null;){if(q.callback===null)u(j);else if(q.startTime<=_)u(j),q.sortIndex=q.expirationTime,l(p,q);else break;q=i(j)}}function J(_){if(U=!1,Q(_),!W)if(i(p)!==null)W=!0,z(oe);else{var q=i(j);q!==null&&de(J,q.startTime-_)}}function oe(_,q){W=!1,U&&(U=!1,L(me),me=-1),B=!0;var E=$;try{for(Q(q),k=i(p);k!==null&&(!(k.expirationTime>q)||_&&!K());){var g=k.callback;if(typeof g=="function"){k.callback=null,$=k.priorityLevel;var P=g(k.expirationTime<=q);q=a.unstable_now(),typeof P=="function"?k.callback=P:k===i(p)&&u(p),Q(q)}else u(p);k=i(p)}if(k!==null)var se=!0;else{var M=i(j);M!==null&&de(J,M.startTime-q),se=!1}return se}finally{k=null,$=E,B=!1}}var ie=!1,fe=null,me=-1,X=5,he=-1;function K(){return!(a.unstable_now()-he_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<_?Math.floor(1e3/_):5},a.unstable_getCurrentPriorityLevel=function(){return $},a.unstable_getFirstCallbackNode=function(){return i(p)},a.unstable_next=function(_){switch($){case 1:case 2:case 3:var q=3;break;default:q=$}var E=$;$=q;try{return _()}finally{$=E}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(_,q){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var E=$;$=_;try{return q()}finally{$=E}},a.unstable_scheduleCallback=function(_,q,E){var g=a.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0g?(_.sortIndex=E,l(j,_),i(p)===null&&_===i(j)&&(U?(L(me),me=-1):U=!0,de(J,E-g))):(_.sortIndex=P,l(p,_),W||B||(W=!0,z(oe))),_},a.unstable_shouldYield=K,a.unstable_wrapCallback=function(_){var q=$;return function(){var E=$;$=q;try{return _.apply(this,arguments)}finally{$=E}}}})(la)),la}var pd;function dm(){return pd||(pd=1,ra.exports=um()),ra.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var xd;function hm(){if(xd)return bt;xd=1;var a=ga(),l=dm();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,j=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,S={},k={};function $(e){return p.call(k,e)?!0:p.call(S,e)?!1:j.test(e)?k[e]=!0:(S[e]=!0,!1)}function B(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function W(e,t,s,r){if(t===null||typeof t>"u"||B(e,t,s,r))return!0;if(r)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function U(e,t,s,r,o,c,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=h}var I={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){I[e]=new U(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];I[t]=new U(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){I[e]=new U(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){I[e]=new U(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){I[e]=new U(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){I[e]=new U(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){I[e]=new U(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){I[e]=new U(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){I[e]=new U(e,5,!1,e.toLowerCase(),null,!1,!1)});var L=/[\-:]([a-z])/g;function Y(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(L,Y);I[t]=new U(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(L,Y);I[t]=new U(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(L,Y);I[t]=new U(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){I[e]=new U(e,1,!1,e.toLowerCase(),null,!1,!1)}),I.xlinkHref=new U("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){I[e]=new U(e,1,!1,e.toLowerCase(),null,!0,!0)});function Q(e,t,s,r){var o=I.hasOwnProperty(t)?I[t]:null;(o!==null?o.type!==0:r||!(2v||o[h]!==c[v]){var w=` `+o[h].replace(" at new "," at ");return e.displayName&&w.includes("")&&(w=w.replace("",e.displayName)),w}while(1<=h&&0<=v);break}}}finally{se=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?P(e):""}function ae(e){switch(e.tag){case 5:return P(e.type);case 16:return P("Lazy");case 13:return P("Suspense");case 19:return P("SuspenseList");case 0:case 2:case 15:return e=M(e.type,!1),e;case 11:return e=M(e.type.render,!1),e;case 1:return e=M(e.type,!0),e;default:return""}}function ye(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case fe:return"Fragment";case ie:return"Portal";case X:return"Profiler";case me:return"StrictMode";case V:return"Suspense";case re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case K:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case pe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ce:return t=e.displayName||null,t!==null?t:ye(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}function Ie(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ye(t);case 8:return t===me?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _e(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Re(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function et(e){var t=Re(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var o=s.get,c=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(h){r=""+h,c.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(h){r=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gn(e){e._valueTracker||(e._valueTracker=et(e))}function Qs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=Re(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function Hn(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fs(e,t){var s=t.checked;return E({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function ms(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=_e(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Wn(e,t){t=t.checked,t!=null&&Q(e,"checked",t,!1)}function en(e,t){Wn(e,t);var s=_e(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?vn(e,t.type,s):t.hasOwnProperty("defaultValue")&&vn(e,t.type,_e(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tn(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function vn(e,t,s){(t!=="number"||Hn(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var nn=Array.isArray;function sn(e,t,s,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=xs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vn(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var rn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},go=["Webkit","ms","Moz","O"];Object.keys(rn).forEach(function(e){go.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rn[t]=rn[e]})});function Xs(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||rn.hasOwnProperty(e)&&rn[e]?(""+t).trim():t+"px"}function D(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,o=Xs(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,o):e[s]=o}}var ge=E({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Be(e,t){if(t){if(ge[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function Ee(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var He=null;function Qe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ft=null,mt=null,Nt=null;function Ca(e){if(e=vr(e)){if(typeof ft!="function")throw Error(i(280));var t=e.stateNode;t&&(t=vl(t),ft(e.stateNode,e.type,t))}}function Ea(e){mt?Nt?Nt.push(e):Nt=[e]:mt=e}function Ta(){if(mt){var e=mt,t=Nt;if(Nt=mt=null,Ca(e),t)for(e=0;e>>=0,e===0?32:31-(vh(e)/yh|0)|0}var el=64,tl=4194304;function er(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,o=e.suspendedLanes,c=e.pingedLanes,h=s&268435455;if(h!==0){var v=h&~o;v!==0?r=er(v):(c&=h,c!==0&&(r=er(c)))}else h=s&~o,h!==0?r=er(h):c!==0&&(r=er(c));if(r===0)return 0;if(t!==0&&t!==r&&(t&o)===0&&(o=r&-r,c=t&-t,o>=c||o===16&&(c&4194240)!==0))return t;if((r&4)!==0&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0s;s++)t.push(e);return t}function tr(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ot(t),e[t]=s}function Nh(e,t){var s=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=cr),sc=" ",rc=!1;function lc(e,t){switch(e){case"keyup":return Gh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function oc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ys=!1;function Zh(e,t){switch(e){case"compositionend":return oc(t);case"keypress":return t.which!==32?null:(rc=!0,sc);case"textInput":return e=t.data,e===sc&&rc?null:e;default:return null}}function ef(e,t){if(ys)return e==="compositionend"||!$o&&lc(e,t)?(e=Ga(),il=To=Nn=null,ys=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=fc(s)}}function pc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xc(){for(var e=window,t=Hn();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Hn(e.document)}return t}function Oo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function uf(e){var t=xc(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&pc(s.ownerDocument.documentElement,s)){if(r!==null&&Oo(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=s.textContent.length,c=Math.min(r.start,o);r=r.end===void 0?c:Math.min(r.end,o),!e.extend&&c>r&&(o=r,r=c,c=o),o=mc(s,c);var h=mc(s,r);o&&h&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),c>r?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ws=null,zo=null,fr=null,Uo=!1;function gc(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Uo||ws==null||ws!==Hn(r)||(r=ws,"selectionStart"in r&&Oo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),fr&&hr(fr,r)||(fr=r,r=pl(zo,"onSelect"),0Ss||(e.current=Yo[Ss],Yo[Ss]=null,Ss--)}function Le(e,t){Ss++,Yo[Ss]=e.current,e.current=t}var Cn={},ot=kn(Cn),pt=kn(!1),Kn=Cn;function ks(e,t){var s=e.type.contextTypes;if(!s)return Cn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},c;for(c in s)o[c]=t[c];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function xt(e){return e=e.childContextTypes,e!=null}function yl(){$e(pt),$e(ot)}function Rc(e,t,s){if(ot.current!==Cn)throw Error(i(168));Le(ot,t),Le(pt,s)}function Lc(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(i(108,Ie(e)||"Unknown",o));return E({},s,r)}function wl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cn,Kn=ot.current,Le(ot,e),Le(pt,pt.current),!0}function Dc(e,t,s){var r=e.stateNode;if(!r)throw Error(i(169));s?(e=Lc(e,t,Kn),r.__reactInternalMemoizedMergedChildContext=e,$e(pt),$e(ot),Le(ot,e)):$e(pt),Le(pt,s)}var on=null,bl=!1,Zo=!1;function $c(e){on===null?on=[e]:on.push(e)}function jf(e){bl=!0,$c(e)}function En(){if(!Zo&&on!==null){Zo=!0;var e=0,t=Te;try{var s=on;for(Te=1;e>=h,o-=h,an=1<<32-Ot(t)+o|s<xe?(st=ue,ue=null):st=ue.sibling;var ke=A(N,ue,C[xe],H);if(ke===null){ue===null&&(ue=st);break}e&&ue&&ke.alternate===null&&t(N,ue),b=c(ke,b,xe),ce===null?ne=ke:ce.sibling=ke,ce=ke,ue=st}if(xe===C.length)return s(N,ue),Me&&Xn(N,xe),ne;if(ue===null){for(;xexe?(st=ue,ue=null):st=ue.sibling;var An=A(N,ue,ke.value,H);if(An===null){ue===null&&(ue=st);break}e&&ue&&An.alternate===null&&t(N,ue),b=c(An,b,xe),ce===null?ne=An:ce.sibling=An,ce=An,ue=st}if(ke.done)return s(N,ue),Me&&Xn(N,xe),ne;if(ue===null){for(;!ke.done;xe++,ke=C.next())ke=F(N,ke.value,H),ke!==null&&(b=c(ke,b,xe),ce===null?ne=ke:ce.sibling=ke,ce=ke);return Me&&Xn(N,xe),ne}for(ue=r(N,ue);!ke.done;xe++,ke=C.next())ke=G(ue,N,xe,ke.value,H),ke!==null&&(e&&ke.alternate!==null&&ue.delete(ke.key===null?xe:ke.key),b=c(ke,b,xe),ce===null?ne=ke:ce.sibling=ke,ce=ke);return e&&ue.forEach(function(nm){return t(N,nm)}),Me&&Xn(N,xe),ne}function Ve(N,b,C,H){if(typeof C=="object"&&C!==null&&C.type===fe&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case oe:e:{for(var ne=C.key,ce=b;ce!==null;){if(ce.key===ne){if(ne=C.type,ne===fe){if(ce.tag===7){s(N,ce.sibling),b=o(ce,C.props.children),b.return=N,N=b;break e}}else if(ce.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===z&&Fc(ne)===ce.type){s(N,ce.sibling),b=o(ce,C.props),b.ref=yr(N,ce,C),b.return=N,N=b;break e}s(N,ce);break}else t(N,ce);ce=ce.sibling}C.type===fe?(b=rs(C.props.children,N.mode,H,C.key),b.return=N,N=b):(H=Jl(C.type,C.key,C.props,null,N.mode,H),H.ref=yr(N,b,C),H.return=N,N=H)}return h(N);case ie:e:{for(ce=C.key;b!==null;){if(b.key===ce)if(b.tag===4&&b.stateNode.containerInfo===C.containerInfo&&b.stateNode.implementation===C.implementation){s(N,b.sibling),b=o(b,C.children||[]),b.return=N,N=b;break e}else{s(N,b);break}else t(N,b);b=b.sibling}b=Xi(C,N.mode,H),b.return=N,N=b}return h(N);case z:return ce=C._init,Ve(N,b,ce(C._payload),H)}if(nn(C))return ee(N,b,C,H);if(q(C))return te(N,b,C,H);Sl(N,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,b!==null&&b.tag===6?(s(N,b.sibling),b=o(b,C),b.return=N,N=b):(s(N,b),b=Ji(C,N.mode,H),b.return=N,N=b),h(N)):s(N,b)}return Ve}var Is=Bc(!0),Hc=Bc(!1),kl=kn(null),Cl=null,Ps=null,li=null;function oi(){li=Ps=Cl=null}function ii(e){var t=kl.current;$e(kl),e._currentValue=t}function ai(e,t,s){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===s)break;e=e.return}}function Rs(e,t){Cl=e,li=Ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(gt=!0),e.firstContext=null)}function Rt(e){var t=e._currentValue;if(li!==e)if(e={context:e,memoizedValue:t,next:null},Ps===null){if(Cl===null)throw Error(i(308));Ps=e,Cl.dependencies={lanes:0,firstContext:e}}else Ps=Ps.next=e;return t}var Gn=null;function ci(e){Gn===null?Gn=[e]:Gn.push(e)}function Wc(e,t,s,r){var o=t.interleaved;return o===null?(s.next=s,ci(t)):(s.next=o.next,o.next=s),t.interleaved=s,un(e,r)}function un(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Tn=!1;function ui(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function dn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function In(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Se&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,un(e,s)}return o=r.interleaved,o===null?(t.next=t,ci(r)):(t.next=o.next,o.next=t),r.interleaved=t,un(e,s)}function El(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,_o(e,s)}}function qc(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var o=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};c===null?o=c=h:c=c.next=h,s=s.next}while(s!==null);c===null?o=c=t:c=c.next=t}else o=c=t;s={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function Tl(e,t,s,r){var o=e.updateQueue;Tn=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,v=o.shared.pending;if(v!==null){o.shared.pending=null;var w=v,T=w.next;w.next=null,h===null?c=T:h.next=T,h=w;var O=e.alternate;O!==null&&(O=O.updateQueue,v=O.lastBaseUpdate,v!==h&&(v===null?O.firstBaseUpdate=T:v.next=T,O.lastBaseUpdate=w))}if(c!==null){var F=o.baseState;h=0,O=T=w=null,v=c;do{var A=v.lane,G=v.eventTime;if((r&A)===A){O!==null&&(O=O.next={eventTime:G,lane:0,tag:v.tag,payload:v.payload,callback:v.callback,next:null});e:{var ee=e,te=v;switch(A=t,G=s,te.tag){case 1:if(ee=te.payload,typeof ee=="function"){F=ee.call(G,F,A);break e}F=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=te.payload,A=typeof ee=="function"?ee.call(G,F,A):ee,A==null)break e;F=E({},F,A);break e;case 2:Tn=!0}}v.callback!==null&&v.lane!==0&&(e.flags|=64,A=o.effects,A===null?o.effects=[v]:A.push(v))}else G={eventTime:G,lane:A,tag:v.tag,payload:v.payload,callback:v.callback,next:null},O===null?(T=O=G,w=F):O=O.next=G,h|=A;if(v=v.next,v===null){if(v=o.shared.pending,v===null)break;A=v,v=A.next,A.next=null,o.lastBaseUpdate=A,o.shared.pending=null}}while(!0);if(O===null&&(w=F),o.baseState=w,o.firstBaseUpdate=T,o.lastBaseUpdate=O,t=o.shared.interleaved,t!==null){o=t;do h|=o.lane,o=o.next;while(o!==t)}else c===null&&(o.shared.lanes=0);es|=h,e.lanes=h,e.memoizedState=F}}function Qc(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;ts?s:4,e(!0);var r=pi.transition;pi.transition={};try{e(!1),t()}finally{Te=s,pi.transition=r}}function hu(){return Lt().memoizedState}function kf(e,t,s){var r=Dn(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},fu(e))mu(t,s);else if(s=Wc(e,t,s,r),s!==null){var o=ht();Wt(s,e,r,o),pu(s,t,r)}}function Cf(e,t,s){var r=Dn(e),o={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(fu(e))mu(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,v=c(h,s);if(o.hasEagerState=!0,o.eagerState=v,zt(v,h)){var w=t.interleaved;w===null?(o.next=o,ci(t)):(o.next=w.next,w.next=o),t.interleaved=o;return}}catch{}finally{}s=Wc(e,t,o,r),s!==null&&(o=ht(),Wt(s,e,r,o),pu(s,t,r))}}function fu(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function mu(e,t){Nr=Rl=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function pu(e,t,s){if((s&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,_o(e,s)}}var $l={readContext:Rt,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useInsertionEffect:it,useLayoutEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useMutableSource:it,useSyncExternalStore:it,useId:it,unstable_isNewReconciler:!1},Ef={readContext:Rt,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:ru,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,Ll(4194308,4,iu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Ll(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ll(4,2,e,t)},useMemo:function(e,t){var s=Jt();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=Jt();return t=s!==void 0?s(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=kf.bind(null,Oe,e),[r.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:nu,useDebugValue:ji,useDeferredValue:function(e){return Jt().memoizedState=e},useTransition:function(){var e=nu(!1),t=e[0];return e=Sf.bind(null,e[1]),Jt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=Oe,o=Jt();if(Me){if(s===void 0)throw Error(i(407));s=s()}else{if(s=t(),nt===null)throw Error(i(349));(Zn&30)!==0||Gc(r,t,s)}o.memoizedState=s;var c={value:s,getSnapshot:t};return o.queue=c,ru(Zc.bind(null,r,c,e),[e]),r.flags|=2048,kr(9,Yc.bind(null,r,c,s,t),void 0,null),s},useId:function(){var e=Jt(),t=nt.identifierPrefix;if(Me){var s=cn,r=an;s=(r&~(1<<32-Ot(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=_r++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=h.createElement(s,{is:r.is}):(e=h.createElement(s),s==="select"&&(h=e,r.multiple?h.multiple=!0:r.size&&(h.size=r.size))):e=h.createElementNS(e,s),e[Qt]=t,e[gr]=r,$u(e,t,!1,!1),t.stateNode=e;e:{switch(h=Ee(s,r),s){case"dialog":De("cancel",e),De("close",e),o=r;break;case"iframe":case"object":case"embed":De("load",e),o=r;break;case"video":case"audio":for(o=0;oAs&&(t.flags|=128,r=!0,Cr(c,!1),t.lanes=4194304)}else{if(!r)if(e=Il(h),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Cr(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!Me)return at(t),null}else 2*We()-c.renderingStartTime>As&&s!==1073741824&&(t.flags|=128,r=!0,Cr(c,!1),t.lanes=4194304);c.isBackwards?(h.sibling=t.child,t.child=h):(s=c.last,s!==null?s.sibling=h:t.child=h,c.last=h)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=We(),t.sibling=null,s=Ae.current,Le(Ae,r?s&1|2:s&1),t):(at(t),null);case 22:case 23:return qi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Ct&1073741824)!==0&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Mf(e,t){switch(ti(t),t.tag){case 1:return xt(t.type)&&yl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ls(),$e(pt),$e(ot),mi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return hi(t),null;case 13:if($e(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ts()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(Ae),null;case 4:return Ls(),null;case 10:return ii(t.type._context),null;case 22:case 23:return qi(),null;case 24:return null;default:return null}}var zl=!1,ct=!1,Af=typeof WeakSet=="function"?WeakSet:Set,Z=null;function $s(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Fe(e,t,r)}else s.current=null}function Di(e,t,s){try{s()}catch(r){Fe(e,t,r)}}var Ou=!1;function Of(e,t){if(qo=ll,e=xc(),Oo(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var o=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{s.nodeType,c.nodeType}catch{s=null;break e}var h=0,v=-1,w=-1,T=0,O=0,F=e,A=null;t:for(;;){for(var G;F!==s||o!==0&&F.nodeType!==3||(v=h+o),F!==c||r!==0&&F.nodeType!==3||(w=h+r),F.nodeType===3&&(h+=F.nodeValue.length),(G=F.firstChild)!==null;)A=F,F=G;for(;;){if(F===e)break t;if(A===s&&++T===o&&(v=h),A===c&&++O===r&&(w=h),(G=F.nextSibling)!==null)break;F=A,A=F.parentNode}F=G}s=v===-1||w===-1?null:{start:v,end:w}}else s=null}s=s||{start:0,end:0}}else s=null;for(Qo={focusedElem:e,selectionRange:s},ll=!1,Z=t;Z!==null;)if(t=Z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var ee=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ee!==null){var te=ee.memoizedProps,Ve=ee.memoizedState,N=t.stateNode,b=N.getSnapshotBeforeUpdate(t.elementType===t.type?te:Ft(t.type,te),Ve);N.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var C=t.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(H){Fe(t,t.return,H)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return ee=Ou,Ou=!1,ee}function Er(e,t,s){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var c=o.destroy;o.destroy=void 0,c!==void 0&&Di(t,s,c)}o=o.next}while(o!==r)}}function Ul(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function $i(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function zu(e){var t=e.alternate;t!==null&&(e.alternate=null,zu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qt],delete t[gr],delete t[Go],delete t[wf],delete t[bf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Uu(e){return e.tag===5||e.tag===3||e.tag===4}function Fu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Uu(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.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 Mi(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=gl));else if(r!==4&&(e=e.child,e!==null))for(Mi(e,t,s),e=e.sibling;e!==null;)Mi(e,t,s),e=e.sibling}function Ai(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ai(e,t,s),e=e.sibling;e!==null;)Ai(e,t,s),e=e.sibling}var rt=null,Bt=!1;function Pn(e,t,s){for(s=s.child;s!==null;)Bu(e,t,s),s=s.sibling}function Bu(e,t,s){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Zr,s)}catch{}switch(s.tag){case 5:ct||$s(s,t);case 6:var r=rt,o=Bt;rt=null,Pn(e,t,s),rt=r,Bt=o,rt!==null&&(Bt?(e=rt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):rt.removeChild(s.stateNode));break;case 18:rt!==null&&(Bt?(e=rt,s=s.stateNode,e.nodeType===8?Xo(e.parentNode,s):e.nodeType===1&&Xo(e,s),or(e)):Xo(rt,s.stateNode));break;case 4:r=rt,o=Bt,rt=s.stateNode.containerInfo,Bt=!0,Pn(e,t,s),rt=r,Bt=o;break;case 0:case 11:case 14:case 15:if(!ct&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var c=o,h=c.destroy;c=c.tag,h!==void 0&&((c&2)!==0||(c&4)!==0)&&Di(s,t,h),o=o.next}while(o!==r)}Pn(e,t,s);break;case 1:if(!ct&&($s(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(v){Fe(s,t,v)}Pn(e,t,s);break;case 21:Pn(e,t,s);break;case 22:s.mode&1?(ct=(r=ct)||s.memoizedState!==null,Pn(e,t,s),ct=r):Pn(e,t,s);break;default:Pn(e,t,s)}}function Hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Af),t.forEach(function(r){var o=Qf.bind(null,e,r);s.has(r)||(s.add(r),r.then(o,o))})}}function Ht(e,t){var s=t.deletions;if(s!==null)for(var r=0;ro&&(o=h),r&=~c}if(r=o,r=We()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uf(r/1960))-r,10e?16:e,Ln===null)var r=!1;else{if(e=Ln,Ln=null,Vl=0,(Se&6)!==0)throw Error(i(331));var o=Se;for(Se|=4,Z=e.current;Z!==null;){var c=Z,h=c.child;if((Z.flags&16)!==0){var v=c.deletions;if(v!==null){for(var w=0;wWe()-Ui?ns(e,0):zi|=s),yt(e,t)}function nd(e,t){t===0&&((e.mode&1)===0?t=1:(t=tl,tl<<=1,(tl&130023424)===0&&(tl=4194304)));var s=ht();e=un(e,t),e!==null&&(tr(e,t,s),yt(e,s))}function qf(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),nd(e,s)}function Qf(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(s=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),nd(e,s)}var sd;sd=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||pt.current)gt=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return gt=!1,Df(e,t,s);gt=(e.flags&131072)!==0}else gt=!1,Me&&(t.flags&1048576)!==0&&Mc(t,Nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ol(e,t),e=t.pendingProps;var o=ks(t,ot.current);Rs(t,s),o=gi(null,t,r,e,o,s);var c=vi();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(r)?(c=!0,wl(t)):c=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ui(t),o.updater=Ml,t.stateNode=o,o._reactInternals=t,_i(t,r,e,s),t=Ei(null,t,r,!0,c,s)):(t.tag=0,Me&&c&&ei(t),dt(null,t,o,s),t=t.child),t;case 16:r=t.elementType;e:{switch(Ol(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Jf(r),e=Ft(r,e),o){case 0:t=Ci(null,t,r,e,s);break e;case 1:t=Tu(null,t,r,e,s);break e;case 11:t=_u(null,t,r,e,s);break e;case 14:t=Su(null,t,r,Ft(r.type,e),s);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ft(r,o),Ci(e,t,r,o,s);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ft(r,o),Tu(e,t,r,o,s);case 3:e:{if(Iu(t),e===null)throw Error(i(387));r=t.pendingProps,c=t.memoizedState,o=c.element,Vc(e,t),Tl(t,r,null,s);var h=t.memoizedState;if(r=h.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){o=Ds(Error(i(423)),t),t=Pu(e,t,r,s,o);break e}else if(r!==o){o=Ds(Error(i(424)),t),t=Pu(e,t,r,s,o);break e}else for(kt=Sn(t.stateNode.containerInfo.firstChild),St=t,Me=!0,Ut=null,s=Hc(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Ts(),r===o){t=hn(e,t,s);break e}dt(e,t,r,s)}t=t.child}return t;case 5:return Kc(t),e===null&&si(t),r=t.type,o=t.pendingProps,c=e!==null?e.memoizedProps:null,h=o.children,Ko(r,o)?h=null:c!==null&&Ko(r,c)&&(t.flags|=32),Eu(e,t),dt(e,t,h,s),t.child;case 6:return e===null&&si(t),null;case 13:return Ru(e,t,s);case 4:return di(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Is(t,null,r,s):dt(e,t,r,s),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ft(r,o),_u(e,t,r,o,s);case 7:return dt(e,t,t.pendingProps,s),t.child;case 8:return dt(e,t,t.pendingProps.children,s),t.child;case 12:return dt(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,c=t.memoizedProps,h=o.value,Le(kl,r._currentValue),r._currentValue=h,c!==null)if(zt(c.value,h)){if(c.children===o.children&&!pt.current){t=hn(e,t,s);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var v=c.dependencies;if(v!==null){h=c.child;for(var w=v.firstContext;w!==null;){if(w.context===r){if(c.tag===1){w=dn(-1,s&-s),w.tag=2;var T=c.updateQueue;if(T!==null){T=T.shared;var O=T.pending;O===null?w.next=w:(w.next=O.next,O.next=w),T.pending=w}}c.lanes|=s,w=c.alternate,w!==null&&(w.lanes|=s),ai(c.return,s,t),v.lanes|=s;break}w=w.next}}else if(c.tag===10)h=c.type===t.type?null:c.child;else if(c.tag===18){if(h=c.return,h===null)throw Error(i(341));h.lanes|=s,v=h.alternate,v!==null&&(v.lanes|=s),ai(h,s,t),h=c.sibling}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===t){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}dt(e,t,o.children,s),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Rs(t,s),o=Rt(o),r=r(o),t.flags|=1,dt(e,t,r,s),t.child;case 14:return r=t.type,o=Ft(r,t.pendingProps),o=Ft(r.type,o),Su(e,t,r,o,s);case 15:return ku(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ft(r,o),Ol(e,t),t.tag=1,xt(r)?(e=!0,wl(t)):e=!1,Rs(t,s),gu(t,r,o),_i(t,r,o,s),Ei(null,t,r,!0,e,s);case 19:return Du(e,t,s);case 22:return Cu(e,t,s)}throw Error(i(156,t.tag))};function rd(e,t){return Aa(e,t)}function Kf(e,t,s,r){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,s,r){return new Kf(e,t,s,r)}function Ki(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jf(e){if(typeof e=="function")return Ki(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pe)return 11;if(e===Ce)return 14}return 2}function Mn(e,t){var s=e.alternate;return s===null?(s=$t(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Jl(e,t,s,r,o,c){var h=2;if(r=e,typeof e=="function")Ki(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case fe:return rs(s.children,o,c,t);case me:h=8,o|=8;break;case X:return e=$t(12,s,t,o|2),e.elementType=X,e.lanes=c,e;case V:return e=$t(13,s,t,o),e.elementType=V,e.lanes=c,e;case re:return e=$t(19,s,t,o),e.elementType=re,e.lanes=c,e;case de:return Xl(s,o,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:h=10;break e;case K:h=9;break e;case pe:h=11;break e;case Ce:h=14;break e;case z:h=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=$t(h,s,t,o),t.elementType=e,t.type=r,t.lanes=c,t}function rs(e,t,s,r){return e=$t(7,e,r,t),e.lanes=s,e}function Xl(e,t,s,r){return e=$t(22,e,r,t),e.elementType=de,e.lanes=s,e.stateNode={isHidden:!1},e}function Ji(e,t,s){return e=$t(6,e,null,t),e.lanes=s,e}function Xi(e,t,s){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xf(e,t,s,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=No(0),this.expirationTimes=No(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=No(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Gi(e,t,s,r,o,c,h,v,w){return e=new Xf(e,t,s,v,w),t===1?(t=1,c===!0&&(t|=8)):t=0,c=$t(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},ui(c),e}function Gf(e,t,s){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),sa.exports=hm(),sa.exports}var vd;function fm(){if(vd)return so;vd=1;var a=Ad();return so.createRoot=a.createRoot,so.hydrateRoot=a.hydrateRoot,so}var mm=fm();const pm=$d(mm);Ad();/** * @remix-run/router v1.23.4 * * 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 */function Ar(){return Ar=Object.assign?Object.assign.bind():function(a){for(var l=1;l"u")throw new Error(l)}function Od(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function gm(){return Math.random().toString(36).substr(2,8)}function wd(a,l){return{usr:a.state,key:a.key,idx:l}}function ua(a,l,i,u){return i===void 0&&(i=null),Ar({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof l=="string"?Ws(l):l,{state:i,key:l&&l.key||u||gm()})}function lo(a){let{pathname:l="/",search:i="",hash:u=""}=a;return i&&i!=="?"&&(l+=i.charAt(0)==="?"?i:"?"+i),u&&u!=="#"&&(l+=u.charAt(0)==="#"?u:"#"+u),l}function Ws(a){let l={};if(a){let i=a.indexOf("#");i>=0&&(l.hash=a.substr(i),a=a.substr(0,i));let u=a.indexOf("?");u>=0&&(l.search=a.substr(u),a=a.substr(0,u)),a&&(l.pathname=a)}return l}function vm(a,l,i,u){u===void 0&&(u={});let{window:d=document.defaultView,v5Compat:f=!1}=u,m=d.history,y=On.Pop,p=null,j=S();j==null&&(j=0,m.replaceState(Ar({},m.state,{idx:j}),""));function S(){return(m.state||{idx:null}).idx}function k(){y=On.Pop;let I=S(),L=I==null?null:I-j;j=I,p&&p({action:y,location:U.location,delta:L})}function $(I,L){y=On.Push;let Y=ua(U.location,I,L);j=S()+1;let Q=wd(Y,j),J=U.createHref(Y);try{m.pushState(Q,"",J)}catch(oe){if(oe instanceof DOMException&&oe.name==="DataCloneError")throw oe;d.location.assign(J)}f&&p&&p({action:y,location:U.location,delta:1})}function B(I,L){y=On.Replace;let Y=ua(U.location,I,L);j=S();let Q=wd(Y,j),J=U.createHref(Y);m.replaceState(Q,"",J),f&&p&&p({action:y,location:U.location,delta:0})}function W(I){let L=d.location.origin!=="null"?d.location.origin:d.location.href,Y=typeof I=="string"?I:lo(I);return Y=Y.replace(/ $/,"%20"),qe(L,"No window.location.(origin|href) available to create URL for href: "+Y),new URL(Y,L)}let U={get action(){return y},get location(){return a(d,m)},listen(I){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(yd,k),p=I,()=>{d.removeEventListener(yd,k),p=null}},createHref(I){return l(d,I)},createURL:W,encodeLocation(I){let L=W(I);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:$,replace:B,go(I){return m.go(I)}};return U}var bd;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(bd||(bd={}));function ym(a,l,i){return i===void 0&&(i="/"),wm(a,l,i)}function wm(a,l,i,u){let d=typeof l=="string"?Ws(l):l,f=va(d.pathname||"/",i);if(f==null)return null;let m=zd(a);bm(m);let y=null,p=Lm(f);for(let j=0;y==null&&j{let p={relativePath:y===void 0?f.path||"":y,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};p.relativePath.startsWith("/")&&(qe(p.relativePath.startsWith(u),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(u.length));let j=zn([u,p.relativePath]),S=i.concat(p);f.children&&f.children.length>0&&(qe(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+j+'".')),zd(f.children,l,S,j)),!(f.path==null&&!f.index)&&l.push({path:j,score:Em(j,f.index),routesMeta:S})};return a.forEach((f,m)=>{var y;if(f.path===""||!((y=f.path)!=null&&y.includes("?")))d(f,m);else for(let p of Ud(f.path))d(f,m,p)}),l}function Ud(a){let l=a.split("/");if(l.length===0)return[];let[i,...u]=l,d=i.endsWith("?"),f=i.replace(/\?$/,"");if(u.length===0)return d?[f,""]:[f];let m=Ud(u.join("/")),y=[];return y.push(...m.map(p=>p===""?f:[f,p].join("/"))),d&&y.push(...m),y.map(p=>a.startsWith("/")&&p===""?"/":p)}function bm(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Tm(l.routesMeta.map(u=>u.childrenIndex),i.routesMeta.map(u=>u.childrenIndex)))}const jm=/^:[\w-]+$/,Nm=3,_m=2,Sm=1,km=10,Cm=-2,jd=a=>a==="*";function Em(a,l){let i=a.split("/"),u=i.length;return i.some(jd)&&(u+=Cm),l&&(u+=_m),i.filter(d=>!jd(d)).reduce((d,f)=>d+(jm.test(f)?Nm:f===""?Sm:km),u)}function Tm(a,l){return a.length===l.length&&a.slice(0,-1).every((u,d)=>u===l[d])?a[a.length-1]-l[l.length-1]:0}function Im(a,l,i){let{routesMeta:u}=a,d={},f="/",m=[];for(let y=0;y{let{paramName:$,isOptional:B}=S;if($==="*"){let U=y[k]||"";m=f.slice(0,f.length-U.length).replace(/(.)\/+$/,"$1")}const W=y[k];return B&&!W?j[$]=void 0:j[$]=(W||"").replace(/%2F/g,"/"),j},{}),pathname:f,pathnameBase:m,pattern:a}}function Rm(a,l,i){l===void 0&&(l=!1),i===void 0&&(i=!0),Od(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let u=[],d="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,y,p)=>(u.push({paramName:y,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(u.push({paramName:"*"}),d+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?d+="\\/*$":a!==""&&a!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,l?void 0:"i"),u]}function Lm(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Od(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+l+").")),a}}function va(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let i=l.endsWith("/")?l.length-1:l.length,u=a.charAt(i);return u&&u!=="/"?null:a.slice(i)||"/"}function Dm(a,l){l===void 0&&(l="/");let{pathname:i,search:u="",hash:d=""}=typeof a=="string"?Ws(a):a,f;return i?(i=Fd(i),i.startsWith("/")?f=Nd(i.substring(1),"/"):f=Nd(i,l)):f=l,{pathname:f,search:Am(u),hash:Om(d)}}function Nd(a,l){let i=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(d=>{d===".."?i.length>1&&i.pop():d!=="."&&i.push(d)}),i.length>1?i.join("/"):"/"}function oa(a,l,i,u){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function $m(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function ya(a,l){let i=$m(a);return l?i.map((u,d)=>d===i.length-1?u.pathname:u.pathnameBase):i.map(u=>u.pathnameBase)}function wa(a,l,i,u){u===void 0&&(u=!1);let d;typeof a=="string"?d=Ws(a):(d=Ar({},a),qe(!d.pathname||!d.pathname.includes("?"),oa("?","pathname","search",d)),qe(!d.pathname||!d.pathname.includes("#"),oa("#","pathname","hash",d)),qe(!d.search||!d.search.includes("#"),oa("#","search","hash",d)));let f=a===""||d.pathname==="",m=f?"/":d.pathname,y;if(m==null)y=i;else{let k=l.length-1;if(!u&&m.startsWith("..")){let $=m.split("/");for(;$[0]==="..";)$.shift(),k-=1;d.pathname=$.join("/")}y=k>=0?l[k]:"/"}let p=Dm(d,y),j=m&&m!=="/"&&m.endsWith("/"),S=(f||m===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(j||S)&&(p.pathname+="/"),p}const Fd=a=>a.replace(/\/\/+/g,"/"),zn=a=>Fd(a.join("/")),Mm=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Am=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Om=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function zm(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const Bd=["post","put","patch","delete"];new Set(Bd);const Um=["get",...Bd];new Set(Um);/** * React Router v6.30.6 * * 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 */function Or(){return Or=Object.assign?Object.assign.bind():function(a){for(var l=1;l{y.current=!0}),x.useCallback(function(j,S){if(S===void 0&&(S={}),!y.current)return;if(typeof j=="number"){u.go(j);return}let k=wa(j,JSON.parse(m),f,S.relative==="path");a==null&&l!=="/"&&(k.pathname=k.pathname==="/"?l:zn([l,k.pathname])),(S.replace?u.replace:u.push)(k,S.state,S)},[l,u,m,f,a])}const Wm=x.createContext(null);function Vm(a){let l=x.useContext(xn).outlet;return l&&x.createElement(Wm.Provider,{value:a},l)}function Vd(a,l){let{relative:i}=l===void 0?{}:l,{future:u}=x.useContext(Bn),{matches:d}=x.useContext(xn),{pathname:f}=ds(),m=JSON.stringify(ya(d,u.v7_relativeSplatPath));return x.useMemo(()=>wa(a,JSON.parse(m),f,i==="path"),[a,m,f,i])}function qm(a,l){return Qm(a,l)}function Qm(a,l,i,u){Vs()||qe(!1);let{navigator:d}=x.useContext(Bn),{matches:f}=x.useContext(xn),m=f[f.length-1],y=m?m.params:{};m&&m.pathname;let p=m?m.pathnameBase:"/";m&&m.route;let j=ds(),S;if(l){var k;let I=typeof l=="string"?Ws(l):l;p==="/"||(k=I.pathname)!=null&&k.startsWith(p)||qe(!1),S=I}else S=j;let $=S.pathname||"/",B=$;if(p!=="/"){let I=p.replace(/^\//,"").split("/");B="/"+$.replace(/^\//,"").split("/").slice(I.length).join("/")}let W=ym(a,{pathname:B}),U=Ym(W&&W.map(I=>Object.assign({},I,{params:Object.assign({},y,I.params),pathname:zn([p,d.encodeLocation?d.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?p:zn([p,d.encodeLocation?d.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),f,i,u);return l&&U?x.createElement(fo.Provider,{value:{location:Or({pathname:"/",search:"",hash:"",state:null,key:"default"},S),navigationType:On.Pop}},U):U}function Km(){let a=np(),l=zm(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,d={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},l),i?x.createElement("pre",{style:d},i):null,null)}const Jm=x.createElement(Km,null);class Xm extends x.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,i){return i.location!==l.location||i.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:i.error,location:i.location,revalidation:l.revalidation||i.revalidation}}componentDidCatch(l,i){console.error("React Router caught the following error during render",l,i)}render(){return this.state.error!==void 0?x.createElement(xn.Provider,{value:this.props.routeContext},x.createElement(Hd.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gm(a){let{routeContext:l,match:i,children:u}=a,d=x.useContext(ba);return d&&d.static&&d.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(d.staticContext._deepestRenderedBoundaryId=i.route.id),x.createElement(xn.Provider,{value:l},u)}function Ym(a,l,i,u){var d;if(l===void 0&&(l=[]),i===void 0&&(i=null),u===void 0&&(u=null),a==null){var f;if(!i)return null;if(i.errors)a=i.matches;else if((f=u)!=null&&f.v7_partialHydration&&l.length===0&&!i.initialized&&i.matches.length>0)a=i.matches;else return null}let m=a,y=(d=i)==null?void 0:d.errors;if(y!=null){let S=m.findIndex(k=>k.route.id&&(y==null?void 0:y[k.route.id])!==void 0);S>=0||qe(!1),m=m.slice(0,Math.min(m.length,S+1))}let p=!1,j=-1;if(i&&u&&u.v7_partialHydration)for(let S=0;S=0?m=m.slice(0,j+1):m=[m[0]];break}}}return m.reduceRight((S,k,$)=>{let B,W=!1,U=null,I=null;i&&(B=y&&k.route.id?y[k.route.id]:void 0,U=k.route.errorElement||Jm,p&&(j<0&&$===0?(rp("route-fallback"),W=!0,I=null):j===$&&(W=!0,I=k.route.hydrateFallbackElement||null)));let L=l.concat(m.slice(0,$+1)),Y=()=>{let Q;return B?Q=U:W?Q=I:k.route.Component?Q=x.createElement(k.route.Component,null):k.route.element?Q=k.route.element:Q=S,x.createElement(Gm,{match:k,routeContext:{outlet:S,matches:L,isDataRoute:i!=null},children:Q})};return i&&(k.route.ErrorBoundary||k.route.errorElement||$===0)?x.createElement(Xm,{location:i.location,revalidation:i.revalidation,component:U,error:B,children:Y(),routeContext:{outlet:null,matches:L,isDataRoute:!0}}):Y()},null)}var qd=(function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a})(qd||{}),Qd=(function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a})(Qd||{});function Zm(a){let l=x.useContext(ba);return l||qe(!1),l}function ep(a){let l=x.useContext(Fm);return l||qe(!1),l}function tp(a){let l=x.useContext(xn);return l||qe(!1),l}function Kd(a){let l=tp(),i=l.matches[l.matches.length-1];return i.route.id||qe(!1),i.route.id}function np(){var a;let l=x.useContext(Hd),i=ep(),u=Kd();return l!==void 0?l:(a=i.errors)==null?void 0:a[u]}function sp(){let{router:a}=Zm(qd.UseNavigateStable),l=Kd(Qd.UseNavigateStable),i=x.useRef(!1);return Wd(()=>{i.current=!0}),x.useCallback(function(d,f){f===void 0&&(f={}),i.current&&(typeof d=="number"?a.navigate(d):a.navigate(d,Or({fromRouteId:l},f)))},[a,l])}const _d={};function rp(a,l,i){_d[a]||(_d[a]=!0)}function lp(a,l){a==null||a.v7_startTransition,a==null||a.v7_relativeSplatPath}function Yt(a){let{to:l,replace:i,state:u,relative:d}=a;Vs()||qe(!1);let{future:f,static:m}=x.useContext(Bn),{matches:y}=x.useContext(xn),{pathname:p}=ds(),j=mo(),S=wa(l,ya(y,f.v7_relativeSplatPath),p,d==="path"),k=JSON.stringify(S);return x.useEffect(()=>j(JSON.parse(k),{replace:i,state:u,relative:d}),[j,k,d,i,u]),null}function Jd(a){return Vm(a.context)}function Je(a){qe(!1)}function op(a){let{basename:l="/",children:i=null,location:u,navigationType:d=On.Pop,navigator:f,static:m=!1,future:y}=a;Vs()&&qe(!1);let p=l.replace(/^\/*/,"/"),j=x.useMemo(()=>({basename:p,navigator:f,static:m,future:Or({v7_relativeSplatPath:!1},y)}),[p,y,f,m]);typeof u=="string"&&(u=Ws(u));let{pathname:S="/",search:k="",hash:$="",state:B=null,key:W="default"}=u,U=x.useMemo(()=>{let I=va(S,p);return I==null?null:{location:{pathname:I,search:k,hash:$,state:B,key:W},navigationType:d}},[p,S,k,$,B,W,d]);return U==null?null:x.createElement(Bn.Provider,{value:j},x.createElement(fo.Provider,{children:i,value:U}))}function ip(a){let{children:l,location:i}=a;return qm(da(l),i)}new Promise(()=>{});function da(a,l){l===void 0&&(l=[]);let i=[];return x.Children.forEach(a,(u,d)=>{if(!x.isValidElement(u))return;let f=[...l,d];if(u.type===x.Fragment){i.push.apply(i,da(u.props.children,f));return}u.type!==Je&&qe(!1),!u.props.index||!u.props.children||qe(!1);let m={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(m.children=da(u.props.children,f)),i.push(m)}),i}/** * React Router DOM v6.30.6 * * 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 */function ha(){return ha=Object.assign?Object.assign.bind():function(a){for(var l=1;l{let u=a[i];return l.concat(Array.isArray(u)?u.map(d=>[i,d]):[[i,u]])},[]))}function dp(a,l){let i=fa(a);return l&&l.forEach((u,d)=>{i.has(d)||l.getAll(d).forEach(f=>{i.append(d,f)})}),i}const hp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],fp="6";try{window.__reactRouterVersion=fp}catch{}const mp="startTransition",Sd=cm[mp];function pp(a){let{basename:l,children:i,future:u,window:d}=a,f=x.useRef();f.current==null&&(f.current=xm({window:d,v5Compat:!0}));let m=f.current,[y,p]=x.useState({action:m.action,location:m.location}),{v7_startTransition:j}=u||{},S=x.useCallback(k=>{j&&Sd?Sd(()=>p(k)):p(k)},[p,j]);return x.useLayoutEffect(()=>m.listen(S),[m,S]),x.useEffect(()=>lp(u),[u]),x.createElement(op,{basename:l,children:i,location:y.location,navigationType:y.action,navigator:m,future:u})}const xp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,be=x.forwardRef(function(l,i){let{onClick:u,relative:d,reloadDocument:f,replace:m,state:y,target:p,to:j,preventScrollReset:S,viewTransition:k}=l,$=ap(l,hp),{basename:B}=x.useContext(Bn),W,U=!1;if(typeof j=="string"&&gp.test(j)&&(W=j,xp))try{let Q=new URL(window.location.href),J=j.startsWith("//")?new URL(Q.protocol+j):new URL(j),oe=va(J.pathname,B);J.origin===Q.origin&&oe!=null?j=oe+J.search+J.hash:U=!0}catch{}let I=Bm(j,{relative:d}),L=vp(j,{replace:m,state:y,target:p,preventScrollReset:S,relative:d,viewTransition:k});function Y(Q){u&&u(Q),Q.defaultPrevented||L(Q)}return x.createElement("a",ha({},$,{href:W||I,onClick:U||f?u:Y,ref:i,target:p}))});var kd;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(kd||(kd={}));var Cd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(Cd||(Cd={}));function vp(a,l){let{target:i,replace:u,state:d,preventScrollReset:f,relative:m,viewTransition:y}=l===void 0?{}:l,p=mo(),j=ds(),S=Vd(a,{relative:m});return x.useCallback(k=>{if(up(k,i)){k.preventDefault();let $=u!==void 0?u:lo(j)===lo(S);p(a,{replace:$,state:d,preventScrollReset:f,relative:m,viewTransition:y})}},[j,p,S,u,d,i,a,f,m,y])}function yp(a){let l=x.useRef(fa(a)),i=x.useRef(!1),u=ds(),d=x.useMemo(()=>dp(u.search,i.current?null:l.current),[u.search]),f=mo(),m=x.useCallback((y,p)=>{const j=fa(typeof y=="function"?y(d):y);i.current=!0,f("?"+j,p)},[f,d]);return[d,m]}class wp{constructor(){wt(this,"listeners",new Set);wt(this,"isTerminated",!1)}subscribe(l){return this.listeners.add(l),()=>this.listeners.delete(l)}notifySessionExpired(l="登录已过期,请重新登录"){this.isTerminated||(this.isTerminated=!0,this.listeners.forEach(i=>{try{i(l)}catch(u){console.error("Error in session expired listener",u)}}))}reset(){this.isTerminated=!1}}const zs=new wp,Xd="/api";function as(){return localStorage.getItem("classnotify_token")}function bp(a){localStorage.setItem("classnotify_token",a)}function Dr(){localStorage.removeItem("classnotify_token"),localStorage.removeItem("classnotify_user")}async function Ne(a,l={}){const i=as(),u={"Content-Type":"application/json",...l.headers};i&&(u.Authorization=`Bearer ${i}`);const d=await fetch(`${Xd}${a}`,{...l,headers:u});if(d.status===401)throw Dr(),zs.notifySessionExpired("未授权或登录已过期,请重新登录"),new Error("未授权或登录已过期,请重新登录");if(!d.ok){let f=`请求失败 (${d.status})`;try{const m=await d.json();f=m.message||m.errorMessage||f}catch{}throw new Error(f)}return d.json()}const le={login:(a,l)=>Ne("/auth/login",{method:"POST",body:JSON.stringify({username:a,password:l})}),getMe:()=>Ne("/auth/me"),getAdminMetrics:()=>Ne("/admin/metrics"),getTenants:()=>Ne("/admin/tenants"),getAllDevices:()=>Ne("/admin/devices"),sendDeviceCommand:(a,l,i)=>Ne(`/admin/devices/${a}/command`,{method:"POST",body:JSON.stringify({command:l,parameters:i})}),getAdminActivationCodes:()=>Ne("/admin/activation-codes"),getAdminClasses:a=>Ne(`/admin/classes?tenantId=${encodeURIComponent(a)}`),generateAdminCode:(a,l)=>Ne(`/admin/activation-codes?tenantId=${encodeURIComponent(a)}&classId=${encodeURIComponent(l)}`,{method:"POST"}),getAdminNotifications:(a=50)=>Ne(`/admin/notifications?limit=${a}`),createTenant:a=>Ne("/admin/tenants",{method:"POST",body:JSON.stringify(a)}),updateTenant:(a,l)=>Ne(`/admin/tenants/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),getUsers:(a,l)=>{const i=new URLSearchParams;a&&i.append("tenantId",a),l&&i.append("role",l);const u=i.toString();return Ne(`/admin/users${u?`?${u}`:""}`)},createUser:a=>Ne("/admin/users",{method:"POST",body:JSON.stringify(a)}),resetPassword:(a,l)=>Ne(`/admin/users/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setUserLock:(a,l)=>Ne(`/admin/users/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),deleteUser:a=>Ne(`/admin/users/${encodeURIComponent(a)}`,{method:"DELETE"}),updateDevice:(a,l)=>Ne(`/admin/devices/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),decommissionDevice:a=>Ne(`/admin/devices/${encodeURIComponent(a)}/decommission`,{method:"POST"}),deleteActivationCode:a=>Ne(`/admin/activation-codes/${encodeURIComponent(a)}`,{method:"DELETE"}),sendEmergencyBroadcast:a=>Ne("/admin/broadcasts",{method:"POST",body:JSON.stringify(a)}),getBroadcastReceiptSummary:a=>Ne(`/admin/broadcasts/${encodeURIComponent(a)}/receipt-summary`),getSystemHealth:()=>Ne("/admin/system/health"),getAuditLogs:(a=100)=>Ne(`/admin/audit-logs?limit=${a}`),getSchoolOverview:()=>Ne("/school-admin/overview"),getSchoolClasses:()=>Ne("/school-admin/classes"),createSchoolClass:a=>Ne("/school-admin/classes",{method:"POST",body:JSON.stringify(a)}),getSchoolTeachers:()=>Ne("/school-admin/teachers"),createSchoolTeacher:a=>Ne("/school-admin/teachers",{method:"POST",body:JSON.stringify(a)}),resetSchoolTeacherPassword:(a,l)=>Ne(`/school-admin/teachers/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setSchoolTeacherLock:(a,l)=>Ne(`/school-admin/teachers/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),getSchoolDevices:()=>Ne("/school-admin/devices"),getSchoolCodes:()=>Ne("/school-admin/activation-codes"),generateSchoolCode:a=>Ne(`/school-admin/activation-codes?classId=${encodeURIComponent(a)}`,{method:"POST"}),getTeacherClasses:()=>Ne("/notification/classes"),sendNotification:a=>Ne("/notification/send",{method:"POST",body:JSON.stringify(a)}),cancelNotification:a=>Ne(`/notifications/${encodeURIComponent(a)}/cancel`,{method:"POST"}),getTeacherHistory:(a,l=50)=>Ne(`/notification/history?${a?`classId=${encodeURIComponent(a)}&`:""}limit=${l}`),getVisualReceiptBlob:async(a,l)=>{const i=as(),u=await fetch(`${Xd}/notifications/${encodeURIComponent(a)}/receipts/${encodeURIComponent(l)}/visual-receipt`,{headers:i?{Authorization:`Bearer ${i}`}:{}});if(u.status===410)throw new Error("视觉回执已按24小时保存策略自动销毁");if(u.status===404)throw new Error("未找到该通知的视觉回执");if(!u.ok)throw new Error(`获取视觉回执失败 (${u.status})`);return u.blob()}};class os extends Error{constructor(l,i){const u=new.target.prototype;super(`${l}: Status code '${i}'`),this.statusCode=i,this.__proto__=u}}class ja extends Error{constructor(l="A timeout occurred."){const i=new.target.prototype;super(l),this.__proto__=i}}class Vt extends Error{constructor(l="An abort occurred."){const i=new.target.prototype;super(l),this.__proto__=i}}class jp extends Error{constructor(l,i){const u=new.target.prototype;super(l),this.transport=i,this.errorType="UnsupportedTransportError",this.__proto__=u}}class Np extends Error{constructor(l,i){const u=new.target.prototype;super(l),this.transport=i,this.errorType="DisabledTransportError",this.__proto__=u}}class _p extends Error{constructor(l,i){const u=new.target.prototype;super(l),this.transport=i,this.errorType="FailedToStartTransportError",this.__proto__=u}}class Ed extends Error{constructor(l){const i=new.target.prototype;super(l),this.errorType="FailedToNegotiateWithServerError",this.__proto__=i}}class Sp extends Error{constructor(l,i){const u=new.target.prototype;super(l),this.innerErrors=i,this.__proto__=u}}class Gd{constructor(l,i,u){this.statusCode=l,this.statusText=i,this.content=u}}class po{get(l,i){return this.send({...i,method:"GET",url:l})}post(l,i){return this.send({...i,method:"POST",url:l})}delete(l,i){return this.send({...i,method:"DELETE",url:l})}getCookieString(l){return""}}var R;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(R||(R={}));class zr{constructor(){}log(l,i){}}zr.instance=new zr;const kp="8.0.29";class Xe{static isRequired(l,i){if(l==null)throw new Error(`The '${i}' argument is required.`)}static isNotEmpty(l,i){if(!l||l.match(/^\s*$/))throw new Error(`The '${i}' argument should not be empty.`)}static isIn(l,i,u){if(!(l in i))throw new Error(`Unknown ${u} value: ${l}.`)}}class Ue{static get isBrowser(){return!Ue.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Ue.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Ue.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function Ur(a,l){let i="";return cs(a)?(i=`Binary data of length ${a.byteLength}`,l&&(i+=`. Content: '${Cp(a)}'`)):typeof a=="string"&&(i=`String data of length ${a.length}`,l&&(i+=`. Content: '${a}'`)),i}function Cp(a){const l=new Uint8Array(a);let i="";return l.forEach(u=>{const d=u<16?"0":"";i+=`0x${d}${u.toString(16)} `}),i.substr(0,i.length-1)}function cs(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function Yd(a,l,i,u,d,f){const m={},[y,p]=Fs();m[y]=p,a.log(R.Trace,`(${l} transport) sending data. ${Ur(d,f.logMessageContent)}.`);const j=cs(d)?"arraybuffer":"text",S=await i.post(u,{content:d,headers:{...m,...f.headers},responseType:j,timeout:f.timeout,withCredentials:f.withCredentials});a.log(R.Trace,`(${l} transport) request complete. Response status: ${S.statusCode}.`)}function Ep(a){return a===void 0?new oo(R.Information):a===null?zr.instance:a.log!==void 0?a:new oo(a)}class Tp{constructor(l,i){this._subject=l,this._observer=i}dispose(){const l=this._subject.observers.indexOf(this._observer);l>-1&&this._subject.observers.splice(l,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(i=>{})}}class oo{constructor(l){this._minLevel=l,this.out=console}log(l,i){if(l>=this._minLevel){const u=`[${new Date().toISOString()}] ${R[l]}: ${i}`;switch(l){case R.Critical:case R.Error:this.out.error(u);break;case R.Warning:this.out.warn(u);break;case R.Information:this.out.info(u);break;default:this.out.log(u);break}}}}function Fs(){let a="X-SignalR-User-Agent";return Ue.isNode&&(a="User-Agent"),[a,Ip(kp,Pp(),Lp(),Rp())]}function Ip(a,l,i,u){let d="Microsoft SignalR/";const f=a.split(".");return d+=`${f[0]}.${f[1]}`,d+=` (${a}; `,l&&l!==""?d+=`${l}; `:d+="Unknown OS; ",d+=`${i}`,u?d+=`; ${u}`:d+="; Unknown Runtime Version",d+=")",d}function Pp(){if(Ue.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Rp(){if(Ue.isNode)return process.versions.node}function Lp(){return Ue.isNode?"NodeJS":"Browser"}function ia(a){return a.stack?a.stack:a.message?a.message:`${a}`}function Dp(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class $p extends po{constructor(l){if(super(),this._logger=l,typeof fetch>"u"||Ue.isNode){const i=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(i("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=i("node-fetch"):this._fetchType=fetch,this._fetchType=i("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Dp());if(typeof AbortController>"u"){const i=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=i("abort-controller")}else this._abortControllerType=AbortController}async send(l){if(l.abortSignal&&l.abortSignal.aborted)throw new Vt;if(!l.method)throw new Error("No method defined.");if(!l.url)throw new Error("No url defined.");const i=new this._abortControllerType;let u;l.abortSignal&&(l.abortSignal.onabort=()=>{i.abort(),u=new Vt});let d=null;if(l.timeout){const p=l.timeout;d=setTimeout(()=>{i.abort(),this._logger.log(R.Warning,"Timeout from HTTP request."),u=new ja},p)}l.content===""&&(l.content=void 0),l.content&&(l.headers=l.headers||{},cs(l.content)?l.headers["Content-Type"]="application/octet-stream":l.headers["Content-Type"]="text/plain;charset=UTF-8");let f;try{f=await this._fetchType(l.url,{body:l.content,cache:"no-cache",credentials:l.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...l.headers},method:l.method,mode:"cors",redirect:"follow",signal:i.signal})}catch(p){throw u||(this._logger.log(R.Warning,`Error from HTTP request. ${p}.`),p)}finally{d&&clearTimeout(d),l.abortSignal&&(l.abortSignal.onabort=null)}if(!f.ok){const p=await Td(f,"text");throw new os(p||f.statusText,f.status)}const y=await Td(f,l.responseType);return new Gd(f.status,f.statusText,y)}getCookieString(l){let i="";return Ue.isNode&&this._jar&&this._jar.getCookies(l,(u,d)=>i=d.join("; ")),i}}function Td(a,l){let i;switch(l){case"arraybuffer":i=a.arrayBuffer();break;case"text":i=a.text();break;case"blob":case"document":case"json":throw new Error(`${l} is not supported.`);default:i=a.text();break}return i}class Mp extends po{constructor(l){super(),this._logger=l}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new Vt):l.method?l.url?new Promise((i,u)=>{const d=new XMLHttpRequest;d.open(l.method,l.url,!0),d.withCredentials=l.withCredentials===void 0?!0:l.withCredentials,d.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.content===""&&(l.content=void 0),l.content&&(cs(l.content)?d.setRequestHeader("Content-Type","application/octet-stream"):d.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const f=l.headers;f&&Object.keys(f).forEach(m=>{d.setRequestHeader(m,f[m])}),l.responseType&&(d.responseType=l.responseType),l.abortSignal&&(l.abortSignal.onabort=()=>{d.abort(),u(new Vt)}),l.timeout&&(d.timeout=l.timeout),d.onload=()=>{l.abortSignal&&(l.abortSignal.onabort=null),d.status>=200&&d.status<300?i(new Gd(d.status,d.statusText,d.response||d.responseText)):u(new os(d.response||d.responseText||d.statusText,d.status))},d.onerror=()=>{this._logger.log(R.Warning,`Error from HTTP request. ${d.status}: ${d.statusText}.`),u(new os(d.statusText,d.status))},d.ontimeout=()=>{this._logger.log(R.Warning,"Timeout from HTTP request."),u(new ja)},d.send(l.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Ap extends po{constructor(l){if(super(),typeof fetch<"u"||Ue.isNode)this._httpClient=new $p(l);else if(typeof XMLHttpRequest<"u")this._httpClient=new Mp(l);else throw new Error("No usable HttpClient found.")}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new Vt):l.method?l.url?this._httpClient.send(l):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(l){return this._httpClient.getCookieString(l)}}class Et{static write(l){return`${l}${Et.RecordSeparator}`}static parse(l){if(l[l.length-1]!==Et.RecordSeparator)throw new Error("Message is incomplete.");const i=l.split(Et.RecordSeparator);return i.pop(),i}}Et.RecordSeparatorCode=30;Et.RecordSeparator=String.fromCharCode(Et.RecordSeparatorCode);class Op{writeHandshakeRequest(l){return Et.write(JSON.stringify(l))}parseHandshakeResponse(l){let i,u;if(cs(l)){const y=new Uint8Array(l),p=y.indexOf(Et.RecordSeparatorCode);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;i=String.fromCharCode.apply(null,Array.prototype.slice.call(y.slice(0,j))),u=y.byteLength>j?y.slice(j).buffer:null}else{const y=l,p=y.indexOf(Et.RecordSeparator);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;i=y.substring(0,j),u=y.length>j?y.substring(j):null}const d=Et.parse(i),f=JSON.parse(d[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[u,f]}}var we;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close",a[a.Ack=8]="Ack",a[a.Sequence=9]="Sequence"})(we||(we={}));class zp{constructor(){this.observers=[]}next(l){for(const i of this.observers)i.next(l)}error(l){for(const i of this.observers)i.error&&i.error(l)}complete(){for(const l of this.observers)l.complete&&l.complete()}subscribe(l){return this.observers.push(l),new Tp(this,l)}}class Up{constructor(l,i,u){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=l,this._connection=i,this._bufferSize=u}async _send(l){const i=this._protocol.writeMessage(l);let u=Promise.resolve();if(this._isInvocationMessage(l)){this._totalMessageCount++;let d=()=>{},f=()=>{};cs(i)?this._bufferedByteCount+=i.byteLength:this._bufferedByteCount+=i.length,this._bufferedByteCount>=this._bufferSize&&(u=new Promise((m,y)=>{d=m,f=y})),this._messages.push(new Fp(i,this._totalMessageCount,d,f))}try{this._reconnectInProgress||await this._connection.send(i)}catch{this._disconnected()}await u}_ack(l){let i=-1;for(let u=0;uthis._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=l.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const l=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:we.Sequence,sequenceId:l}));const i=this._messages;for(const u of i)await this._connection.send(u._message);this._reconnectInProgress=!1}_dispose(l){l??(l=new Error("Unable to reconnect to server."));for(const i of this._messages)i._rejector(l)}_isInvocationMessage(l){switch(l.type){case we.Invocation:case we.StreamItem:case we.Completion:case we.StreamInvocation:case we.CancelInvocation:return!0;case we.Close:case we.Sequence:case we.Ping:case we.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:we.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Fp{constructor(l,i,u,d){this._message=l,this._id=i,this._resolver=u,this._rejector=d}}const Bp=30*1e3,Hp=15*1e3,Wp=1e5;var Pe;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(Pe||(Pe={}));class Na{static create(l,i,u,d,f,m,y){return new Na(l,i,u,d,f,m,y)}constructor(l,i,u,d,f,m,y){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(R.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Xe.isRequired(l,"connection"),Xe.isRequired(i,"logger"),Xe.isRequired(u,"protocol"),this.serverTimeoutInMilliseconds=f??Bp,this.keepAliveIntervalInMilliseconds=m??Hp,this._statefulReconnectBufferSize=y??Wp,this._logger=i,this._protocol=u,this.connection=l,this._reconnectPolicy=d,this._handshakeProtocol=new Op,this.connection.onreceive=p=>this._processIncomingData(p),this.connection.onclose=p=>this._connectionClosed(p),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Pe.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:we.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(l){if(this._connectionState!==Pe.Disconnected&&this._connectionState!==Pe.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!l)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=l}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Pe.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Pe.Connecting,this._logger.log(R.Debug,"Starting HubConnection.");try{await this._startInternal(),Ue.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Pe.Connected,this._connectionStarted=!0,this._logger.log(R.Debug,"HubConnection connected successfully.")}catch(l){return this._connectionState=Pe.Disconnected,this._logger.log(R.Debug,`HubConnection failed to start successfully because of error '${l}'.`),Promise.reject(l)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const l=new Promise((i,u)=>{this._handshakeResolver=i,this._handshakeRejecter=u});await this.connection.start(this._protocol.transferFormat);try{let i=this._protocol.version;this.connection.features.reconnect||(i=1);const u={protocol:this._protocol.name,version:i};if(this._logger.log(R.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(u)),this._logger.log(R.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await l,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Up(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(i){throw this._logger.log(R.Debug,`Hub handshake failed with error '${i}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(i),i}}async stop(){const l=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await l}catch{}}_stopInternal(l){if(this._connectionState===Pe.Disconnected)return this._logger.log(R.Debug,`Call to HubConnection.stop(${l}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Pe.Disconnecting)return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const i=this._connectionState;return this._connectionState=Pe.Disconnecting,this._logger.log(R.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(R.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(i===Pe.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=l||new Vt("The connection was stopped before the hub handshake could complete."),this.connection.stop(l))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(l,...i){const[u,d]=this._replaceStreamingParams(i),f=this._createStreamInvocation(l,i,d);let m;const y=new zp;return y.cancelCallback=()=>{const p=this._createCancelInvocation(f.invocationId);return delete this._callbacks[f.invocationId],m.then(()=>this._sendWithProtocol(p))},this._callbacks[f.invocationId]=(p,j)=>{if(j){y.error(j);return}else p&&(p.type===we.Completion?p.error?y.error(new Error(p.error)):y.complete():y.next(p.item))},m=this._sendWithProtocol(f).catch(p=>{y.error(p),delete this._callbacks[f.invocationId]}),this._launchStreams(u,m),y}_sendMessage(l){return this._resetKeepAliveInterval(),this.connection.send(l)}_sendWithProtocol(l){return this._messageBuffer?this._messageBuffer._send(l):this._sendMessage(this._protocol.writeMessage(l))}send(l,...i){const[u,d]=this._replaceStreamingParams(i),f=this._sendWithProtocol(this._createInvocation(l,i,!0,d));return this._launchStreams(u,f),f}invoke(l,...i){const[u,d]=this._replaceStreamingParams(i),f=this._createInvocation(l,i,!1,d);return new Promise((y,p)=>{this._callbacks[f.invocationId]=(S,k)=>{if(k){p(k);return}else S&&(S.type===we.Completion?S.error?p(new Error(S.error)):y(S.result):p(new Error(`Unexpected message type: ${S.type}`)))};const j=this._sendWithProtocol(f).catch(S=>{p(S),delete this._callbacks[f.invocationId]});this._launchStreams(u,j)})}on(l,i){!l||!i||(l=l.toLowerCase(),this._methods[l]||(this._methods[l]=[]),this._methods[l].indexOf(i)===-1&&this._methods[l].push(i))}off(l,i){if(!l)return;l=l.toLowerCase();const u=this._methods[l];if(u)if(i){const d=u.indexOf(i);d!==-1&&(u.splice(d,1),u.length===0&&delete this._methods[l])}else delete this._methods[l]}onclose(l){l&&this._closedCallbacks.push(l)}onreconnecting(l){l&&this._reconnectingCallbacks.push(l)}onreconnected(l){l&&this._reconnectedCallbacks.push(l)}_processIncomingData(l){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(l=this._processHandshakeResponse(l),this._receivedHandshakeResponse=!0),l){const i=this._protocol.parseMessages(l,this._logger);for(const u of i)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(u)))switch(u.type){case we.Invocation:this._invokeClientMethod(u).catch(d=>{this._logger.log(R.Error,`Invoke client method threw error: ${ia(d)}`)});break;case we.StreamItem:case we.Completion:{const d=this._callbacks[u.invocationId];if(d){u.type===we.Completion&&delete this._callbacks[u.invocationId];try{d(u)}catch(f){this._logger.log(R.Error,`Stream callback threw error: ${ia(f)}`)}}break}case we.Ping:break;case we.Close:{this._logger.log(R.Information,"Close message received from server.");const d=u.error?new Error("Server returned an error on close: "+u.error):void 0;u.allowReconnect===!0?this.connection.stop(d):this._stopPromise=this._stopInternal(d);break}case we.Ack:this._messageBuffer&&this._messageBuffer._ack(u);break;case we.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(u);break;default:this._logger.log(R.Warning,`Invalid message type: ${u.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(l){let i,u;try{[u,i]=this._handshakeProtocol.parseHandshakeResponse(l)}catch(d){const f="Error parsing handshake response: "+d;this._logger.log(R.Error,f);const m=new Error(f);throw this._handshakeRejecter(m),m}if(i.error){const d="Server returned handshake error: "+i.error;this._logger.log(R.Error,d);const f=new Error(d);throw this._handshakeRejecter(f),f}else this._logger.log(R.Debug,"Server handshake complete.");return this._handshakeResolver(),u}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let l=this._nextKeepAlive-new Date().getTime();l<0&&(l=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===Pe.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},l)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(l){const i=l.target.toLowerCase(),u=this._methods[i];if(!u){this._logger.log(R.Warning,`No client method with the name '${i}' found.`),l.invocationId&&(this._logger.log(R.Warning,`No result given for '${i}' method and invocation ID '${l.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)));return}const d=u.slice(),f=!!l.invocationId;let m,y,p;for(const j of d)try{const S=m;m=await j.apply(this,l.arguments),f&&m&&S&&(this._logger.log(R.Error,`Multiple results provided for '${i}'. Sending error to server.`),p=this._createCompletionMessage(l.invocationId,"Client provided multiple results.",null)),y=void 0}catch(S){y=S,this._logger.log(R.Error,`A callback for the method '${i}' threw error '${S}'.`)}p?await this._sendWithProtocol(p):f?(y?p=this._createCompletionMessage(l.invocationId,`${y}`,null):m!==void 0?p=this._createCompletionMessage(l.invocationId,null,m):(this._logger.log(R.Warning,`No result given for '${i}' method and invocation ID '${l.invocationId}'.`),p=this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(p)):m&&this._logger.log(R.Error,`Result given for '${i}' method but server is not expecting a result.`)}_connectionClosed(l){this._logger.log(R.Debug,`HubConnection.connectionClosed(${l}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||l||new Vt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(l||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Pe.Disconnecting?this._completeClose(l):this._connectionState===Pe.Connected&&this._reconnectPolicy?this._reconnect(l):this._connectionState===Pe.Connected&&this._completeClose(l)}_completeClose(l){if(this._connectionStarted){this._connectionState=Pe.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(l??new Error("Connection closed.")),this._messageBuffer=void 0),Ue.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(i=>i.apply(this,[l]))}catch(i){this._logger.log(R.Error,`An onclose callback called with error '${l}' threw error '${i}'.`)}}}async _reconnect(l){const i=Date.now();let u=0,d=l!==void 0?l:new Error("Attempting to reconnect due to a unknown error."),f=this._getNextRetryDelay(u++,0,d);if(f===null){this._logger.log(R.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(l);return}if(this._connectionState=Pe.Reconnecting,l?this._logger.log(R.Information,`Connection reconnecting because of error '${l}'.`):this._logger.log(R.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(m=>m.apply(this,[l]))}catch(m){this._logger.log(R.Error,`An onreconnecting callback called with error '${l}' threw error '${m}'.`)}if(this._connectionState!==Pe.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;f!==null;){if(this._logger.log(R.Information,`Reconnect attempt number ${u} will start in ${f} ms.`),await new Promise(m=>{this._reconnectDelayHandle=setTimeout(m,f)}),this._reconnectDelayHandle=void 0,this._connectionState!==Pe.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Pe.Connected,this._logger.log(R.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(m=>m.apply(this,[this.connection.connectionId]))}catch(m){this._logger.log(R.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${m}'.`)}return}catch(m){if(this._logger.log(R.Information,`Reconnect attempt failed because of error '${m}'.`),this._connectionState!==Pe.Reconnecting){this._logger.log(R.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Pe.Disconnecting&&this._completeClose();return}d=m instanceof Error?m:new Error(m.toString()),f=this._getNextRetryDelay(u++,Date.now()-i,d)}}this._logger.log(R.Information,`Reconnect retries have been exhausted after ${Date.now()-i} ms and ${u} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(l,i,u){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:i,previousRetryCount:l,retryReason:u})}catch(d){return this._logger.log(R.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${l}, ${i}) threw error '${d}'.`),null}}_cancelCallbacksWithError(l){const i=this._callbacks;this._callbacks={},Object.keys(i).forEach(u=>{const d=i[u];try{d(null,l)}catch(f){this._logger.log(R.Error,`Stream 'error' callback called with '${l}' threw error: ${ia(f)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(l,i,u,d){if(u)return d.length!==0?{arguments:i,streamIds:d,target:l,type:we.Invocation}:{arguments:i,target:l,type:we.Invocation};{const f=this._invocationId;return this._invocationId++,d.length!==0?{arguments:i,invocationId:f.toString(),streamIds:d,target:l,type:we.Invocation}:{arguments:i,invocationId:f.toString(),target:l,type:we.Invocation}}}_launchStreams(l,i){if(l.length!==0){i||(i=Promise.resolve());for(const u in l)l[u].subscribe({complete:()=>{i=i.then(()=>this._sendWithProtocol(this._createCompletionMessage(u)))},error:d=>{let f;d instanceof Error?f=d.message:d&&d.toString?f=d.toString():f="Unknown error",i=i.then(()=>this._sendWithProtocol(this._createCompletionMessage(u,f)))},next:d=>{i=i.then(()=>this._sendWithProtocol(this._createStreamItemMessage(u,d)))}})}}_replaceStreamingParams(l){const i=[],u=[];for(let d=0;d0)&&(i=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(l);const u=await this._innerClient.send(l);return i&&u.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(l),await this._innerClient.send(l)):u}_setAuthorizationHeader(l){l.headers||(l.headers={}),this._accessToken?l.headers[is.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&l.headers[is.Authorization]&&delete l.headers[is.Authorization]}getCookieString(l){return this._innerClient.getCookieString(l)}}var Ze;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(Ze||(Ze={}));var ut;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(ut||(ut={}));let Qp=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Pd{get pollAborted(){return this._pollAbort.aborted}constructor(l,i,u){this._httpClient=l,this._logger=i,this._pollAbort=new Qp,this._options=u,this._running=!1,this.onreceive=null,this.onclose=null}async connect(l,i){if(Xe.isRequired(l,"url"),Xe.isRequired(i,"transferFormat"),Xe.isIn(i,ut,"transferFormat"),this._url=l,this._logger.log(R.Trace,"(LongPolling transport) Connecting."),i===ut.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[u,d]=Fs(),f={[u]:d,...this._options.headers},m={abortSignal:this._pollAbort.signal,headers:f,timeout:1e5,withCredentials:this._options.withCredentials};i===ut.Binary&&(m.responseType="arraybuffer");const y=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${y}.`);const p=await this._httpClient.get(y,m);p.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${p.statusCode}.`),this._closeError=new os(p.statusText||"",p.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,m)}async _poll(l,i){try{for(;this._running;)try{const u=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${u}.`);const d=await this._httpClient.get(u,i);d.statusCode===204?(this._logger.log(R.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):d.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${d.statusCode}.`),this._closeError=new os(d.statusText||"",d.statusCode),this._running=!1):d.content?(this._logger.log(R.Trace,`(LongPolling transport) data received. ${Ur(d.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(d.content)):this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(u){this._running?u instanceof ja?this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=u,this._running=!1):this._logger.log(R.Trace,`(LongPolling transport) Poll errored after shutdown: ${u.message}`)}}finally{this._logger.log(R.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(l){return this._running?Yd(this._logger,"LongPolling",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(R.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(R.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const l={},[i,u]=Fs();l[i]=u;const d={headers:{...l,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let f;try{await this._httpClient.delete(this._url,d)}catch(m){f=m}f?f instanceof os&&(f.statusCode===404?this._logger.log(R.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(R.Trace,`(LongPolling transport) Error sending a DELETE request: ${f}`)):this._logger.log(R.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(R.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let l="(LongPolling transport) Firing onclose event.";this._closeError&&(l+=" Error: "+this._closeError),this._logger.log(R.Trace,l),this.onclose(this._closeError)}}}class Kp{constructor(l,i,u,d){this._httpClient=l,this._accessToken=i,this._logger=u,this._options=d,this.onreceive=null,this.onclose=null}async connect(l,i){return Xe.isRequired(l,"url"),Xe.isRequired(i,"transferFormat"),Xe.isIn(i,ut,"transferFormat"),this._logger.log(R.Trace,"(SSE transport) Connecting."),this._url=l,this._accessToken&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((u,d)=>{let f=!1;if(i!==ut.Text){d(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let m;if(Ue.isBrowser||Ue.isWebWorker)m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials});else{const y=this._httpClient.getCookieString(l),p={};p.Cookie=y;const[j,S]=Fs();p[j]=S,m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials,headers:{...p,...this._options.headers}})}try{m.onmessage=y=>{if(this.onreceive)try{this._logger.log(R.Trace,`(SSE transport) data received. ${Ur(y.data,this._options.logMessageContent)}.`),this.onreceive(y.data)}catch(p){this._close(p);return}},m.onerror=y=>{f?this._close():d(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},m.onopen=()=>{this._logger.log(R.Information,`SSE connected to ${this._url}`),this._eventSource=m,f=!0,u()}}catch(y){d(y);return}})}async send(l){return this._eventSource?Yd(this._logger,"SSE",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(l){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(l))}}class Jp{constructor(l,i,u,d,f,m){this._logger=u,this._accessTokenFactory=i,this._logMessageContent=d,this._webSocketConstructor=f,this._httpClient=l,this.onreceive=null,this.onclose=null,this._headers=m}async connect(l,i){Xe.isRequired(l,"url"),Xe.isRequired(i,"transferFormat"),Xe.isIn(i,ut,"transferFormat"),this._logger.log(R.Trace,"(WebSockets transport) Connecting.");let u;return this._accessTokenFactory&&(u=await this._accessTokenFactory()),new Promise((d,f)=>{l=l.replace(/^http/,"ws");let m;const y=this._httpClient.getCookieString(l);let p=!1;if(Ue.isNode||Ue.isReactNative){const j={},[S,k]=Fs();j[S]=k,u&&(j[is.Authorization]=`Bearer ${u}`),y&&(j[is.Cookie]=y),m=new this._webSocketConstructor(l,void 0,{headers:{...j,...this._headers}})}else u&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(u)}`);m||(m=new this._webSocketConstructor(l)),i===ut.Binary&&(m.binaryType="arraybuffer"),m.onopen=j=>{this._logger.log(R.Information,`WebSocket connected to ${l}.`),this._webSocket=m,p=!0,d()},m.onerror=j=>{let S=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?S=j.error:S="There was an error with the transport",this._logger.log(R.Information,`(WebSockets transport) ${S}.`)},m.onmessage=j=>{if(this._logger.log(R.Trace,`(WebSockets transport) data received. ${Ur(j.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(j.data)}catch(S){this._close(S);return}},m.onclose=j=>{if(p)this._close(j);else{let S=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?S=j.error:S="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",f(new Error(S))}}})}send(l){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(R.Trace,`(WebSockets transport) sending data. ${Ur(l,this._logMessageContent)}.`),this._webSocket.send(l),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(l){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(R.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(l)&&(l.wasClean===!1||l.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${l.code} (${l.reason||"no reason given"}).`)):l instanceof Error?this.onclose(l):this.onclose())}_isCloseEvent(l){return l&&typeof l.wasClean=="boolean"&&typeof l.code=="number"}}const Rd=100;class Xp{constructor(l,i={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Xe.isRequired(l,"url"),this._logger=Ep(i.logger),this.baseUrl=this._resolveUrl(l),i=i||{},i.logMessageContent=i.logMessageContent===void 0?!1:i.logMessageContent,typeof i.withCredentials=="boolean"||i.withCredentials===void 0)i.withCredentials=i.withCredentials===void 0?!0:i.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");i.timeout=i.timeout===void 0?100*1e3:i.timeout;let u=null,d=null;if(Ue.isNode&&typeof require<"u"){const f=typeof __webpack_require__=="function"?__non_webpack_require__:require;u=f("ws"),d=f("eventsource")}!Ue.isNode&&typeof WebSocket<"u"&&!i.WebSocket?i.WebSocket=WebSocket:Ue.isNode&&!i.WebSocket&&u&&(i.WebSocket=u),!Ue.isNode&&typeof EventSource<"u"&&!i.EventSource?i.EventSource=EventSource:Ue.isNode&&!i.EventSource&&typeof d<"u"&&(i.EventSource=d),this._httpClient=new qp(i.httpClient||new Ap(this._logger),i.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=i,this.onreceive=null,this.onclose=null}async start(l){if(l=l||ut.Binary,Xe.isIn(l,ut,"transferFormat"),this._logger.log(R.Debug,`Starting connection with transfer format '${ut[l]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(l),await this._startInternalPromise,this._connectionState==="Disconnecting"){const i="Failed to start the HttpConnection before stop() was called.";return this._logger.log(R.Error,i),await this._stopPromise,Promise.reject(new Vt(i))}else if(this._connectionState!=="Connected"){const i="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(R.Error,i),Promise.reject(new Vt(i))}this._connectionStarted=!0}send(l){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new _a(this.transport)),this._sendQueue.send(l))}async stop(l){if(this._connectionState==="Disconnected")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(i=>{this._stopPromiseResolver=i}),await this._stopInternal(l),await this._stopPromise}async _stopInternal(l){this._stopError=l;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(i){this._logger.log(R.Error,`HttpConnection.transport.stop() threw error '${i}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(R.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(l){let i=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Ze.WebSockets)this.transport=this._constructTransport(Ze.WebSockets),await this._startTransport(i,l);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let u=null,d=0;do{if(u=await this._getNegotiationResponse(i),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Vt("The connection was stopped during negotiation.");if(u.error)throw new Error(u.error);if(u.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(u.url&&(i=u.url),u.accessToken){const f=u.accessToken;this._accessTokenFactory=()=>f,this._httpClient._accessToken=f,this._httpClient._accessTokenFactory=void 0}d++}while(u.url&&d0?Promise.reject(new Sp(`Unable to connect to the server with any of the available transports. ${m.join(" ")}`,m)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(l){switch(l){case Ze.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Jp(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Ze.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Kp(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Ze.LongPolling:return new Pd(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${l}.`)}}_startTransport(l,i){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async u=>{let d=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(l,i),await this.features.resend()}catch{d=!0}else{this._stopConnection(u);return}d&&this._stopConnection(u)}:this.transport.onclose=u=>this._stopConnection(u),this.transport.connect(l,i)}_resolveTransportOrError(l,i,u,d){const f=Ze[l.transport];if(f==null)return this._logger.log(R.Debug,`Skipping transport '${l.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${l.transport}' because it is not supported by this client.`);if(Gp(i,f))if(l.transferFormats.map(y=>ut[y]).indexOf(u)>=0){if(f===Ze.WebSockets&&!this._options.WebSocket||f===Ze.ServerSentEvents&&!this._options.EventSource)return this._logger.log(R.Debug,`Skipping transport '${Ze[f]}' because it is not supported in your environment.'`),new jp(`'${Ze[f]}' is not supported in your environment.`,f);this._logger.log(R.Debug,`Selecting transport '${Ze[f]}'.`);try{return this.features.reconnect=f===Ze.WebSockets?d:void 0,this._constructTransport(f)}catch(y){return y}}else return this._logger.log(R.Debug,`Skipping transport '${Ze[f]}' because it does not support the requested transfer format '${ut[u]}'.`),new Error(`'${Ze[f]}' does not support ${ut[u]}.`);else return this._logger.log(R.Debug,`Skipping transport '${Ze[f]}' because it was disabled by the client.`),new Np(`'${Ze[f]}' is disabled by the client.`,f)}_isITransport(l){return l&&typeof l=="object"&&"connect"in l}_stopConnection(l){if(this._logger.log(R.Debug,`HttpConnection.stopConnection(${l}) called while in state ${this._connectionState}.`),this.transport=void 0,l=this._stopError||l,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(R.Debug,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(R.Warning,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${l}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),l?this._logger.log(R.Error,`Connection disconnected with error '${l}'.`):this._logger.log(R.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(i=>{this._logger.log(R.Error,`TransportSendQueue.stop() threw error '${i}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(l)}catch(i){this._logger.log(R.Error,`HttpConnection.onclose(${l}) threw error '${i}'.`)}}}_resolveUrl(l){if(l.lastIndexOf("https://",0)===0||l.lastIndexOf("http://",0)===0)return l;if(!Ue.isBrowser)throw new Error(`Cannot resolve '${l}'.`);const i=window.document.createElement("a");return i.href=l,this._logger.log(R.Information,`Normalizing '${l}' to '${i.href}'.`),i.href}_resolveNegotiateUrl(l){const i=new URL(l);i.pathname.endsWith("/")?i.pathname+="negotiate":i.pathname+="/negotiate";const u=new URLSearchParams(i.searchParams);return u.has("negotiateVersion")||u.append("negotiateVersion",this._negotiateVersion.toString()),u.has("useStatefulReconnect")?u.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&u.append("useStatefulReconnect","true"),i.search=u.toString(),i.toString()}}function Gp(a,l){return!a||(l&a)!==0}class _a{constructor(l){this._transport=l,this._buffer=[],this._executing=!0,this._sendBufferedData=new ro,this._transportResult=new ro,this._sendLoopPromise=this._sendLoop()}send(l){return this._bufferData(l),this._transportResult||(this._transportResult=new ro),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(l){if(this._buffer.length&&typeof this._buffer[0]!=typeof l)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof l}`);this._buffer.push(l),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new ro;const l=this._transportResult;this._transportResult=void 0;const i=typeof this._buffer[0]=="string"?this._buffer.join(""):_a._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(i),l.resolve()}catch(u){l.reject(u)}}}static _concatBuffers(l){const i=l.map(f=>f.byteLength).reduce((f,m)=>f+m),u=new Uint8Array(i);let d=0;for(const f of l)u.set(new Uint8Array(f),d),d+=f.byteLength;return u.buffer}}class ro{constructor(){this.promise=new Promise((l,i)=>[this._resolver,this._rejecter]=[l,i])}resolve(){this._resolver()}reject(l){this._rejecter(l)}}const Yp="json";class Zp{constructor(){this.name=Yp,this.version=2,this.transferFormat=ut.Text}parseMessages(l,i){if(typeof l!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!l)return[];i===null&&(i=zr.instance);const u=Et.parse(l),d=[];for(const f of u){const m=JSON.parse(f);if(typeof m.type!="number")throw new Error("Invalid payload.");switch(m.type){case we.Invocation:this._isInvocationMessage(m);break;case we.StreamItem:this._isStreamItemMessage(m);break;case we.Completion:this._isCompletionMessage(m);break;case we.Ping:break;case we.Close:break;case we.Ack:this._isAckMessage(m);break;case we.Sequence:this._isSequenceMessage(m);break;default:i.log(R.Information,"Unknown message type '"+m.type+"' ignored.");continue}d.push(m)}return d}writeMessage(l){return Et.write(JSON.stringify(l))}_isInvocationMessage(l){this._assertNotEmptyString(l.target,"Invalid payload for Invocation message."),l.invocationId!==void 0&&this._assertNotEmptyString(l.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(l){if(this._assertNotEmptyString(l.invocationId,"Invalid payload for StreamItem message."),l.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(l){if(l.result&&l.error)throw new Error("Invalid payload for Completion message.");!l.result&&l.error&&this._assertNotEmptyString(l.error,"Invalid payload for Completion message."),this._assertNotEmptyString(l.invocationId,"Invalid payload for Completion message.")}_isAckMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(l,i){if(typeof l!="string"||l==="")throw new Error(i)}}const e0={trace:R.Trace,debug:R.Debug,info:R.Information,information:R.Information,warn:R.Warning,warning:R.Warning,error:R.Error,critical:R.Critical,none:R.None};function t0(a){const l=e0[a.toLowerCase()];if(typeof l<"u")return l;throw new Error(`Unknown log level: ${a}`)}class n0{configureLogging(l){if(Xe.isRequired(l,"logging"),s0(l))this.logger=l;else if(typeof l=="string"){const i=t0(l);this.logger=new oo(i)}else this.logger=new oo(l);return this}withUrl(l,i){return Xe.isRequired(l,"url"),Xe.isNotEmpty(l,"url"),this.url=l,typeof i=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...i}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:i},this}withHubProtocol(l){return Xe.isRequired(l,"protocol"),this.protocol=l,this}withAutomaticReconnect(l){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return l?Array.isArray(l)?this.reconnectPolicy=new Id(l):this.reconnectPolicy=l:this.reconnectPolicy=new Id,this}withServerTimeout(l){return Xe.isRequired(l,"milliseconds"),this._serverTimeoutInMilliseconds=l,this}withKeepAliveInterval(l){return Xe.isRequired(l,"milliseconds"),this._keepAliveIntervalInMilliseconds=l,this}withStatefulReconnect(l){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=l==null?void 0:l.bufferSize,this}build(){const l=this.httpConnectionOptions||{};if(l.logger===void 0&&(l.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const i=new Xp(this.url,l);return Na.create(i,this.logger||zr.instance,this.protocol||new Zp,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function s0(a){return a.log!==void 0}class r0{constructor(){wt(this,"connection",null);wt(this,"state","Disconnected");wt(this,"startPromise",null);wt(this,"permanentRetryTimer",null);wt(this,"isAuthenticated",!1);wt(this,"stateListeners",new Set);wt(this,"ackListeners",new Set);wt(this,"deviceStatusListeners",new Set);wt(this,"healthReportListeners",new Set);wt(this,"notificationListeners",new Set);wt(this,"cancelledListeners",new Set);zs.subscribe(()=>{this.stop()})}getState(){return this.state}setState(l){this.state!==l&&(this.state=l,this.stateListeners.forEach(i=>i(l)))}onStateChange(l){return this.stateListeners.add(l),l(this.state),()=>this.stateListeners.delete(l)}onAckReceiptReceived(l){return this.ackListeners.add(l),()=>this.ackListeners.delete(l)}onDeviceStatusChanged(l){return this.deviceStatusListeners.add(l),()=>this.deviceStatusListeners.delete(l)}onHealthReportReceived(l){return this.healthReportListeners.add(l),()=>this.healthReportListeners.delete(l)}onNewNotificationBroadcast(l){return this.notificationListeners.add(l),()=>this.notificationListeners.delete(l)}onNotificationCancelled(l){return this.cancelledListeners.add(l),()=>this.cancelledListeners.delete(l)}async start(){var i,u;if(!as()){this.setState("Disconnected");return}if(this.isAuthenticated=!0,((i=this.connection)==null?void 0:i.state)===Pe.Connected){this.setState("Connected");return}return this.startPromise?this.startPromise:(this.connection||this.buildConnection(),this.setState(((u=this.connection)==null?void 0:u.state)===Pe.Reconnecting?"Reconnecting":"Connecting"),this.startPromise=(async()=>{try{this.connection&&this.connection.state===Pe.Disconnected&&(await this.connection.start(),this.setState("Connected"),this.clearPermanentRetryTimer())}catch(d){console.warn("SignalR start failed:",d),this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}finally{this.startPromise=null}})(),this.startPromise)}async stop(){if(this.isAuthenticated=!1,this.clearPermanentRetryTimer(),this.setState("Disconnected"),this.startPromise){try{await this.startPromise}catch{}this.startPromise=null}if(this.connection)try{await this.connection.stop()}catch(l){console.warn("Error stopping SignalR connection:",l)}finally{this.connection=null}}buildConnection(){this.connection=new n0().withUrl("/hubs/teacher",{accessTokenFactory:()=>as()||""}).withAutomaticReconnect([0,2e3,5e3,1e4,3e4]).configureLogging(R.Warning).build(),this.connection.onreconnecting(()=>{this.setState("Reconnecting")}),this.connection.onreconnected(()=>{this.setState("Connected"),this.clearPermanentRetryTimer()}),this.connection.onclose(()=>{this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}),this.connection.on("OnAckReceiptReceived",l=>{this.ackListeners.forEach(i=>i(l))}),this.connection.on("OnDeviceStatusChanged",l=>{this.deviceStatusListeners.forEach(i=>i(l))}),this.connection.on("OnHealthReportReceived",l=>{this.healthReportListeners.forEach(i=>i(l))}),this.connection.on("OnNewNotificationBroadcast",l=>{this.notificationListeners.forEach(i=>i(l))}),this.connection.on("OnNotificationCancelled",l=>{this.cancelledListeners.forEach(i=>i(l))})}schedulePermanentRetry(){this.permanentRetryTimer||!this.isAuthenticated||(this.permanentRetryTimer=setInterval(()=>{var l;if(!this.isAuthenticated){this.clearPermanentRetryTimer();return}((l=this.connection)==null?void 0:l.state)===Pe.Disconnected&&this.start()},3e4))}clearPermanentRetryTimer(){this.permanentRetryTimer&&(clearInterval(this.permanentRetryTimer),this.permanentRetryTimer=null)}}const Mt=new r0,Zd=x.createContext(void 0),l0=({children:a})=>{const[l,i]=x.useState(()=>{try{const j=localStorage.getItem("classnotify_user");return j?JSON.parse(j):null}catch{return null}}),[u,d]=x.useState(as()),[f,m]=x.useState(!0);x.useEffect(()=>{const j=zs.subscribe(()=>{Mt.stop(),Dr(),d(null),i(null)});return()=>j()},[]),x.useEffect(()=>{(async()=>{var k,$;if(as())try{const B=await le.getMe();i(B),localStorage.setItem("classnotify_user",JSON.stringify(B)),zs.reset(),Mt.start()}catch(B){((k=B==null?void 0:B.message)!=null&&k.includes("未授权")||($=B==null?void 0:B.message)!=null&&$.includes("401"))&&(Dr(),d(null),i(null))}else Dr(),i(null),d(null);m(!1)})()},[]);const y=async(j,S)=>{const k=await le.login(j,S);if(!k.success||!k.token||!k.role)throw new Error(k.errorMessage||"登录失败");bp(k.token),d(k.token);const $={userId:k.userId||"",name:k.fullName||j,role:k.role,tenantId:k.tenantId||""};return i($),localStorage.setItem("classnotify_user",JSON.stringify($)),zs.reset(),Mt.start(),k.role},p=()=>{Mt.stop(),Dr(),d(null),i(null),zs.reset()};return n.jsx(Zd.Provider,{value:{user:l,token:u,login:y,logout:p,isLoading:f},children:a})},qs=()=>{const a=x.useContext(Zd);if(!a){let l=null;try{const i=localStorage.getItem("classnotify_user");i&&(l=JSON.parse(i))}catch{}return{user:l,token:as(),login:async()=>"Teacher",logout:()=>{},isLoading:!1}}return a};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o0=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),eh=(...a)=>a.filter((l,i,u)=>!!l&&l.trim()!==""&&u.indexOf(l)===i).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var i0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a0=x.forwardRef(({color:a="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...y},p)=>x.createElement("svg",{ref:p,...i0,width:l,height:l,stroke:a,strokeWidth:u?Number(i)*24/Number(l):i,className:eh("lucide",d),...y},[...m.map(([j,S])=>x.createElement(j,S)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ve=(a,l)=>{const i=x.forwardRef(({className:u,...d},f)=>x.createElement(a0,{ref:f,iconNode:l,className:eh(`lucide-${o0(a)}`,u),...d}));return i.displayName=`${a}`,i};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Fr=ve("Activity",c0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],$r=ve("ArrowRight",u0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d0=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],io=ve("Bell",d0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Zt=ve("Building2",h0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ao=ve("Check",f0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m0=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ld=ve("ChevronDown",m0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],x0=ve("ChevronRight",p0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],mn=ve("CircleAlert",g0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],At=ve("CircleCheck",v0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ma=ve("CircleX",y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Hr=ve("Clock",w0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b0=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]],j0=ve("CloudRain",b0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],pa=ve("Copy",N0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _0=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],S0=ve("Ellipsis",_0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k0=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C0=ve("Eye",k0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E0=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],T0=ve("Flame",E0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I0=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Br=ve("GraduationCap",I0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],xa=ve("History",P0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R0=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],jt=ve("KeyRound",R0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L0=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Mr=ve("Layers",L0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Gt=ve("LoaderCircle",D0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],th=ve("LockOpen",$0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],co=ve("Lock",M0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A0=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],O0=ve("LogOut",A0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z0=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],U0=ve("Megaphone",z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F0=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],B0=ve("Menu",F0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Bs=ve("Monitor",H0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],nh=ve("PenLine",W0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],us=ve("Plus",V0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],Hs=ve("Radio",q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Tt=ve("RefreshCw",Q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],J0=ve("RotateCcw",K0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X0=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Dd=ve("School",X0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Wr=ve("Search",G0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],uo=ve("Send",Y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],sh=ve("ShieldAlert",Z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ex=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ho=ve("ShieldCheck",ex);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tx=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],rh=ve("Sparkles",tx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nx=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Sa=ve("Trash2",nx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sx=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fn=ve("TriangleAlert",sx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rx=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],lh=ve("User",rx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lx=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Us=ve("Users",lx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ox=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],ix=ve("Volume2",ox);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ax=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Un=ve("X",ax);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cx=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ux=ve("ZoomIn",cx);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dx=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],hx=ve("ZoomOut",dx),fx=()=>{const[a,l]=x.useState(Mt.getState());return x.useEffect(()=>Mt.onStateChange(l),[]),a==="Connected"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),"云端正常"]}):a==="Reconnecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"}),"正在重连…"]}):a==="Connecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-400 border border-blue-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400"}),"正在连接…"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),"云端离线"]})},mx=()=>{const{user:a,logout:l}=qs(),i=ds(),[u,d]=x.useState(!1);if(x.useEffect(()=>{d(!1)},[i.pathname]),!a)return null;const f=m=>i.pathname===m;return n.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"flex items-center justify-between h-16",children:[n.jsxs("div",{className:"flex items-center space-x-4",children:[n.jsxs(be,{to:"/",className:"flex items-center space-x-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:n.jsx(io,{className:"w-5 h-5 text-white"})}),n.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),n.jsxs("span",{className:"text-xs px-2.5 py-1 rounded-full font-medium flex items-center gap-1.5 border bg-slate-900 border-slate-800 text-slate-300",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ho,{className:"w-3.5 h-3.5 text-amber-400"}),n.jsx("span",{className:"text-amber-400 font-semibold",children:"超级运维后台"})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(Dd,{className:"w-3.5 h-3.5 text-sky-400"}),n.jsx("span",{className:"text-sky-400 font-semibold",children:"学校管理后台"})]}),a.role==="Teacher"&&n.jsxs(n.Fragment,{children:[n.jsx(Br,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]})]})]}),n.jsxs("nav",{className:"hidden md:flex items-center space-x-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(be,{to:"/admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Mr,{className:"w-4 h-4"}),"总览"]}),n.jsxs(be,{to:"/admin/tenants",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Zt,{className:"w-4 h-4"}),"学校租户"]}),n.jsxs(be,{to:"/admin/users",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Us,{className:"w-4 h-4"}),"用户中枢"]}),n.jsxs(be,{to:"/admin/devices",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Bs,{className:"w-4 h-4"}),"设备集控"]}),n.jsxs(be,{to:"/admin/broadcast",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400 border border-rose-500/30":"text-slate-400 hover:text-rose-300 hover:bg-slate-900"}`,children:[n.jsx(Hs,{className:"w-4 h-4"}),"应急广播"]}),n.jsxs(be,{to:"/admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(jt,{className:"w-4 h-4 text-amber-400"}),"激活码"]}),n.jsxs(be,{to:"/admin/history",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(xa,{className:"w-4 h-4"}),"审计"]})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(be,{to:"/school-admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Dd,{className:"w-4 h-4"}),"学校概览"]}),n.jsxs(be,{to:"/school-admin/classes",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Mr,{className:"w-4 h-4"}),"班级管理"]}),n.jsxs(be,{to:"/school-admin/teachers",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Us,{className:"w-4 h-4"}),"教师账号"]}),n.jsxs(be,{to:"/school-admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/school-admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(jt,{className:"w-4 h-4 text-amber-400"}),"本校激活码"]})]}),a.role==="Teacher"&&n.jsxs(be,{to:"/teacher",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/teacher")?"bg-emerald-600/20 text-emerald-400 border border-emerald-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(io,{className:"w-4 h-4"}),"呼叫与回执"]})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsx("div",{className:"hidden sm:block",children:n.jsx(fx,{})}),n.jsxs("div",{className:"hidden sm:flex flex-col text-right",children:[n.jsx("span",{className:"text-sm font-medium text-slate-200",children:a.name}),n.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":a.tenantId})]}),n.jsx("button",{onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 transition-colors",title:"退出登录",children:n.jsx(O0,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>d(!u),className:"md:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-900 border border-slate-800 transition-colors","aria-label":"展开菜单",children:u?n.jsx(Un,{className:"w-5 h-5"}):n.jsx(B0,{className:"w-5 h-5"})})]})]}),u&&n.jsxs("div",{className:"md:hidden py-3 px-2 border-t border-slate-800/80 bg-slate-950/95 space-y-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(be,{to:"/admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Mr,{className:"w-4 h-4 text-indigo-400"}),"总览大盘"]})}),n.jsx(be,{to:"/admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/30":"text-amber-400 bg-amber-500/10 hover:bg-amber-500/20"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[n.jsx(jt,{className:"w-4 h-4 text-amber-400"}),"设备激活码生成与管理"]}),n.jsx("span",{className:"text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded border border-amber-500/30 font-bold",children:"重点"})]})}),n.jsx(be,{to:"/admin/tenants",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zt,{className:"w-4 h-4 text-indigo-400"}),"学校租户"]})}),n.jsx(be,{to:"/admin/users",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Us,{className:"w-4 h-4 text-indigo-400"}),"用户中枢"]})}),n.jsx(be,{to:"/admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Bs,{className:"w-4 h-4 text-indigo-400"}),"设备集控"]})}),n.jsx(be,{to:"/admin/broadcast",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hs,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})}),n.jsx(be,{to:"/admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xa,{className:"w-4 h-4 text-indigo-400"}),"审计历史"]})})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(be,{to:"/school-admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"学校概览"}),n.jsx(be,{to:"/school-admin/classes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"班级管理"}),n.jsx(be,{to:"/school-admin/teachers",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"教师账号"}),n.jsx(be,{to:"/school-admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/codes")?"bg-sky-600/20 text-sky-400":"text-amber-400 font-semibold"}`,children:"本校激活码"})]}),a.role==="Teacher"&&n.jsx(be,{to:"/teacher",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/teacher")?"bg-emerald-600/20 text-emerald-400":"text-slate-300 hover:bg-slate-900"}`,children:"呼叫与回执"})]})]})})},aa=({allowedRoles:a,children:l})=>{const{user:i,isLoading:u}=qs();return u?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户权限..."}):i?a.includes(i.role)?l?n.jsx(n.Fragment,{children:l}):n.jsx(Jd,{}):i.role==="SuperAdmin"?n.jsx(Yt,{to:"/admin",replace:!0}):i.role==="SchoolAdmin"?n.jsx(Yt,{to:"/school-admin",replace:!0}):n.jsx(Yt,{to:"/teacher",replace:!0}):n.jsx(Yt,{to:"/login",replace:!0})},px=()=>{const[a,l]=x.useState(""),[i,u]=x.useState(""),[d,f]=x.useState(null),[m,y]=x.useState(!1),{login:p}=qs(),j=mo(),S=async(k=a,$=i)=>{f(null),y(!0);try{const B=await p(k,$);j(B==="SuperAdmin"?"/admin":B==="SchoolAdmin"?"/school-admin":"/teacher")}catch(B){f(B.message||"登录失败,请检查账号密码")}finally{y(!1)}};return n.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/40 relative overflow-hidden",children:[n.jsx("div",{className:"absolute w-96 h-96 bg-indigo-500/10 rounded-full blur-3xl -top-20 -left-20 pointer-events-none"}),n.jsx("div",{className:"absolute w-96 h-96 bg-violet-500/10 rounded-full blur-3xl -bottom-20 -right-20 pointer-events-none"}),n.jsx("div",{className:"w-full max-w-md relative z-10",children:n.jsxs("div",{className:"glass-panel p-8 border-slate-800",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center mx-auto mb-4 shadow-xl shadow-indigo-500/25",children:n.jsx(io,{className:"w-8 h-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white",children:"ClassNotify 控制台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1.5",children:"智慧教室通知与设备集控一体化系统"})]}),d&&n.jsxs("div",{className:"mb-6 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-sm flex items-center gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),d]}),n.jsxs("form",{onSubmit:k=>{k.preventDefault(),S()},className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsxs("div",{className:"relative",children:[n.jsx(lh,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"text",value:a,onChange:k=>l(k.target.value),placeholder:"请输入账号",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录密码"}),n.jsxs("div",{className:"relative",children:[n.jsx(co,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"password",value:i,onChange:k=>u(k.target.value),placeholder:"请输入密码",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:m?n.jsxs(n.Fragment,{children:[n.jsx(Gt,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在验证身份..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"登 录"}),n.jsx($r,{className:"w-4 h-4"})]})})]})]})})]})},ze=({label:a,variant:l="slate",dot:i=!0,className:u=""})=>{const d={emerald:{bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/20",dotColor:"bg-emerald-400"},amber:{bg:"bg-amber-500/10",text:"text-amber-400",border:"border-amber-500/20",dotColor:"bg-amber-400"},rose:{bg:"bg-rose-500/10",text:"text-rose-400",border:"border-rose-500/20",dotColor:"bg-rose-400"},sky:{bg:"bg-sky-500/10",text:"text-sky-400",border:"border-sky-500/20",dotColor:"bg-sky-400"},slate:{bg:"bg-slate-800/60",text:"text-slate-400",border:"border-slate-700/50",dotColor:"bg-slate-400"},indigo:{bg:"bg-indigo-500/10",text:"text-indigo-400",border:"border-indigo-500/20",dotColor:"bg-indigo-400"}},f=d[l]||d.slate;return n.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium border ${f.bg} ${f.text} ${f.border} ${u}`,children:[i&&n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${f.dotColor}`}),a]})},hs=({title:a,description:l,badge:i,action:u,className:d=""})=>n.jsxs("div",{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-6 mb-6 border-b border-slate-800/80 ${d}`,children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight text-slate-100",children:a}),i]}),l&&n.jsx("p",{className:"mt-1 text-sm text-slate-400",children:l})]}),u&&n.jsx("div",{className:"flex items-center gap-3",children:u})]}),xo=({tabs:a,activeId:l,onChange:i,className:u=""})=>n.jsx("div",{className:`flex items-center gap-1.5 p-1 bg-slate-900 border border-slate-800 rounded-xl overflow-x-auto ${u}`,children:a.map(d=>{const f=d.id===l;return n.jsxs("button",{type:"button",onClick:()=>i(d.id),className:`px-3 py-1.5 rounded-lg text-xs sm:text-sm font-medium transition-all whitespace-nowrap flex items-center gap-1.5 ${f?"bg-slate-800 text-white shadow-sm border border-slate-700/60":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/40"}`,children:[n.jsx("span",{children:d.label}),d.count!==void 0&&n.jsx("span",{className:`px-1.5 py-0.2 rounded-full text-[10px] font-semibold ${f?"bg-slate-700 text-slate-200":"bg-slate-800/80 text-slate-500"}`,children:d.count})]},d.id)})}),Vr=({value:a,onChange:l,placeholder:i="搜索...",className:u=""})=>n.jsxs("div",{className:`relative flex items-center ${u}`,children:[n.jsx(Wr,{className:"w-4 h-4 text-slate-500 absolute left-3 pointer-events-none"}),n.jsx("input",{type:"text",value:a,onChange:d=>l(d.target.value),placeholder:i,className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-8 py-2 text-sm text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50 focus:ring-1 focus:ring-indigo-500/30 transition-colors"}),a&&n.jsx("button",{type:"button",onClick:()=>l(""),className:"absolute right-2.5 p-1 rounded-md text-slate-500 hover:text-slate-300 hover:bg-slate-800 transition-colors",children:n.jsx(Un,{className:"w-3.5 h-3.5"})})]}),ka=({items:a,className:l=""})=>{const[i,u]=x.useState(!1),d=x.useRef(null);return x.useEffect(()=>{const f=y=>{d.current&&!d.current.contains(y.target)&&u(!1)},m=y=>{y.key==="Escape"&&u(!1)};return i&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",m)),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",m)}},[i]),n.jsxs("div",{className:`relative inline-block text-left ${l}`,ref:d,children:[n.jsx("button",{type:"button","aria-label":"更多操作","aria-expanded":i,"aria-haspopup":"true",onClick:()=>u(!i),className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors border border-transparent hover:border-slate-700/60",title:"更多操作",children:n.jsx(S0,{className:"w-4 h-4"})}),i&&n.jsx("div",{className:"absolute right-0 mt-1 w-44 rounded-xl bg-slate-900 border border-slate-800 shadow-2xl py-1 z-30 animate-in fade-in-50 zoom-in-95 duration-100",children:a.map((f,m)=>n.jsxs("button",{type:"button",disabled:f.disabled,onClick:()=>{u(!1),f.onClick()},className:`w-full text-left px-3.5 py-2 text-xs sm:text-sm font-medium flex items-center gap-2.5 transition-colors ${f.danger?"text-rose-400 hover:bg-rose-500/10":"text-slate-300 hover:text-white hover:bg-slate-800"} ${f.disabled?"opacity-40 cursor-not-allowed":""}`,children:[f.icon&&n.jsx("span",{className:"w-4 h-4",children:f.icon}),n.jsx("span",{children:f.label})]},m))})]})},oh=({text:a,label:l="复制",className:i=""})=>{const[u,d]=x.useState(!1),f=async m=>{m.stopPropagation();try{await navigator.clipboard.writeText(a),d(!0),setTimeout(()=>d(!1),1500)}catch{const y=document.createElement("textarea");y.value=a,document.body.appendChild(y),y.select(),document.execCommand("copy"),document.body.removeChild(y),d(!0),setTimeout(()=>d(!1),1500)}};return n.jsx("button",{type:"button","aria-label":u?"已复制":l,onClick:f,className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium transition-all ${u?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 font-semibold":"bg-slate-800 text-slate-300 hover:text-white hover:bg-slate-700/80 border border-slate-700/60"} ${i}`,children:u?n.jsxs(n.Fragment,{children:[n.jsx(ao,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{children:"已复制"})]}):n.jsxs(n.Fragment,{children:[n.jsx(pa,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:l})]})})},ls=({title:a,value:l,subtitle:i,icon:u,badge:d,className:f=""})=>n.jsxs("div",{className:`p-5 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex flex-col justify-between ${f}`,children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs sm:text-sm font-medium text-slate-400",children:a}),u&&n.jsx("div",{className:"p-2 rounded-xl bg-slate-800/80 text-slate-300",children:u})]}),n.jsxs("div",{className:"mt-3 flex items-baseline justify-between gap-2",children:[n.jsx("div",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-white",children:l}),d]}),i&&n.jsx("p",{className:"mt-1 text-xs text-slate-500",children:i})]}),pn=({isOpen:a,onClose:l,title:i,children:u,maxWidth:d="max-w-md",preventClose:f=!1})=>(x.useEffect(()=>{const m=y=>{y.key==="Escape"&&!f&&l()};return a&&document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a,l,f]),a?n.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm animate-in fade-in duration-150",children:n.jsxs("div",{className:`w-full ${d} bg-slate-900 border border-slate-800 rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-150`,onClick:m=>m.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-slate-800/80",children:[n.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-100",children:i}),n.jsx("button",{type:"button","aria-label":"关闭",disabled:f,onClick:()=>{f||l()},className:`p-1 rounded-lg text-slate-400 transition-colors ${f?"opacity-30 cursor-not-allowed":"hover:text-white hover:bg-slate-800"}`,children:n.jsx(Un,{className:"w-5 h-5"})})]}),n.jsx("div",{className:"p-6",children:u})]})}):null),ih=({isOpen:a,onClose:l,onConfirm:i,title:u,description:d,targetName:f,confirmLabel:m="确认执行",loading:y=!1})=>a?n.jsx(pn,{isOpen:a,onClose:l,title:u,maxWidth:"max-w-md",preventClose:y,children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-3 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300",children:[n.jsx(Fn,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),n.jsxs("div",{className:"text-xs sm:text-sm leading-relaxed",children:[f&&n.jsxs("span",{className:"font-semibold text-rose-200",children:["【",f,"】"]}),d]})]}),n.jsxs("div",{className:"flex items-center justify-end gap-3 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:l,disabled:y,className:"px-4 py-2 rounded-xl text-sm font-medium text-slate-300 hover:bg-slate-800 transition-colors",children:"取消"}),n.jsx("button",{type:"button",onClick:i,disabled:y,className:"px-4 py-2 rounded-xl text-sm font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-600/20 transition-all disabled:opacity-50",children:y?"处理中...":m})]})]})}):null,xx=()=>{const[a,l]=x.useState(null),[i,u]=x.useState([]),[d,f]=x.useState([]),[m,y]=x.useState(null),[p,j]=x.useState([]),[S,k]=x.useState(!0),$=async()=>{var L,Y;try{const[Q,J,oe,ie,fe]=await Promise.all([le.getAdminMetrics(),le.getTenants(),le.getAdminNotifications(6),((L=le.getSystemHealth)==null?void 0:L.call(le).catch(()=>null))??Promise.resolve(null),((Y=le.getAuditLogs)==null?void 0:Y.call(le,6).catch(()=>[]))??Promise.resolve([])]);l(Q),u(J),f(oe),ie&&y(ie),fe&&j(fe)}catch(Q){console.error("Failed to load admin dashboard data",Q)}finally{k(!1)}};x.useEffect(()=>{$();const L=setInterval($,1e4);return()=>clearInterval(L)},[]);const B=(a==null?void 0:a.totalDevices)??0,W=(m==null?void 0:m.onlineDevices)??(a==null?void 0:a.onlineDevices)??0,U=(a==null?void 0:a.offlineDevices)??Math.max(0,B-W),I=B>0?Math.round(W/B*100):100;return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"全域云控超管总览",description:"实时掌握全网多校区教学终端连通率、异常事件与核心调度通道",action:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsxs(be,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",children:[n.jsx(jt,{className:"w-4 h-4 text-amber-400"}),"激活码管理"]}),n.jsxs(be,{to:"/admin/broadcast",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all",children:[n.jsx(Hs,{className:"w-4 h-4"}),"全域应急广播"]})]})}),n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"p-5 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"大屏在线率"}),n.jsxs("div",{className:"mt-2 text-2xl sm:text-3xl font-bold tracking-tight text-white",children:[I,"%"]}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-mono mt-0.5",children:[W," / ",B," 台在线"]})]}),n.jsxs("div",{className:"relative w-14 h-14 flex items-center justify-center shrink-0",children:[n.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 36 36",children:[n.jsx("path",{className:"text-slate-800",strokeWidth:"3.5",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),n.jsx("path",{className:"text-emerald-400 transition-all duration-500",strokeDasharray:`${I}, 100`,strokeWidth:"3.5",strokeLinecap:"round",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),n.jsx(Fr,{className:"w-5 h-5 text-emerald-400 absolute"})]})]}),n.jsx(ls,{title:"离线设备",value:S?"-":U,subtitle:U>0?"建议督促校区排查网络":"全网终端运行畅通",icon:n.jsx(Fn,{className:`w-5 h-5 ${U>0?"text-amber-400":"text-slate-400"}`}),badge:U>0?n.jsx(ze,{label:"待恢复",variant:"amber"}):n.jsx(ze,{label:"正常",variant:"emerald"})}),n.jsx(ls,{title:"今日通知 / 点呼",value:S?"-":(a==null?void 0:a.todayNotifications)??0,subtitle:"各校区教师工作台发送",icon:n.jsx(io,{className:"w-5 h-5 text-blue-400"})}),n.jsx(ls,{title:"入驻学校",value:S?"-":(a==null?void 0:a.totalTenants)??i.length,subtitle:"独立多租户隔离",icon:n.jsx(Zt,{className:"w-5 h-5 text-indigo-400"})})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 items-start",children:[n.jsxs("div",{className:"lg:col-span-7 space-y-6",children:[n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[n.jsx("h2",{className:"text-sm font-semibold text-white",children:"核心管控模块"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n.jsxs(be,{to:"/admin/tenants",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-blue-500/10 text-blue-400",children:n.jsx(Zt,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-blue-400",children:"学校租户"}),n.jsx("div",{className:"text-[11px] text-slate-400",children:"校区开通、参数与冻结"})]})]}),n.jsx($r,{className:"w-4 h-4 text-slate-500 group-hover:text-blue-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(be,{to:"/admin/users",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-indigo-500/10 text-indigo-400",children:n.jsx(Us,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-blue-400",children:"用户中枢"}),n.jsx("div",{className:"text-[11px] text-slate-400",children:"多角色账号与密码管控"})]})]}),n.jsx($r,{className:"w-4 h-4 text-slate-500 group-hover:text-blue-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(be,{to:"/admin/devices",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 text-emerald-400",children:n.jsx(Bs,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-blue-400",children:"设备集控"}),n.jsx("div",{className:"text-[11px] text-slate-400",children:"心跳、远程指令与清退"})]})]}),n.jsx($r,{className:"w-4 h-4 text-slate-500 group-hover:text-blue-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(be,{to:"/admin/broadcast",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-rose-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 text-rose-400",children:n.jsx(Hs,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-rose-400",children:"应急广播"}),n.jsx("div",{className:"text-[11px] text-slate-400",children:"全网最高优先极速强插"})]})]}),n.jsx($r,{className:"w-4 h-4 text-slate-500 group-hover:text-rose-400 transition-transform group-hover:translate-x-1"})]})]})]}),n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(Zt,{className:"w-4 h-4 text-indigo-400"}),"入驻校区简况"]}),n.jsx(be,{to:"/admin/tenants",className:"text-xs text-blue-400 hover:underline",children:"管理全部校区"})]}),n.jsx("div",{className:"divide-y divide-slate-800/60",children:i.slice(0,4).map(L=>n.jsxs("div",{className:"py-2.5 flex items-center justify-between text-xs",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-slate-200",children:L.name}),n.jsxs("div",{className:"text-[11px] font-mono text-slate-500",children:[L.id," · ",L.classroomCount," 班级"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-slate-400 text-xs font-mono",children:[L.deviceCount," 设备"]}),n.jsx(ze,{label:L.isActive?"正常":"已冻结",variant:L.isActive?"emerald":"rose"})]})]},L.id))})]})]}),n.jsxs("div",{className:"lg:col-span-5 space-y-6",children:[n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(Fn,{className:"w-4 h-4 text-amber-400"}),"需要关注"]}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"异常终端优先浮出"})]}),U===0?n.jsxs("div",{className:"py-6 text-center text-xs text-slate-400",children:[n.jsx(At,{className:"w-6 h-6 text-emerald-400 mx-auto mb-1.5"}),n.jsx("span",{children:"全网各校区终端运行良好,无异常阻断"})]}):n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"p-3 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300",children:[n.jsxs("div",{className:"font-semibold flex items-center gap-1.5",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400"}),"检测到 ",U," 台大屏终端离线"]}),n.jsx("div",{className:"text-[11px] text-amber-400/80 mt-1",children:"未接收到周期心跳包,可能由于关机或校内网络断开导致。"}),n.jsx("div",{className:"mt-2 text-right",children:n.jsx(be,{to:"/admin/devices?status=offline",className:"text-xs text-amber-400 hover:underline font-semibold",children:"前往设备集控排查 →"})})]})})]}),n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(ho,{className:"w-4 h-4 text-emerald-400"}),"最近安全审计流水"]}),n.jsx(be,{to:"/admin/history",className:"text-xs text-blue-400 hover:underline",children:"完整流水"})]}),n.jsx("div",{className:"space-y-2 text-xs",children:p.length===0?n.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:"暂无审计记录"}):p.map(L=>n.jsxs("div",{className:"p-2.5 rounded-xl bg-slate-950 border border-slate-800/80",children:[n.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[n.jsx("span",{className:"font-semibold text-slate-200",children:L.action}),n.jsx("span",{className:"text-slate-500 font-mono",children:new Date(L.occurredAt).toLocaleTimeString()})]}),n.jsxs("div",{className:"text-[11px] text-slate-400 mt-1 truncate",children:[L.actorUsername||"系统"," · ",L.targetType," ",L.targetId]})]},L.id))})]})]})]})]})},gx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState(!0),[d,f]=x.useState(""),[m,y]=x.useState("all"),[p,j]=x.useState(null),[S,k]=x.useState([]),[$,B]=x.useState(!1),[W,U]=x.useState(null),[I,L]=x.useState(""),[Y,Q]=x.useState(""),[J,oe]=x.useState(!1),[ie,fe]=x.useState(null),[me,X]=x.useState(!1),he=async()=>{try{const g=await le.getAllDevices();l(g)}catch(g){console.error("Failed to load devices",g)}finally{u(!1)}};x.useEffect(()=>{he();const g=setInterval(he,5e3);return()=>clearInterval(g)},[]);const K=async(g,P,se)=>{j(null);try{const M=await le.sendDeviceCommand(g,P,se);j({deviceId:g,message:M.message,success:!0}),he()}catch(M){j({deviceId:g,message:M.message||"远程指令下发失败",success:!1})}},pe=async g=>{if(S.length===0)return;B(!0);let P=0;for(const M of S)try{await le.sendDeviceCommand(M,g),P++}catch{}const se=g==="self_check"?"批量运行自检":"批量刷新配置";j({deviceId:`已选 ${S.length} 台`,message:`${se}指令已成功下发至 ${P} 台大屏终端`,success:!0}),k([]),B(!1),he()},V=g=>{k(P=>P.includes(g)?P.filter(se=>se!==g):[...P,g])},re=g=>{S.length===g.length?k([]):k(g.map(P=>P.deviceId))},Ce=g=>{U(g),L(g.hostname||""),Q(g.classroomId||"")},z=async g=>{if(g.preventDefault(),!!W){oe(!0);try{await le.updateDevice(W.deviceId,{hostname:I.trim()||void 0,classroomId:Y.trim()||void 0}),j({deviceId:W.deviceId,message:"设备信息更新成功",success:!0}),U(null),he()}catch(P){j({deviceId:W.deviceId,message:P.message||"更新设备失败",success:!1})}finally{oe(!1)}}},de=async()=>{if(ie){X(!0);try{await le.decommissionDevice(ie.deviceId),j({deviceId:ie.deviceId,message:"设备已成功清退并注销",success:!0}),fe(null),he()}catch(g){j({deviceId:ie.deviceId,message:g.message||"清退设备失败",success:!1})}finally{X(!1)}}},_=g=>{if(!g)return"从无心跳";const P=Math.floor((Date.now()-new Date(g).getTime())/1e3);return P<10?"刚刚":P<60?`${P} 秒前`:P<3600?`${Math.floor(P/60)} 分钟前`:`${Math.floor(P/3600)} 小时前`},q=[{id:"all",label:"全部设备",count:a.length},{id:"online",label:"在线正常",count:a.filter(g=>g.isOnline).length},{id:"offline",label:"离线需关注",count:a.filter(g=>!g.isOnline).length}],E=a.filter(g=>{if(m==="online"&&!g.isOnline||m==="offline"&&g.isOnline)return!1;if(d.trim()){const P=d.toLowerCase(),se=g.tenantName.toLowerCase().includes(P),M=g.classroomName.toLowerCase().includes(P),ae=g.deviceId.toLowerCase().includes(P),ye=g.hostname&&g.hostname.toLowerCase().includes(P);if(!se&&!M&&!ae&&!ye)return!1}return!0});return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"全网设备集控中心",description:"实时监控教室终端健康心跳与服务状态,支持批量安全自检/刷新配置、单机秒级调控与安全清退",action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{u(!0),he()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(Tt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新"]}),n.jsxs(be,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all",children:[n.jsx(jt,{className:"w-3.5 h-3.5"}),"生成激活码"]})]})}),p&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between text-xs transition-all ${p.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[p.success?n.jsx(At,{className:"w-4 h-4 text-emerald-400 shrink-0"}):n.jsx(mn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsxs("span",{children:["[",p.deviceId,"] ",p.message]})]}),n.jsx("button",{onClick:()=>j(null),className:"text-xs opacity-70 hover:opacity-100 font-medium",children:"关闭"})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsx(xo,{tabs:q,activeId:m,onChange:g=>{y(g),k([])}}),n.jsx("div",{className:"w-full sm:w-72",children:n.jsx(Vr,{value:d,onChange:f,placeholder:"搜索学校、班级、设备编号..."})})]}),S.length>0&&n.jsxs("div",{className:"p-3 bg-blue-950/60 border border-blue-500/40 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-xs shadow-lg animate-in fade-in duration-100",children:[n.jsxs("div",{className:"flex items-center gap-2 text-blue-200",children:[n.jsx(At,{className:"w-4 h-4 text-blue-400 shrink-0"}),n.jsxs("span",{children:["已勾选 ",n.jsx("strong",{children:S.length})," 台教室大屏终端"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{type:"button",disabled:$,onClick:()=>pe("self_check"),className:"px-3 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[n.jsx(Fr,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"批量运行自检"})]}),n.jsxs("button",{type:"button",disabled:$,onClick:()=>pe("refresh_config"),className:"px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 hover:text-white font-medium border border-slate-700 flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[n.jsx(Tt,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"批量刷新配置"})]}),n.jsx("button",{type:"button",disabled:$,onClick:()=>k([]),className:"px-2.5 py-1.5 rounded-xl text-slate-400 hover:text-white transition-colors",children:"取消"})]})]}),n.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[n.jsx("thead",{className:"text-[11px] uppercase tracking-wider text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-3 w-10 text-center",children:n.jsx("input",{type:"checkbox",checked:E.length>0&&S.length===E.length,onChange:()=>re(E),className:"rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer",title:"全选当前列表"})}),n.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"设备编号 / 主机名"}),n.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"运行状态"}),n.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"心跳与 IP"}),n.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"版本"}),n.jsx("th",{className:"py-3.5 px-4 font-semibold text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:E.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:7,className:"text-center py-12 text-xs text-slate-500",children:i?"正在同步设备状态...":"暂无匹配的设备"})}):E.map(g=>{const P=S.includes(g.deviceId);return n.jsxs("tr",{className:`hover:bg-slate-800/25 transition-colors ${P?"bg-blue-600/10":""}`,children:[n.jsx("td",{className:"py-3.5 px-3 text-center",children:n.jsx("input",{type:"checkbox",checked:P,onChange:()=>V(g.deviceId),className:"rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer"})}),n.jsxs("td",{className:"py-3.5 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:g.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:g.tenantName})]}),n.jsxs("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:[n.jsx("div",{children:g.deviceId}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-sans mt-0.5 flex items-center gap-1",children:[n.jsx(Bs,{className:"w-3 h-3 text-slate-500"}),n.jsx("span",{children:g.hostname||"Classroom-PC"})]})]}),n.jsx("td",{className:"py-3.5 px-4",children:n.jsx(ze,{label:g.isOnline?"在线":"离线",variant:g.isOnline?"emerald":"slate"})}),n.jsxs("td",{className:"py-3.5 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:_(g.lastHeartbeat)}),n.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5 font-mono",children:g.remoteIp||"127.0.0.1"})]}),n.jsx("td",{className:"py-3.5 px-4 text-xs",children:n.jsxs("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-300 font-mono text-[11px]",children:["v",g.clientVersion||"2.1.0"]})}),n.jsx("td",{className:"py-3.5 px-4 text-right",children:n.jsx(ka,{items:[{label:"触发自检",icon:n.jsx(Fr,{className:"w-3.5 h-3.5 text-indigo-400"}),onClick:()=>K(g.deviceId,"self_check")},{label:"刷新配置",icon:n.jsx(Tt,{className:"w-3.5 h-3.5 text-sky-400"}),onClick:()=>K(g.deviceId,"refresh_config")},{label:"重启客户端",icon:n.jsx(J0,{className:"w-3.5 h-3.5 text-amber-400"}),onClick:()=>K(g.deviceId,"restart_client")},{label:"编辑信息",icon:n.jsx(nh,{className:"w-3.5 h-3.5 text-slate-300"}),onClick:()=>Ce(g)},{label:"清退设备",icon:n.jsx(Sa,{className:"w-3.5 h-3.5 text-rose-400"}),onClick:()=>fe(g),danger:!0}]})})]},g.deviceId)})})]})})}),W&&n.jsx(pn,{isOpen:!0,onClose:()=>U(null),title:`编辑设备: ${W.deviceId}`,preventClose:J,children:n.jsxs("form",{onSubmit:z,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"计算机主机名 (Hostname)"}),n.jsx("input",{type:"text",value:I,onChange:g=>L(g.target.value),placeholder:"例如:ROOM-801-PC",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属教室编号 (ClassroomId)"}),n.jsx("input",{type:"text",value:Y,onChange:g=>Q(g.target.value),placeholder:"例如:class-801",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 font-mono"})]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",disabled:J,onClick:()=>U(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:J,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all disabled:opacity-50",children:J?"保存中...":"保存更改"})]})]})}),n.jsx(ih,{isOpen:!!ie,onClose:()=>fe(null),onConfirm:de,title:"确认清退大屏设备",targetName:ie?`${ie.classroomName} (${ie.deviceId})`:void 0,description:"清退后该大屏终端将注销授权,无法接收通知与指令,需重新生成激活码方可绑定。",confirmLabel:"确认注销清退",loading:me})]})},vx=()=>{const[a]=yp(),[l,i]=x.useState([]),[u,d]=x.useState([]),[f,m]=x.useState(!0),[y,p]=x.useState(null),[j,S]=x.useState(""),[k,$]=x.useState(""),[B,W]=x.useState(!1),[U,I]=x.useState(""),[L,Y]=x.useState([]),[Q,J]=x.useState(!1),[oe,ie]=x.useState(""),[fe,me]=x.useState(!1),[X,he]=x.useState(""),[K,pe]=x.useState(!1),[V,re]=x.useState(null),Ce=async()=>{try{const[E,g]=await Promise.all([le.getAdminActivationCodes(),le.getTenants()]);i(E),d(g),g.length>0&&!U&&I(g[0].id)}catch(E){console.error("Failed to load activation codes",E)}finally{m(!1)}};x.useEffect(()=>{Ce()},[]),x.useEffect(()=>{const E=a.get("tenantId"),g=a.get("openGenerate")==="true";E&&($(E),I(E),g&&W(!0))},[a]),x.useEffect(()=>{U&&(J(!0),le.getAdminClasses(U).then(E=>{Y(E),E.length>0?(ie(E[0].id),me(!1)):(ie(""),me(!0))}).catch(E=>{console.warn("Could not load classes for tenant:",U,E),Y([]),me(!0)}).finally(()=>J(!1)))},[U]);const z=E=>{navigator.clipboard.writeText(E),p(E),setTimeout(()=>p(null),2e3)},de=async E=>{E.preventDefault();const g=fe?X.trim():oe.trim();if(!U||!g){alert("请选择学校及目标班级");return}pe(!0);try{const P=await le.generateAdminCode(U,g),se=u.find(ae=>ae.id===U),M=L.find(ae=>ae.id===g);re({code:P.code,schoolName:(se==null?void 0:se.name)||U,className:(M==null?void 0:M.displayName)||g}),W(!1),he(""),Ce()}catch(P){alert(P.message||"生成激活码失败")}finally{pe(!1)}},_=async E=>{if(window.confirm(`确定要废弃/删除激活码 [${E}] 吗?废弃后将无法用于设备初始化绑定。`))try{await le.deleteActivationCode(E),Ce()}catch(g){alert(g.message||"删除激活码失败")}},q=l.filter(E=>{const g=!k||E.tenantId===k,P=E.code.toLowerCase().includes(j.toLowerCase())||E.classroomName.toLowerCase().includes(j.toLowerCase())||E.tenantName.toLowerCase().includes(j.toLowerCase());return g&&P});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(jt,{className:"w-4 h-4"})}),n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备激活码大盘"})]}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m(!0),Ce()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(Tt,{className:`w-3.5 h-3.5 ${f?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{re(null),W(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold transition-all shadow-lg shadow-amber-500/20 active:scale-95",children:[n.jsx(us,{className:"w-4 h-4"}),"生成新激活码"]})]})]}),V&&n.jsxs("div",{className:"glass-panel p-5 border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:n.jsx(rh,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-emerald-300",children:"激活码生成成功!"}),n.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["归属:",n.jsx("span",{className:"font-medium text-white",children:V.schoolName})," / ",n.jsx("span",{className:"font-medium text-white",children:V.className}),"(有效期 7 天,一次性硬件绑定)"]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"px-4 py-1.5 rounded-xl bg-slate-900 border border-emerald-500/50 font-mono text-xl font-bold text-emerald-400 tracking-wider",children:V.code}),n.jsx("button",{onClick:()=>z(V.code),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors",children:y===V.code?n.jsxs(n.Fragment,{children:[n.jsx(ao,{className:"w-3.5 h-3.5"}),"已复制"]}):n.jsxs(n.Fragment,{children:[n.jsx(pa,{className:"w-3.5 h-3.5"}),"一键复制"]})})]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Wr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:E=>S(E.target.value),placeholder:"搜索激活码、班级或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Zt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:k,onChange:E=>$(E.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsxs("option",{value:"",children:["全部学校 (",u.length,")"]}),u.map(E=>n.jsxs("option",{value:E.id,children:[E.name," (",E.id,")"]},E.id))]})]}),n.jsxs("div",{className:"ml-auto text-xs text-slate-400",children:["共 ",n.jsx("span",{className:"text-white font-medium",children:q.length})," 个激活码"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:q.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-400",children:n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[n.jsx(jt,{className:"w-8 h-8 text-slate-600"}),n.jsx("div",{className:"text-sm font-medium",children:f?"正在读取激活码...":"暂无匹配的激活码"}),n.jsx("div",{className:"text-xs text-slate-500",children:"点击右上角“生成新激活码”即可为任意学校教室开通绑定码"}),n.jsxs("button",{onClick:()=>W(!0),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium",children:[n.jsx(us,{className:"w-3.5 h-3.5"}),"立即生成激活码"]})]})})}):q.map(E=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-mono font-bold text-indigo-400 text-base",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:E.code}),n.jsx("button",{onClick:()=>z(E.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:y===E.code?n.jsx(ao,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(pa,{className:"w-3.5 h-3.5"})})]})}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:E.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:E.tenantName})]}),n.jsx("td",{className:"py-4 px-4",children:E.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx(At,{className:"w-3 h-3"}),"已激活绑定"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx(Hr,{className:"w-3 h-3"}),"等待激活"]})}),n.jsx("td",{className:"py-4 px-4 text-xs font-mono text-slate-300",children:E.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:E.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-400",children:[new Date(E.expiresAt).toLocaleDateString()," ",new Date(E.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:()=>z(E.code),className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:y===E.code?"已复制":"复制"}),n.jsx("button",{onClick:()=>_(E.code),className:"p-1 rounded text-slate-500 hover:text-rose-400 transition-colors",title:"废弃/删除此激活码",children:n.jsx(Sa,{className:"w-3.5 h-3.5"})})]})})]},E.code))})]})})}),B&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl rounded-2xl animate-in zoom-in-95 duration-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(jt,{className:"w-5 h-5 text-amber-400"}),"生成班级设备激活码"]}),n.jsxs("form",{onSubmit:de,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属学校 / 租户"}),n.jsx("select",{value:U,onChange:E=>I(E.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:u.map(E=>n.jsxs("option",{value:E.id,children:[E.name," (",E.id,") ",E.isActive?"":"[已冻结]"]},E.id))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-slate-300",children:"目标班级"}),n.jsx("button",{type:"button",onClick:()=>me(!fe),className:"text-[11px] text-amber-400 hover:underline",children:fe?"从班级列表选择":"手动输入班级ID"})]}),Q?n.jsxs("div",{className:"text-xs text-slate-400 py-2.5 px-3 bg-slate-900 rounded-xl border border-slate-800 flex items-center gap-2",children:[n.jsx(Tt,{className:"w-3.5 h-3.5 animate-spin"}),"正在读取该校班级列表..."]}):fe?n.jsx("input",{type:"text",value:X,onChange:E=>he(E.target.value),placeholder:"输入班级编号,如 cls_801",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}):L.length>0?n.jsx("select",{value:oe,onChange:E=>ie(E.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:L.map(E=>n.jsxs("option",{value:E.id,children:[E.displayName," (",E.id,")"]},E.id))}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-xs text-amber-400/90 flex items-center gap-1.5",children:[n.jsx(mn,{className:"w-3.5 h-3.5 shrink-0"}),"该校暂无预设班级,请手动输入班级代码:"]}),n.jsx("input",{type:"text",value:X,onChange:E=>he(E.target.value),placeholder:"如 cls_801 或 cls_new",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]})]}),n.jsxs("div",{className:"p-3 bg-slate-900/60 rounded-xl border border-slate-800 text-xs text-slate-400 space-y-1",children:[n.jsx("div",{className:"text-slate-300 font-medium",children:"💡 使用说明:"}),n.jsx("div",{children:"1. 激活码生成后有效期为 7 天;"}),n.jsx("div",{children:"2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>W(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:K,className:"px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold disabled:opacity-50 transition-all shadow-md shadow-amber-500/20",children:K?"生成中...":"立即生成激活码"})]})]})]})})]})},yx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState(!0),[d,f]=x.useState(""),m=async()=>{try{const p=await le.getAdminNotifications(100);l(p)}catch(p){console.error("Failed to load notifications",p)}finally{u(!1)}};x.useEffect(()=>{m();const p=setInterval(m,8e3);return()=>clearInterval(p)},[]);const y=a.filter(p=>p.className.toLowerCase().includes(d.toLowerCase())||p.senderName.toLowerCase().includes(d.toLowerCase())||p.message.toLowerCase().includes(d.toLowerCase())||p.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网呼叫历史与回执审计"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"追踪全网每条通知从下发、教室大屏接收、到学生点击确认的全流程时间戳与 ACK 回执"})]}),n.jsxs("button",{onClick:()=>{u(!0),m()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700 self-start sm:self-auto",children:[n.jsx(Tt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新审计"]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Wr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:p=>f(p.target.value),placeholder:"搜索消息内容、班级或教师姓名...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"目标班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"通知正文"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"发起老师"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"下发时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"回执状态 (ACK)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"确认时间"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:y.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:i?"正在加载审计数据...":"暂无呼叫历史记录"})}):y.map(p=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:p.className}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:p.classId})]}),n.jsxs("td",{className:"py-4 px-4 text-slate-200 max-w-md",children:[n.jsx("div",{className:"font-medium text-sm",children:p.message}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500 mt-0.5",children:p.id})]}),n.jsx("td",{className:"py-4 px-4 text-slate-300 text-xs",children:p.senderName}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(p.createdAt).toLocaleTimeString()}),n.jsxs("td",{className:"py-4 px-4",children:[p.status==="Acknowledged"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(At,{className:"w-3.5 h-3.5"}),"学生已点击确认"]}),p.status==="Delivered"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/30",children:[n.jsx(uo,{className:"w-3.5 h-3.5"}),"已送达教室大屏"]}),p.status==="Sent"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Hr,{className:"w-3.5 h-3.5"}),"云端下发中"]}),p.status==="Timeout"&&n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"超时自动关闭"})]}),n.jsx("td",{className:"py-4 px-4 text-right text-xs text-slate-400",children:p.confirmedAt?n.jsx("span",{className:"text-emerald-400 font-mono",children:new Date(p.confirmedAt).toLocaleTimeString()}):n.jsx("span",{className:"text-slate-600",children:"-"})})]},p.id))})]})})})]})},wx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState(!0),[d,f]=x.useState(""),[m,y]=x.useState(null),[p,j]=x.useState(!1),[S,k]=x.useState({id:"",name:""}),[$,B]=x.useState(!1),[W,U]=x.useState(null),[I,L]=x.useState({name:"",isActive:!0}),[Y,Q]=x.useState(!1),J=async()=>{try{const X=await le.getTenants();l(X)}catch(X){console.error("Failed to load tenants",X)}finally{u(!1)}};x.useEffect(()=>{J()},[]);const oe=async X=>{if(X.preventDefault(),!(!S.id.trim()||!S.name.trim())){B(!0);try{await le.createTenant({id:S.id.trim(),name:S.name.trim()}),y({text:`学校 [${S.name}] 创建成功!`,success:!0}),j(!1),k({id:"",name:""}),J()}catch(he){y({text:he.message||"创建学校失败",success:!1})}finally{B(!1)}}},ie=X=>{U(X),L({name:X.name,isActive:X.isActive})},fe=async X=>{if(X.preventDefault(),!(!W||!I.name.trim())){Q(!0);try{await le.updateTenant(W.id,{name:I.name.trim(),isActive:I.isActive}),y({text:`学校 [${I.name}] 配置已更新`,success:!0}),U(null),J()}catch(he){y({text:he.message||"更新学校配置失败",success:!1})}finally{Q(!1)}}},me=a.filter(X=>X.name.toLowerCase().includes(d.toLowerCase())||X.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"学校租户生命周期管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"统筹多校区租户实体,支持新校区入驻配置、基础信息变更与服务启停冻结"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{u(!0),J()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(Tt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(us,{className:"w-4 h-4"}),"新建学校"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(At,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(mn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:m.text})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Wr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:X=>f(X.target.value),placeholder:"按学校标识代码 (ID) 或名称搜索...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校名称 / 标识码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级总数"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"终端大屏 (在线/总计)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"服务状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"接入时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"管理操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:me.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:i?"正在读取租户列表...":"暂无匹配的学校租户"})}):me.map(X=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 font-bold",children:n.jsx(Zt,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-white",children:X.name}),n.jsx("div",{className:"text-xs text-slate-500 font-mono mt-0.5",children:X.id})]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700",children:[n.jsx(Br,{className:"w-3.5 h-3.5 text-indigo-400"}),n.jsxs("span",{children:[X.classroomCount," 个班级"]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"font-semibold text-emerald-400",children:[X.onlineCount," 在线"]}),n.jsx("span",{className:"text-slate-500",children:"/"}),n.jsxs("span",{className:"text-slate-400",children:[X.deviceCount," 总屏"]})]})}),n.jsx("td",{className:"py-4 px-4",children:X.isActive?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx(At,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"正常运营"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(ma,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"已停用冻结"})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(X.createdAt).toLocaleDateString()}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsxs(be,{to:`/admin/codes?tenantId=${X.id}&openGenerate=true`,className:"px-2.5 py-1.5 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"为此学校生成班级设备激活码",children:[n.jsx(jt,{className:"w-3.5 h-3.5"}),"生成激活码"]}),n.jsxs("button",{onClick:()=>ie(X),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",children:[n.jsx(nh,{className:"w-3 h-3"}),"编辑配置"]})]})})]},X.id))})]})})}),p&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"接入新学校租户"}),n.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校唯一标识代码 (Tenant ID)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: t_beijing_no8 或 bj_highschool",value:S.id,onChange:X=>k({...S,id:X.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"只能包含小写字母、数字和下划线,作为多租户隔离主键不可篡改"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称 (Display Name)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 北京市第四中学",value:S.name,onChange:X=>k({...S,name:X.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:$,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:$?"正在创建...":"确认接入"})]})]})]})}),W&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["编辑学校配置: ",W.id]}),n.jsxs("form",{onSubmit:fe,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称"}),n.jsx("input",{type:"text",required:!0,value:I.name,onChange:X=>L({...I,name:X.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"运营状态"}),n.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!0,onChange:()=>L({...I,isActive:!0}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-emerald-400",children:"正常运营"})]}),n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!1,onChange:()=>L({...I,isActive:!1}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-rose-400",children:"停用冻结 (拒绝该校任何指令)"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>U(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:Y,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:Y?"保存中...":"保存更改"})]})]})]})})]})},bx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState([]),[d,f]=x.useState(!0),[m,y]=x.useState(""),[p,j]=x.useState(""),[S,k]=x.useState(""),[$,B]=x.useState(null),[W,U]=x.useState(!1),[I,L]=x.useState({tenantId:"",username:"",password:"",fullName:"",role:"Teacher"}),[Y,Q]=x.useState(!1),[J,oe]=x.useState(null),[ie,fe]=x.useState(""),[me,X]=x.useState(!1),[he,K]=x.useState(null),pe=async()=>{try{const[_,q]=await Promise.all([le.getUsers(p||void 0,S||void 0),le.getTenants()]);l(_),u(q)}catch(_){console.error("Failed to load user management data",_)}finally{f(!1)}};x.useEffect(()=>{pe()},[p,S]);const V=async _=>{var q;if(_.preventDefault(),!I.tenantId||!I.username||!I.password||!I.fullName){B({text:"请填写所有必填字段",success:!1});return}Q(!0);try{await le.createUser(I),B({text:`用户 [${I.username}] 创建成功!`,success:!0}),U(!1),L({tenantId:((q=i[0])==null?void 0:q.id)||"",username:"",password:"",fullName:"",role:"Teacher"}),pe()}catch(E){B({text:E.message||"创建用户失败",success:!1})}finally{Q(!1)}},re=async _=>{if(_.preventDefault(),!(!J||!ie.trim())){X(!0);try{await le.resetPassword(J.id,ie.trim()),B({text:`用户 [${J.username}] 的密码已重置成功`,success:!0}),oe(null),fe("")}catch(q){B({text:q.message||"重置密码失败",success:!1})}finally{X(!1)}}},Ce=async _=>{const q=!_.isLocked,E=q?`确定要锁定账号 [${_.username}] 吗?锁定后该用户将无法登录系统。`:`确定要解锁账号 [${_.username}] 吗?`;if(window.confirm(E)){K(`lock_${_.id}`);try{await le.setUserLock(_.id,q),B({text:`用户 [${_.username}] 已成功${q?"锁定":"解锁"}`,success:!0}),pe()}catch(g){B({text:g.message||"操作失败",success:!1})}finally{K(null)}}},z=async _=>{if(_.role==="SuperAdmin"){alert("超级管理员账号不可删除");return}if(window.confirm(`警告:确定要永久删除用户 [${_.username} (${_.fullName})] 吗?此操作不可逆!`)){K(`delete_${_.id}`);try{await le.deleteUser(_.id),B({text:`用户 [${_.username}] 已被删除`,success:!0}),pe()}catch(q){B({text:q.message||"删除用户失败",success:!1})}finally{K(null)}}},de=a.filter(_=>_.username.toLowerCase().includes(m.toLowerCase())||_.fullName.toLowerCase().includes(m.toLowerCase())||_.tenantName.toLowerCase().includes(m.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"多租户统一用户中枢"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"全网教职工与校级管理员统一管控,支持跨校账号开户、密码强行重置、异常封禁与权限审计"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{f(!0),pe()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(Tt,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{i.length>0&&!I.tenantId&&L(_=>({..._,tenantId:i[0].id})),U(!0)},className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(us,{className:"w-4 h-4"}),"新建用户"]})]})]}),$&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${$.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[$.success?n.jsx(At,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(mn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:$.text})]}),n.jsx("button",{onClick:()=>B(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Wr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:m,onChange:_=>y(_.target.value),placeholder:"搜索用户名、姓名或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Zt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:p,onChange:_=>j(_.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部学校 (全网)"}),i.map(_=>n.jsxs("option",{value:_.id,children:[_.name," (",_.id,")"]},_.id))]})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Br,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:S,onChange:_=>k(_.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部角色"}),n.jsx("option",{value:"SuperAdmin",children:"平台超级管理员"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员"}),n.jsx("option",{value:"Teacher",children:"普通授课教师"})]})]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"用户姓名 / 登录名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"归属学校"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"角色身份"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"生命周期操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:de.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:d?"正在同步用户中枢...":"暂无匹配的用户"})}):de.map(_=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:_.fullName}),n.jsx("div",{className:"text-xs text-slate-400 font-mono mt-0.5",children:_.username})]}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:_.tenantName}),n.jsx("div",{className:"text-[11px] text-slate-500 font-mono",children:_.tenantId})]}),n.jsx("td",{className:"py-4 px-4",children:_.role==="SuperAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(sh,{className:"w-3 h-3"}),"超级管理员"]}):_.role==="SchoolAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-indigo-500/10 border border-indigo-500/30 text-indigo-400",children:[n.jsx(Zt,{className:"w-3 h-3"}),"校区管理员"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-300",children:[n.jsx(Br,{className:"w-3 h-3"}),"授课老师"]})}),n.jsx("td",{className:"py-4 px-4",children:_.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-rose-500/15 text-rose-400 border border-rose-500/30",children:[n.jsx(co,{className:"w-3 h-3"}),"已锁定封禁"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[n.jsx(At,{className:"w-3 h-3"}),"正常"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:_.lastLoginAt?new Date(_.lastLoginAt).toLocaleString():"尚未登录"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>oe(_),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"强制重置登录密码",children:[n.jsx(jt,{className:"w-3 h-3 text-amber-400"}),"重置密码"]}),_.role!=="SuperAdmin"&&n.jsxs("button",{onClick:()=>Ce(_),disabled:he===`lock_${_.id}`,className:`px-2 py-1 rounded-lg border text-xs font-medium transition-colors inline-flex items-center gap-1 ${_.isLocked?"bg-emerald-600/15 border-emerald-500/30 text-emerald-300 hover:bg-emerald-600/25":"bg-rose-600/15 border-rose-500/30 text-rose-300 hover:bg-rose-600/25"}`,title:_.isLocked?"解除账号锁定":"锁定账号",children:[_.isLocked?n.jsx(th,{className:"w-3 h-3"}):n.jsx(co,{className:"w-3 h-3"}),_.isLocked?"解锁":"锁定"]}),_.role!=="SuperAdmin"&&n.jsx("button",{onClick:()=>z(_),disabled:he===`delete_${_.id}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"删除用户",children:n.jsx(Sa,{className:"w-3.5 h-3.5"})})]})})]},_.id))})]})})}),W&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"开通新用户账号"}),n.jsxs("form",{onSubmit:V,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"归属学校"}),n.jsxs("select",{required:!0,value:I.tenantId,onChange:_=>L({...I,tenantId:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"-- 请选择学校 --"}),i.map(_=>n.jsxs("option",{value:_.id,children:[_.name," (",_.id,")"]},_.id))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户角色"}),n.jsxs("select",{value:I.role,onChange:_=>L({...I,role:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"Teacher",children:"普通授课老师 (Teacher)"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"})]}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"平台超级管理员只可通过系统底层配置文件委任,禁止通过控制台赋予。"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: teacher_li 或 admin_no4",value:I.username,onChange:_=>L({...I,username:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户真实姓名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 李老师",value:I.fullName,onChange:_=>L({...I,fullName:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始登录密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"设置 6 位以上密码",value:I.password,onChange:_=>L({...I,password:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>U(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:Y,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:Y?"正在创建...":"确认开户"})]})]})]})}),J&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["重置用户密码: ",J.username]}),n.jsxs("p",{className:"text-xs text-slate-400",children:["为归属于 [",J.tenantName,"] 的 [",J.fullName,"] 强行设置新密码。"]}),n.jsxs("form",{onSubmit:re,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"请输入新密码",value:ie,onChange:_=>fe(_.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>{oe(null),fe("")},className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:me,className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold shadow-lg shadow-amber-500/25 transition-all disabled:opacity-50",children:me?"重置中...":"确认重置"})]})]})]})})]})},jx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState(!0),[d,f]=x.useState([]),[m,y]=x.useState(!1),[p,j]=x.useState({tenantId:"",title:"⚠️ 全校紧急预警通报",message:"",voice:!0,shake:!0,durationSeconds:30}),[S,k]=x.useState(!1),[$,B]=x.useState(!1),[W,U]=x.useState(null),[I,L]=x.useState(null),[Y,Q]=x.useState(null),J=[{title:"消防紧急疏散演练",content:"全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速有序撤离至操场!",duration:60,shake:!0,voice:!0,icon:T0},{title:"恶劣天气避险通报",content:"气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁前往室外!",duration:45,shake:!0,voice:!0,icon:j0},{title:"临时紧急调度会议",content:"请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学教室内自习。",duration:30,shake:!1,voice:!0,icon:Us},{title:"作息调整离校通知",content:"因突发教学安排,今天下午放学时间临时调整为 16:30,请任课老师提醒学生整理个人物品按时离校。",duration:30,shake:!1,voice:!0,icon:U0}],oe=async()=>{try{const z=await le.getTenants();l(z)}catch(z){console.error("Failed to load tenants",z)}finally{u(!1)}},ie=async()=>{y(!0);try{const z=await le.getAdminNotifications(15);f(z)}catch(z){console.error("Failed to load recent broadcasts",z)}finally{y(!1)}};x.useEffect(()=>{oe(),ie()},[]);const fe=z=>{j(de=>({...de,title:`⚠️ ${z.title}`,message:z.content,durationSeconds:z.duration,shake:z.shake,voice:z.voice}))},me=z=>{if(z.preventDefault(),!p.message.trim()){alert("请输入广播通知正文");return}k(!0)};x.useEffect(()=>{if(!W)return;let z=!1,de;const _=Date.now(),q=async()=>{try{const E=await le.getBroadcastReceiptSummary(W);if(z)return;L(E),!E.completed&&Date.now()-_<6e4&&(de=window.setTimeout(q,2e3))}catch{!z&&Date.now()-_<6e4&&(de=window.setTimeout(q,3e3))}};return q(),()=>{z=!0,de&&clearTimeout(de)}},[W]);const X=async()=>{B(!0);try{const z=await le.sendEmergencyBroadcast({...p,tenantId:p.tenantId||void 0});z.broadcastId&&U(z.broadcastId),Q({dispatchedCount:z.dispatchedCount,targetSchools:z.targetSchools,message:z.message,success:!0,timestamp:new Date().toLocaleTimeString()}),k(!1),j(de=>({...de,message:""})),ie()}catch(z){Q({dispatchedCount:0,targetSchools:0,message:z.message||"应急广播下发失败",success:!1,timestamp:new Date().toLocaleTimeString()}),k(!1)}finally{B(!1)}},he=a.find(z=>z.id===p.tenantId),K=he?he.classroomCount:a.reduce((z,de)=>z+(de.classroomCount||0),0);he?he.deviceCount:a.reduce((z,de)=>z+(de.deviceCount||0),0);const pe=(I==null?void 0:I.targetDevices)??null,V=(I==null?void 0:I.displayed)??0,re=(I==null?void 0:I.pending)??null,Ce=I&&I.targetDevices>0?Math.min(100,Math.round(V/I.targetDevices*100)):0;return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"全域应急广播通道",description:"全网最高优先调度通道,覆盖多校区所有教室大屏终端,支持全屏强置顶与语音播报",badge:n.jsx(ze,{label:"极高优先级",variant:"rose"})}),Y&&n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4 animate-in fade-in duration-150",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[Y.success?n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(At,{className:"w-5 h-5"})}):n.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 text-rose-400 flex items-center justify-center",children:n.jsx(Fn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold text-white",children:Y.success?"紧急广播指令已成功下发至目标教室大屏":"广播下发失败"}),n.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:Y.message})]})]}),n.jsx("button",{type:"button",onClick:()=>{Q(null),U(null),L(null)},className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:n.jsx(Un,{className:"w-4 h-4"})})]}),Y.success&&n.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"relative w-14 h-14 flex items-center justify-center shrink-0",children:[n.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 36 36",children:[n.jsx("path",{className:"text-slate-800",strokeWidth:"3.5",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),n.jsx("path",{className:"text-emerald-400 transition-all duration-500",strokeDasharray:`${Ce}, 100`,strokeWidth:"3.5",strokeLinecap:"round",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),n.jsxs("span",{className:"text-xs font-bold text-white absolute",children:[Ce,"%"]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold text-white",children:"大屏显示达成率"}),n.jsx("div",{className:"text-[11px] text-slate-400 mt-0.5",children:I?`${V} / ${pe} 台大屏已完成现场弹窗`:`广播已调度下发至 ${Y.dispatchedCount||0} 个目标班级,正在等待终端回执...`})]})]}),n.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[n.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-emerald-500/10 border border-emerald-500/20 text-emerald-400",children:[n.jsx("div",{className:"font-bold text-sm",children:V}),n.jsx("div",{className:"text-[10px]",children:"已显示"})]}),n.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-slate-900 border border-slate-800 text-slate-300",children:[n.jsx("div",{className:"font-bold text-sm",children:re!==null?re:"—"}),n.jsx("div",{className:"text-[10px]",children:I?"等待回执":"等待统计"})]}),n.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-slate-900 border border-slate-800 text-slate-400",children:[n.jsx("div",{className:"font-bold text-sm",children:(I==null?void 0:I.failed)??"—"}),n.jsx("div",{className:"text-[10px]",children:"失败/离线"})]})]})]}),Y.success&&a.length>0&&n.jsxs("div",{className:"space-y-2 pt-2 border-t border-slate-800",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"目标校区下达详情"}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:a.map(z=>!p.tenantId||p.tenantId===z.id?n.jsxs("div",{className:"p-2.5 rounded-xl bg-slate-950 border border-slate-800/80 flex items-center justify-between text-xs",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-slate-200",children:z.name}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-mono",children:[z.classroomCount," 间教室 · ",z.deviceCount," 台大屏"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-slate-400 font-medium",children:[n.jsx(Hs,{className:"w-3.5 h-3.5 text-blue-400"}),n.jsx("span",{children:"已调度下发"})]})]},z.id):null)})]})]}),n.jsxs("div",{className:"space-y-2.5",children:[n.jsx("label",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider block",children:"应急广播预设模板(点击快速填装)"}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:J.map((z,de)=>{const _=z.icon;return n.jsxs("button",{type:"button",onClick:()=>fe(z),className:"p-3.5 rounded-xl bg-slate-900 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 text-left transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-slate-200 group-hover:text-blue-400 mb-1",children:[n.jsx(_,{className:"w-4 h-4 text-blue-400 shrink-0"}),n.jsx("span",{children:z.title})]}),n.jsx("p",{className:"text-[11px] text-slate-500 line-clamp-2 leading-relaxed",children:z.content})]},de)})})]}),n.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm",children:n.jsxs("form",{onSubmit:me,className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Zt,{className:"w-3.5 h-3.5 text-blue-400"}),"目标广播校区"]}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:["预计覆盖 ",K," 班级"]})]}),n.jsxs("select",{value:p.tenantId||"",onChange:z=>j({...p,tenantId:z.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors",children:[n.jsx("option",{value:"",children:"🚨 全网所有学校与所有教室大屏 (全域覆盖)"}),a.map(z=>n.jsxs("option",{value:z.id,children:["仅该校: ",z.name," (",z.classroomCount," 班级, ",z.deviceCount," 大屏)"]},z.id))]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1.5",children:[n.jsx(sh,{className:"w-3.5 h-3.5 text-rose-400"}),"广播标题"]}),n.jsx("input",{type:"text",required:!0,value:p.title,onChange:z=>j({...p,title:z.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors",placeholder:"例如: ⚠️ 全校紧急避险预警"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"广播正文内容"}),n.jsx("textarea",{required:!0,rows:3,value:p.message,onChange:z=>j({...p,message:z.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 transition-colors resize-none leading-relaxed",placeholder:"请输入紧急通报具体事项..."})]}),n.jsxs("div",{className:"pt-2 border-t border-slate-800/80 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-slate-300",children:[n.jsx("input",{type:"checkbox",checked:p.voice,onChange:z=>j({...p,voice:z.target.checked}),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),n.jsx(ix,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{children:"TTS 语音朗读"})]}),n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-slate-300",children:[n.jsx("input",{type:"checkbox",checked:p.shake,onChange:z=>j({...p,shake:z.target.checked}),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),n.jsx(Fr,{className:"w-3.5 h-3.5 text-rose-400"}),n.jsx("span",{children:"窗口视效抖动"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-slate-400",children:[n.jsx(Hr,{className:"w-3.5 h-3.5"}),n.jsxs("span",{children:["时长: ",p.durationSeconds,"s"]})]})]}),n.jsxs("button",{type:"submit",disabled:$||!p.message.trim(),className:"px-5 py-2.5 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all flex items-center justify-center gap-2 disabled:opacity-40",children:[n.jsx(uo,{className:"w-4 h-4"}),n.jsx("span",{children:"下发紧急广播"})]})]})]})}),n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(xa,{className:"w-4 h-4 text-blue-400"}),"最近全网广播与呼叫调度记录"]}),n.jsx("button",{onClick:ie,disabled:m,className:"text-xs text-blue-400 hover:underline disabled:opacity-50",children:m?"刷新中...":"刷新"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs",children:[n.jsx("thead",{className:"text-[11px] uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2.5 px-3",children:"发起时间"}),n.jsx("th",{className:"py-2.5 px-3",children:"类型"}),n.jsx("th",{className:"py-2.5 px-3",children:"目标范围"}),n.jsx("th",{className:"py-2.5 px-3",children:"通报内容"}),n.jsx("th",{className:"py-2.5 px-3 text-right",children:"状态"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:d.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"py-8 text-center text-slate-500",children:m?"正在加载历史记录...":"暂无调度记录"})}):d.slice(0,6).map(z=>n.jsxs("tr",{className:"hover:bg-slate-800/25",children:[n.jsx("td",{className:"py-3 px-3 font-mono text-slate-400 whitespace-nowrap",children:new Date(z.createdAt).toLocaleTimeString()}),n.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:z.priority==="Urgent"?n.jsx(ze,{label:"紧急通报",variant:"rose",dot:!1}):n.jsx(ze,{label:"日常呼叫",variant:"slate",dot:!1})}),n.jsx("td",{className:"py-3 px-3 text-white font-medium whitespace-nowrap",children:z.className||"全域广播"}),n.jsx("td",{className:"py-3 px-3 text-slate-300 max-w-xs truncate",children:z.message}),n.jsx("td",{className:"py-3 px-3 text-right whitespace-nowrap",children:z.status==="Cancelled"?n.jsx("span",{className:"text-slate-400",children:"已撤回"}):z.status==="Acknowledged"?n.jsx("span",{className:"text-emerald-400 font-medium",children:"已确认"}):z.status==="Delivered"?n.jsx("span",{className:"text-sky-400",children:"已送达"}):n.jsx("span",{className:"text-slate-400",children:"已发送"})})]},z.id))})]})})]}),S&&n.jsx(pn,{isOpen:!0,onClose:()=>k(!1),title:"全域应急调度二次确认",preventClose:$,children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 text-xs leading-relaxed",children:"⚠️ 确认后,系统将强制穿透目标教室大屏正在进行的多媒体课件,以全屏高优先级弹窗展示并进行语音朗读。"}),n.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1.5",children:[n.jsxs("div",{className:"text-slate-400",children:["广播范围:",n.jsx("span",{className:"text-white font-semibold",children:p.tenantId?he==null?void 0:he.name:`全域覆盖 (${a.length} 所学校)`})]}),n.jsxs("div",{className:"text-slate-400",children:["广播标题:",n.jsx("span",{className:"text-white font-medium",children:p.title})]}),n.jsxs("div",{className:"text-slate-400",children:["广播正文:",n.jsx("span",{className:"text-slate-200",children:p.message})]})]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[n.jsx("button",{type:"button",disabled:$,onClick:()=>k(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"放弃"}),n.jsx("button",{type:"button",disabled:$,onClick:X,className:"px-5 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 flex items-center gap-2 disabled:opacity-50",children:$?n.jsxs(n.Fragment,{children:[n.jsx(Gt,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"下发中..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(uo,{className:"w-4 h-4"}),n.jsx("span",{children:"确认下发"})]})})]})]})})]})},Nx=()=>{const[a,l]=x.useState(null),[i,u]=x.useState([]),[d,f]=x.useState(!0),[m,y]=x.useState(null),[p,j]=x.useState("all"),S=async()=>{f(!0),y(null);try{const[L,Y]=await Promise.all([le.getSchoolOverview(),le.getSchoolDevices()]);l(L),u(Y)}catch(L){y((L==null?void 0:L.message)||"加载学校总览与设备数据失败")}finally{f(!1)}};x.useEffect(()=>{S();const L=Mt.onDeviceStatusChanged(Q=>{u(J=>{const oe=Q.state===1||String(Q.state).toLowerCase()==="online",ie=J.map(me=>me.deviceId===Q.deviceId?{...me,isOnline:oe,lastHeartbeat:Q.lastHeartbeat,clientVersion:Q.agentVersion||me.clientVersion}:me),fe=ie.filter(me=>me.isOnline).length;return l(me=>me?{...me,onlineCount:fe}:null),ie})}),Y=Mt.onHealthReportReceived(Q=>{u(J=>J.map(oe=>oe.deviceId===Q.deviceId?{...oe,healthStatus:Q.overallStatus,lastHeartbeat:Q.timestamp||new Date().toISOString()}:oe))});return()=>{L(),Y()}},[]);const k=(a==null?void 0:a.deviceCount)??i.length,$=(a==null?void 0:a.onlineCount)??i.filter(L=>L.isOnline).length,B=Math.max(0,k-$),W=[{id:"all",label:"全部设备",count:i.length},{id:"online",label:"在线正常",count:i.filter(L=>L.isOnline).length},{id:"offline",label:"离线需关注",count:i.filter(L=>!L.isOnline).length}],I=i.filter(L=>p==="online"?L.isOnline:p==="offline"?!L.isOnline:!0);return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:a!=null&&a.tenantName?`${a.tenantName} · 本校管理后台`:"本校管理后台",description:"实时监控全校各班级多媒体大屏运行状态与科任教师账号",action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(be,{to:"/school-admin/classes",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",children:[n.jsx(Mr,{className:"w-4 h-4 text-sky-400"}),"班级管理"]}),n.jsxs(be,{to:"/school-admin/codes",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all",children:[n.jsx(jt,{className:"w-4 h-4"}),"生成激活码"]})]})}),m&&n.jsxs("div",{className:"p-4 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:S,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(Tt,{className:"w-3.5 h-3.5"}),"重试"]})]}),n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsx(ls,{title:"教学班级",value:d?"-":(a==null?void 0:a.classCount)??0,subtitle:`安装终端 ${k} 台`,icon:n.jsx(Mr,{className:"w-5 h-5 text-indigo-400"})}),n.jsx(ls,{title:"在线终端",value:d?"-":$,subtitle:"正常就绪待接收",icon:n.jsx(Fr,{className:"w-5 h-5 text-emerald-400"}),badge:n.jsx(ze,{label:"正常",variant:"emerald"})}),n.jsx(ls,{title:"离线终端",value:d?"-":B,subtitle:B>0?"建议排查电源或网络":"全校终端连通正常",icon:n.jsx(Fn,{className:`w-5 h-5 ${B>0?"text-amber-400":"text-slate-400"}`}),badge:B>0?n.jsx(ze,{label:"待排查",variant:"amber"}):n.jsx(ze,{label:"全部在线",variant:"slate"})}),n.jsx(ls,{title:"任课教师",value:d?"-":(a==null?void 0:a.teacherCount)??0,subtitle:"已授权控制台账号",icon:n.jsx(Us,{className:"w-5 h-5 text-sky-400"})})]}),B>0&&n.jsxs("div",{className:"p-4 rounded-xl bg-amber-500/10 border border-amber-500/20 text-amber-300 flex items-center justify-between text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx(Fn,{className:"w-4 h-4 text-amber-400 shrink-0"}),n.jsxs("span",{children:["检测到 ",n.jsxs("strong",{children:[B," 台"]})," 教室大屏当前处于离线状态,已为您自动置顶展示,方便排查。"]})]}),n.jsx(be,{to:"/school-admin/codes",className:"text-amber-400 hover:text-amber-300 font-medium underline underline-offset-4",children:"获取安装激活码"})]}),n.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Bs,{className:"w-4 h-4 text-blue-400"}),n.jsx("h2",{className:"text-sm font-semibold text-white",children:"大屏终端在线与健康状态"})]}),n.jsx(xo,{tabs:W,activeId:p,onChange:j})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"班级"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"设备编号"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"在线状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"健康评估"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最近心跳"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"客户端版本"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:d?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(Tt,{className:"w-4 h-4 animate-spin mx-auto mb-2 text-blue-400"}),n.jsx("span",{children:"正在获取大屏状态..."})]})}):I.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:p==="offline"?"全校大屏均在线运行良好":"暂无大屏数据"})}):I.map(L=>n.jsxs("tr",{className:"hover:bg-slate-800/40 transition-colors",children:[n.jsx("td",{className:"py-3.5 px-4 font-semibold text-white",children:L.classroomName||"未分配班级"}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-400",children:L.deviceId}),n.jsx("td",{className:"py-3.5 px-4",children:L.isOnline?n.jsx(ze,{label:"在线",variant:"emerald"}):n.jsx(ze,{label:"离线",variant:"slate"})}),n.jsx("td",{className:"py-3.5 px-4",children:L.healthStatus==="Degraded"?n.jsx(ze,{label:"亚健康",variant:"amber"}):L.isOnline?n.jsx(ze,{label:"健康",variant:"emerald"}):n.jsx(ze,{label:"离线未检",variant:"slate"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:L.lastHeartbeat?new Date(L.lastHeartbeat).toLocaleTimeString():n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsxs("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:["v",L.clientVersion||"2.4.0"]})]},L.deviceId))})]})})]})]})},_x=()=>{const[a,l]=x.useState([]),[i,u]=x.useState([]),[d,f]=x.useState(!0),[m,y]=x.useState(""),[p,j]=x.useState(!1),[S,k]=x.useState(""),[$,B]=x.useState(""),[W,U]=x.useState(""),[I,L]=x.useState(""),[Y,Q]=x.useState(!1),[J,oe]=x.useState(null),[ie,fe]=x.useState(null),me=async()=>{try{const[V,re]=await Promise.all([le.getSchoolClasses(),le.getSchoolDevices().catch(()=>[])]);l(V),u(re)}catch(V){console.error("Failed to load class or device data",V)}finally{f(!1)}};x.useEffect(()=>{me()},[]);const X=async V=>{if(V.preventDefault(),!(!S||!$)){Q(!0);try{await le.createSchoolClass({id:S,displayName:$,grade:W,roomNumber:I}),j(!1),k(""),B(""),U(""),L(""),me()}catch(re){alert(re.message||"创建班级失败")}finally{Q(!1)}}},he=async V=>{fe(V.id);try{const re=await le.generateSchoolCode(V.id);oe({classId:V.id,className:V.displayName,code:re.code})}catch(re){alert(re.message||"生成激活码失败")}finally{fe(null)}},K=V=>i.find(re=>re.classroomId===V),pe=a.filter(V=>{if(!m.trim())return!0;const re=m.toLowerCase();return V.displayName.toLowerCase().includes(re)||V.id.toLowerCase().includes(re)||V.roomNumber&&V.roomNumber.toLowerCase().includes(re)});return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"教学班级管理",description:"维护本校班级档案,管理教室位置与大屏终端绑定状态",action:n.jsxs("button",{type:"button",onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[n.jsx(us,{className:"w-4 h-4"}),"新建教学班"]})}),n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx("div",{className:"w-72",children:n.jsx(Vr,{value:m,onChange:y,placeholder:"搜索班级名称或位置..."})}),n.jsxs("div",{className:"text-xs text-slate-400",children:["共 ",n.jsx("span",{className:"font-semibold text-white",children:pe.length})," 个教学班"]})]}),n.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"教室位置"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"绑定大屏"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"大屏状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最近心跳"}),n.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:d?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(Gt,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),n.jsx("span",{children:"正在加载班级数据..."})]})}):pe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:m?"未找到匹配的班级":"暂无教学班,点击右上角新建"})}):pe.map(V=>{const re=K(V.id);return n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsxs("td",{className:"py-3.5 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:V.displayName}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:V.id})]}),n.jsx("td",{className:"py-3.5 px-4 text-slate-300",children:V.roomNumber||V.grade||n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-3.5 px-4",children:re?n.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs text-slate-200",children:[n.jsx(Bs,{className:"w-3.5 h-3.5 text-blue-400 shrink-0"}),n.jsx("span",{children:re.deviceId})]}):n.jsx("span",{className:"text-slate-500 text-xs",children:"未绑定大屏"})}),n.jsx("td",{className:"py-3.5 px-4",children:re?re.isOnline?n.jsx(ze,{label:"在线",variant:"emerald"}):n.jsx(ze,{label:"离线",variant:"slate"}):n.jsxs("button",{type:"button",onClick:()=>he(V),className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-blue-600/10 hover:bg-blue-600/20 text-blue-400 border border-blue-500/20 transition-colors",children:[n.jsx(jt,{className:"w-3 h-3"}),n.jsx("span",{children:"立即绑定"})]})}),n.jsx("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:re!=null&&re.lastHeartbeat?new Date(re.lastHeartbeat).toLocaleTimeString():n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-3.5 px-4 text-right",children:n.jsx(ka,{items:[{label:"生成安装激活码",icon:n.jsx(jt,{className:"w-4 h-4 text-blue-400"}),onClick:()=>he(V)}]})})]},V.id)})})]})})}),J&&n.jsx(pn,{isOpen:!0,onClose:()=>oe(null),title:`大屏安装激活码 · ${J.className}`,children:n.jsxs("div",{className:"space-y-4 text-center py-2",children:[n.jsx("p",{className:"text-xs text-slate-400",children:"请在班级教室大屏运行客户端安装程序,并输入以下 8 位激活码完成绑定:"}),n.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex items-center justify-center gap-3",children:[n.jsx("span",{className:"font-mono text-2xl font-bold tracking-widest text-blue-400",children:J.code}),n.jsx(oh,{text:J.code,label:"复制"})]}),n.jsx("p",{className:"text-[11px] text-slate-500",children:"激活码 24 小时内有效,完成一次硬件绑定后将自动核销。"}),n.jsx("div",{className:"pt-2",children:n.jsx("button",{type:"button",onClick:()=>oe(null),className:"w-full py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors",children:"完成"})})]})}),p&&n.jsx(pn,{isOpen:!0,onClose:()=>j(!1),title:"新建教学班级",children:n.jsxs("form",{onSubmit:X,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"班级编号 (唯一识别码)"}),n.jsx("input",{type:"text",value:S,onChange:V=>k(V.target.value),placeholder:"如 cls_801 或 c_eight_1",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"班级显示名称"}),n.jsx("input",{type:"text",value:$,onChange:V=>B(V.target.value),placeholder:"如 八年级(1)班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"年级 (可选)"}),n.jsx("input",{type:"text",value:W,onChange:V=>U(V.target.value),placeholder:"如 初二 / 高一",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"教室位置 (可选)"}),n.jsx("input",{type:"text",value:I,onChange:V=>L(V.target.value),placeholder:"如 教学楼 301",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:Y,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:Y?"创建中...":"确认创建"})]})]})})]})},Sx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState(!0),[d,f]=x.useState("all"),[m,y]=x.useState(""),[p,j]=x.useState(!1),[S,k]=x.useState(""),[$,B]=x.useState(""),[W,U]=x.useState(""),[I,L]=x.useState(!1),[Y,Q]=x.useState(null),[J,oe]=x.useState(""),[ie,fe]=x.useState(!1),me=x.useRef(null),[X,he]=x.useState(null),[K,pe]=x.useState(!1),[V,re]=x.useState(null),Ce=(M,ae)=>{re({type:M,text:ae}),setTimeout(()=>{re(ye=>(ye==null?void 0:ye.text)===ae?null:ye)},4e3)},z=async()=>{try{const M=await le.getSchoolTeachers();l(M)}catch(M){Ce("error",(M==null?void 0:M.message)||"加载教师列表失败")}finally{u(!1)}};x.useEffect(()=>{z()},[]),x.useEffect(()=>{Y&&me.current&&setTimeout(()=>{var M;return(M=me.current)==null?void 0:M.focus()},100)},[Y]);const de=async M=>{if(M.preventDefault(),!(!S||!$||!W)){if($.length<8){alert("密码长度不能少于 8 位");return}L(!0);try{await le.createSchoolTeacher({username:S,password:$,fullName:W,role:"Teacher"}),j(!1),k(""),B(""),U(""),Ce("success",`教师账号 ${W} 开设成功`),z()}catch(ae){alert(ae.message||"创建教师账号失败")}finally{L(!1)}}},_=async M=>{if(M.preventDefault(),!(!Y||!J)){if(J.length<8){alert("根据系统安全基线,密码长度不能少于 8 位");return}fe(!0);try{await le.resetSchoolTeacherPassword(Y.id,J),Ce("success",`已成功将教师 [${Y.fullName}] 的密码重置`),Q(null),oe("")}catch(ae){alert(ae.message||"重置密码失败")}finally{fe(!1)}}},q=async()=>{if(!X)return;pe(!0);const M=!X.isLocked;try{await le.setSchoolTeacherLock(X.id,M),Ce("success",`已成功${M?"停用":"启用"}教师 [${X.fullName}] 账号`),he(null),z()}catch(ae){alert(ae.message||"操作失败")}finally{pe(!1)}},E=a.filter(M=>!M.isLocked).length,g=a.filter(M=>M.isLocked).length,P=[{id:"all",label:"全部教师",count:a.length},{id:"active",label:"正常使用",count:E},{id:"locked",label:"已停用",count:g}],se=a.filter(M=>{if(d==="active"&&M.isLocked||d==="locked"&&!M.isLocked)return!1;if(m.trim()){const ae=m.toLowerCase();return M.fullName.toLowerCase().includes(ae)||M.username.toLowerCase().includes(ae)}return!0});return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"教师账号管理",description:"管理本校任课教师账号登录凭证与权限状态",action:n.jsxs("button",{type:"button",onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[n.jsx(us,{className:"w-4 h-4"}),"开设教师账号"]})}),V&&n.jsxs("div",{className:`p-3.5 rounded-xl border text-xs flex items-center justify-between transition-all ${V.type==="success"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[V.type==="success"?n.jsx(At,{className:"w-4 h-4 text-emerald-400 shrink-0"}):n.jsx(Fn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:V.text})]}),n.jsx("button",{onClick:()=>re(null),className:"text-slate-400 hover:text-white",children:n.jsx(Un,{className:"w-3.5 h-3.5"})})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsx(xo,{tabs:P,activeId:d,onChange:f}),n.jsx("div",{className:"w-full sm:w-64",children:n.jsx(Vr,{value:m,onChange:y,placeholder:"搜索教师姓名或登录名..."})})]}),n.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"教师姓名"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"登录账号"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"身份角色"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:i?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(Gt,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),n.jsx("span",{children:"正在加载教师列表..."})]})}):se.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:m?"未找到符合条件的教师":"暂无教师数据"})}):se.map(M=>n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsxs("td",{className:"py-3.5 px-4 font-semibold text-white flex items-center gap-2",children:[n.jsx(Br,{className:"w-4 h-4 text-emerald-400 shrink-0"}),n.jsx("span",{children:M.fullName})]}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:M.username}),n.jsx("td",{className:"py-3.5 px-4 text-xs",children:M.role==="SchoolAdmin"?n.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-400 border border-blue-500/20 text-xs",children:"学校管理员"}):n.jsx("span",{className:"px-2 py-0.5 rounded-full bg-slate-800 text-slate-300 border border-slate-700/60 text-xs",children:"任课教师"})}),n.jsx("td",{className:"py-3.5 px-4",children:M.isLocked?n.jsx(ze,{label:"已停用",variant:"rose"}):n.jsx(ze,{label:"正常",variant:"emerald"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:M.lastLoginAt?new Date(M.lastLoginAt).toLocaleString():n.jsxs("span",{className:"text-slate-600 flex items-center gap-1",children:[n.jsx(Hr,{className:"w-3 h-3"}),"从未登录"]})}),n.jsx("td",{className:"py-3.5 px-4 text-right",children:M.role==="Teacher"?n.jsx(ka,{items:[{label:"重置登录密码",icon:n.jsx(jt,{className:"w-4 h-4 text-blue-400"}),onClick:()=>{Q(M),oe("")}},{label:M.isLocked?"启用账号":"停用账号",icon:M.isLocked?n.jsx(th,{className:"w-4 h-4 text-emerald-400"}):n.jsx(co,{className:"w-4 h-4 text-rose-400"}),danger:!M.isLocked,onClick:()=>he(M)}]}):n.jsx("span",{className:"text-slate-600 text-xs",children:"-"})})]},M.id))})]})})}),Y&&n.jsx(pn,{isOpen:!0,onClose:()=>Q(null),title:`重置教师密码 · ${Y.fullName}`,children:n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[n.jsx("p",{className:"text-xs text-slate-400",children:"重置密码将立即终止该教师当前的在线会话,下次登录必须使用新密码:"}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码(至少 8 位)"}),n.jsx("input",{ref:me,type:"password",value:J,onChange:M=>oe(M.target.value),placeholder:"请输入不少于 8 位的新密码",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0,minLength:8})]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>Q(null),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:ie||J.length<8,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:ie?"正在重置...":"确认重置密码"})]})]})}),X&&n.jsx(ih,{isOpen:!0,onClose:()=>he(null),onConfirm:q,loading:K,title:X.isLocked?"恢复教师账号权限?":"停用该教师账号?",targetName:X.fullName,description:X.isLocked?"启用后,该教师将可以正常登录教师工作台并向班级大屏发送呼叫通知。":"停用后,该教师所有活跃登录会话将立即注销,无法再向大屏发起任何呼叫。历史通知与审计记录不受影响。",confirmLabel:X.isLocked?"确认启用":"确认停用账号"}),p&&n.jsx(pn,{isOpen:!0,onClose:()=>j(!1),title:"开设任课教师账号",children:n.jsxs("form",{onSubmit:de,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"教师真实姓名"}),n.jsx("input",{type:"text",value:W,onChange:M=>U(M.target.value),placeholder:"如 张老师、王建国",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),n.jsx("input",{type:"text",value:S,onChange:M=>k(M.target.value),placeholder:"建议使用手机号或拼音如 teacher_zhang",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始密码(至少 8 位)"}),n.jsx("input",{type:"password",value:$,onChange:M=>B(M.target.value),placeholder:"设置该教师首次登录的初始密码",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0,minLength:8})]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:I,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:I?"开设中...":"确认开设"})]})]})})]})},kx=()=>{const[a,l]=x.useState([]),[i,u]=x.useState([]),[d,f]=x.useState(!0),[m,y]=x.useState(null),[p,j]=x.useState("all"),[S,k]=x.useState(""),[$,B]=x.useState(!1),[W,U]=x.useState(""),[I,L]=x.useState(!1),[Y,Q]=x.useState(null),J=async()=>{f(!0),y(null);try{const[K,pe]=await Promise.all([le.getSchoolCodes(),le.getSchoolClasses()]);l(K),u(pe),pe.length>0&&!W&&U(pe[0].id)}catch(K){y((K==null?void 0:K.message)||"加载本校激活码数据失败")}finally{f(!1)}};x.useEffect(()=>{J()},[]);const oe=async K=>{if(K.preventDefault(),!!W){L(!0),Q(null);try{await le.generateSchoolCode(W),B(!1),J()}catch(pe){Q((pe==null?void 0:pe.message)||"生成激活码失败")}finally{L(!1)}}},ie=a.filter(K=>!K.isUsed&&new Date(K.expiresAt).getTime()>Date.now()).length,fe=a.filter(K=>K.isUsed).length,me=a.filter(K=>!K.isUsed&&new Date(K.expiresAt).getTime()<=Date.now()).length,X=[{id:"all",label:"全部",count:a.length},{id:"pending",label:"待激活 (可用)",count:ie},{id:"used",label:"已绑定",count:fe},{id:"expired",label:"已过期",count:me}],he=a.filter(K=>{const pe=!K.isUsed&&new Date(K.expiresAt).getTime()<=Date.now();if(p==="pending"&&(K.isUsed||pe)||p==="used"&&!K.isUsed||p==="expired"&&!pe)return!1;if(S.trim()){const V=S.toLowerCase(),re=K.code.toLowerCase().includes(V),Ce=(K.classroomName||K.classroomId).toLowerCase().includes(V);if(!re&&!Ce)return!1}return!0});return n.jsxs("div",{className:"space-y-6",children:[n.jsx(hs,{title:"本校教室终端激活码",description:"生成与管理本校教室大屏安装所需的 8 位一次性硬件绑定激活码",action:n.jsxs("button",{type:"button",onClick:()=>{Q(null),B(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[n.jsx(us,{className:"w-4 h-4"}),"生成新激活码"]})}),m&&n.jsxs("div",{className:"p-3.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:J,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(Tt,{className:"w-3.5 h-3.5"}),"重试"]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsx(xo,{tabs:X,activeId:p,onChange:j}),n.jsx("div",{className:"w-full sm:w-64",children:n.jsx(Vr,{value:S,onChange:k,placeholder:"搜索激活码或班级..."})})]}),n.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"8位激活码"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"绑定班级"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"绑定设备 ID"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"有效期"}),n.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/60",children:d?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(Gt,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),n.jsx("span",{children:"正在加载激活码..."})]})}):he.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:S?"未找到符合条件的激活码":"暂无激活码,点击右上角生成"})}):he.map(K=>{const pe=!K.isUsed&&new Date(K.expiresAt).getTime()<=Date.now();return n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsx("td",{className:"py-3.5 px-4 font-mono font-bold text-blue-400 text-sm",children:K.code}),n.jsxs("td",{className:"py-3.5 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:K.classroomName||K.classroomId}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:K.classroomId})]}),n.jsx("td",{className:"py-3.5 px-4",children:K.isUsed?n.jsx(ze,{label:"已绑定",variant:"slate"}):pe?n.jsx(ze,{label:"已过期",variant:"rose"}):n.jsx(ze,{label:"待激活",variant:"emerald"})}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-400",children:K.usedByDeviceId||n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:new Date(K.expiresAt).toLocaleDateString()}),n.jsx("td",{className:"py-3.5 px-4 text-right",children:n.jsx(oh,{text:K.code,label:"复制"})})]},K.code)})})]})})}),$&&n.jsx(pn,{isOpen:!0,onClose:()=>B(!1),title:"生成本校班级设备激活码",children:n.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[Y&&n.jsx("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-xs text-rose-300",children:Y}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"选择目标班级"}),i.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-3 bg-amber-500/10 rounded-xl border border-amber-500/20",children:"暂无可分配班级,请先前往【班级管理】新建班级"}):n.jsx("select",{value:W,onChange:K=>U(K.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors",required:!0,children:i.map(K=>n.jsxs("option",{value:K.id,children:[K.displayName," (",K.roomNumber||K.id,")"]},K.id))})]}),n.jsx("p",{className:"text-[11px] text-slate-500 leading-relaxed",children:"💡 激活码生成后有效期为 24 小时。在教室大屏安装客户端并成功绑定后,该激活码将自动核销。"}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>B(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:I||!W,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:I?"生成中...":"立即生成"})]})]})})]})};function ca(a){if(typeof a=="string")switch(a.toLowerCase()){case"acknowledged":case"confirmed":return"Acknowledged";case"delivered":return"Delivered";case"sent":return"Sent";case"cancelled":case"canceled":return"Cancelled";case"timeout":return"Timeout";case"failed":return"Failed";default:return"Sent"}switch(a){case 5:return"Cancelled";case 2:return"Acknowledged";case 1:return"Delivered";case 0:return"Sent";case 3:return"Timeout";case 4:return"Failed";default:return"Sent"}}const Cx=[],Ex=[{label:"到办公室",text:"请到教师办公室一趟。"},{label:"下楼集合",text:"请立即到楼下操场集合整队。"},{label:"家长来了",text:"校门口有家长找,请前往传达室。"},{label:"带作业本",text:"请收齐各科作业本送至办公室。"},{label:"课间回来",text:"预备铃已响,请迅速回教室内就坐。"},{label:"自习纪律",text:"请保持教室内安静自习,班干部负责维护纪律。"}],Tx=()=>{const{user:a}=qs(),[l,i]=x.useState([]),[u,d]=x.useState(""),[f,m]=x.useState(""),[y,p]=x.useState(""),[j,S]=x.useState(!1),[k,$]=x.useState(null),[B,W]=x.useState(!0),[U,I]=x.useState(!0),[L,Y]=x.useState(!1),[Q,J]=x.useState(15),[oe,ie]=x.useState(!1),[fe,me]=x.useState(!1),X=D=>!(a!=null&&a.tenantId)||!(a!=null&&a.userId)||!D?null:`classnotify:recentStudents:${a.tenantId}:${a.userId}:${D}`,[he,K]=x.useState(Cx);x.useEffect(()=>{if(!u)return;const D=X(u);if(!D){K([]);return}try{const ge=localStorage.getItem(D);K(ge?JSON.parse(ge):[])}catch{K([])}},[u,a==null?void 0:a.tenantId,a==null?void 0:a.userId]);const[pe,V]=x.useState([]),[re,Ce]=x.useState(50),[z,de]=x.useState(!1),[_,q]=x.useState(!0),[E,g]=x.useState(!0),[P,se]=x.useState(null),[M,ae]=x.useState("all"),[ye,Ie]=x.useState(""),[_e,Re]=x.useState(null),[et,gn]=x.useState(null),[Qs,Hn]=x.useState(!1),[fs,ms]=x.useState(null),[Wn,en]=x.useState(1),[tn,vn]=x.useState(null),[nn,sn]=x.useState(!1),ps=x.useRef(l);x.useEffect(()=>{ps.current=l},[l]);const Ks=async()=>{g(!0),se(null);try{const D=await le.getTeacherClasses();i(D),D.length>0&&!u&&d(D[0].id);const ge=await le.getTeacherHistory(void 0,re);V(ge.map(Be=>({...Be,status:ca(Be.status)}))),ge.length{const D=re+50;de(!0);try{const ge=await le.getTeacherHistory(void 0,D);V(ge.map(Be=>({...Be,status:ca(Be.status)}))),Ce(D),ge.length{Ks()},[]),x.useEffect(()=>{const D=Mt.onAckReceiptReceived(Ee=>{V(He=>He.map(Qe=>{if(Qe.id===Ee.messageId){const ft=ca(Ee.status);return{...Qe,status:ft,confirmedAt:Ee.timestamp||Qe.confirmedAt||new Date().toISOString()}}return Qe}))}),ge=Mt.onNewNotificationBroadcast(Ee=>{V(He=>{if(He.some(mt=>mt.id===Ee.id))return He;const Qe=ps.current.find(mt=>mt.id===Ee.classId);return[{id:Ee.id,tenantId:Ee.tenantId,classId:Ee.classId,className:(Qe==null?void 0:Qe.displayName)||Ee.classId,senderName:"教师",message:Ee.message,priority:Ee.type===2?"Urgent":"Normal",createdAt:Ee.createdAt,status:"Sent"},...He]})}),Be=typeof Mt.onNotificationCancelled=="function"?Mt.onNotificationCancelled(Ee=>{V(He=>He.map(Qe=>Qe.id===Ee?{...Qe,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:Qe))}):()=>{};return()=>{typeof D=="function"&&D(),typeof ge=="function"&&ge(),typeof Be=="function"&&Be()}},[]);const Qr=D=>{if(j&&y.trim().length>0&&!window.confirm("当前输入框已有手写内容,确定使用模版覆盖吗?"))return;const ge=f.trim();p(ge?`${ge},${D.text}`:D.text),S(!1)},Kr=D=>{m(D),!j||!y.trim()?(p(`${D},请到教师办公室一趟。`),S(!1)):y.includes(D)||p(`${D},${y}`)},Js=async D=>{if(D.preventDefault(),!(!u||!y.trim())){ie(!0),$(null);try{const ge=l.find(ft=>ft.id===u),Be=f.trim()?`🔔 老师呼叫: ${f.trim()}`:`📢 ${(ge==null?void 0:ge.displayName)||"班级"}通知`,Ee=await le.sendNotification({classId:u,studentName:f.trim()||void 0,title:Be,message:y.trim(),type:L?2:0,voice:B,shake:U,durationSeconds:Q}),He=f.trim();He&&u&&K(ft=>{const mt=[He,...ft.filter(Nt=>Nt!==He)].slice(0,8);try{const Nt=X(u);Nt&&localStorage.setItem(Nt,JSON.stringify(mt))}catch{}return mt});const Qe=y.trim();p(""),m(""),S(!1),$(null),Ee!=null&&Ee.messageId&&V(ft=>ft.some(Nt=>Nt.id===Ee.messageId)?ft:[{id:Ee.messageId,tenantId:"",classId:u,className:(ge==null?void 0:ge.displayName)||u,senderName:"教师",message:Qe,priority:L?"Urgent":"Normal",createdAt:new Date().toISOString(),status:"Sent"},...ft])}catch(ge){$((ge==null?void 0:ge.message)||"呼叫发送失败,请检查网络或稍后重试")}finally{ie(!1)}}},xs=async()=>{if(tn){sn(!0);try{await le.cancelNotification(tn.id),V(D=>D.map(ge=>ge.id===tn.id?{...ge,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:ge)),vn(null)}catch(D){alert(D.message||"提前关闭通知失败")}finally{sn(!1)}}},Jr=async(D,ge,Be,Ee)=>{Re({notificationId:D,deviceId:ge,className:Be,capturedAt:Ee}),Hn(!0),ms(null),gn(null),en(1);try{const He=await le.getVisualReceiptBlob(D,ge),Qe=URL.createObjectURL(He);gn(Qe)}catch(He){ms((He==null?void 0:He.message)||"获取视觉核验图像失败")}finally{Hn(!1)}},Vn=()=>{et&&URL.revokeObjectURL(et),gn(null),Re(null),ms(null),en(1)},rn=pe.filter(D=>{if(M!=="all"&&D.classId!==M)return!1;if(ye.trim()){const ge=ye.toLowerCase(),Be=D.message.toLowerCase().includes(ge),Ee=D.className.toLowerCase().includes(ge);if(!Be&&!Ee)return!1}return!0}),go=l.slice(0,4),Xs=l.slice(4);return n.jsxs("div",{className:"space-y-5",children:[n.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-slate-800/80",children:n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight text-white flex items-center gap-2.5",children:"教师呼叫工作台"}),n.jsx("p",{className:"text-xs sm:text-sm text-slate-400 mt-1",children:"秒级定向呼叫教室大屏,支持 TTS 朗读、视觉核验与实时送达回执"})]})}),P&&n.jsxs("div",{className:"p-3.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:P})]}),n.jsxs("button",{onClick:Ks,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(Tt,{className:"w-3.5 h-3.5"}),"重试"]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 items-start",children:[n.jsxs("div",{className:"lg:col-span-5 bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-5",children:[n.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800/70",children:[n.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:"快速发送呼叫"}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"3秒极速触达"})]}),n.jsxs("form",{onSubmit:Js,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标班级"}),l.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-2.5 bg-amber-500/10 rounded-xl border border-amber-500/20",children:"暂无关联班级,请联系管理员分配"}):n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:go.map(D=>{const ge=u===D.id;return n.jsx("button",{type:"button",onClick:()=>d(D.id),className:`px-3 py-2 rounded-xl text-left text-xs font-medium border transition-all flex items-center justify-between ${ge?"bg-blue-600/20 border-blue-500/60 text-white shadow-sm":"bg-slate-950/70 border-slate-800 text-slate-300 hover:bg-slate-800 hover:text-white"}`,children:n.jsx("span",{className:"truncate",children:D.displayName})},D.id)})}),Xs.length>0&&n.jsxs("div",{className:"relative",children:[n.jsxs("select",{value:u,onChange:D=>d(D.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-300 focus:outline-none focus:border-blue-500 appearance-none pr-8 cursor-pointer",children:[n.jsx("option",{value:"",disabled:!0,children:"选择其他班级..."}),Xs.map(D=>n.jsxs("option",{value:D.id,children:[D.displayName," (",D.roomNumber||D.id,")"]},D.id))]}),n.jsx(Ld,{className:"w-3.5 h-3.5 text-slate-500 absolute right-3 top-2.5 pointer-events-none"})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsxs("label",{className:"text-xs font-medium text-slate-300 flex items-center gap-1",children:[n.jsx(lh,{className:"w-3.5 h-3.5 text-slate-400"}),"呼叫对象(学生姓名)"]}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"可选,留空则为全班"})]}),he.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:he.slice(0,6).map(D=>n.jsx("button",{type:"button",onClick:()=>Kr(D),className:`px-2 py-0.5 rounded-lg text-xs transition-colors ${f===D?"bg-blue-600 text-white font-medium":"bg-slate-950 text-slate-400 hover:text-slate-200 hover:bg-slate-800 border border-slate-800"}`,children:D},D))}),n.jsx("input",{type:"text",value:f,onChange:D=>m(D.target.value),placeholder:"点击上方学生姓名或直接输入...",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs placeholder:text-slate-600 focus:outline-none focus:border-blue-500 transition-colors"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1",children:[n.jsx(rh,{className:"w-3.5 h-3.5 text-amber-400"}),"快捷通知短语"]}),n.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Ex.map(D=>n.jsx("button",{type:"button",onClick:()=>Qr(D),className:"px-2.5 py-1.5 rounded-xl bg-slate-950 border border-slate-800 text-xs text-slate-300 hover:text-white hover:bg-slate-800 hover:border-slate-700 transition-all truncate text-center font-medium",title:D.text,children:D.label},D.label))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("label",{className:"text-xs font-medium text-slate-300",children:"通知内容"}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:[y.length,"/200"]})]}),n.jsx("textarea",{rows:3,value:y,onChange:D=>{p(D.target.value.slice(0,200)),S(!0)},placeholder:"点击上方模板快速生成,或直接输入通知内容...",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs placeholder:text-slate-600 focus:outline-none focus:border-blue-500 transition-colors resize-none",required:!0}),k&&n.jsxs("div",{className:"mt-2 p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(mn,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:k})]}),n.jsx("button",{type:"button",onClick:()=>$(null),className:"text-rose-400 hover:text-white p-0.5",children:n.jsx(Un,{className:"w-3.5 h-3.5"})})]})]}),n.jsxs("div",{className:"pt-2 border-t border-slate-800/80",children:[n.jsxs("button",{type:"button",onClick:()=>me(!fe),className:"w-full flex items-center justify-between text-xs text-slate-400 hover:text-slate-200 transition-colors py-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5 font-medium",children:[fe?n.jsx(Ld,{className:"w-3.5 h-3.5 text-slate-400"}):n.jsx(x0,{className:"w-3.5 h-3.5 text-slate-400"}),"播报与显示设置"]}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:[B?"语音开启":"静音"," · ",U?"震屏":"无震"," · ",Q,"秒"]})]}),fe&&n.jsxs("div",{className:"mt-3 p-3 rounded-xl bg-slate-950 border border-slate-800/80 space-y-3 animate-in fade-in duration-100",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-2 rounded-lg bg-slate-900 border border-slate-800 hover:bg-slate-850",children:[n.jsx("input",{type:"checkbox",checked:B,onChange:D=>W(D.target.checked),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),n.jsx("span",{className:"text-slate-300",children:"TTS 语音朗读"})]}),n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-2 rounded-lg bg-slate-900 border border-slate-800 hover:bg-slate-850",children:[n.jsx("input",{type:"checkbox",checked:U,onChange:D=>I(D.target.checked),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),n.jsx("span",{className:"text-slate-300",children:"窗口抖动震颤"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300 pt-1",children:[n.jsx("span",{children:"停留时长"}),n.jsx("div",{className:"flex items-center gap-1",children:[10,15,30].map(D=>n.jsxs("button",{type:"button",onClick:()=>J(D),className:`px-2.5 py-0.5 rounded-lg text-xs font-mono transition-colors ${Q===D?"bg-blue-600 text-white font-semibold":"bg-slate-900 text-slate-400 hover:text-white border border-slate-800"}`,children:[D,"s"]},D))})]}),n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-2 rounded-lg bg-rose-500/10 border border-rose-500/20 text-xs text-rose-300",children:[n.jsx("input",{type:"checkbox",checked:L,onChange:D=>Y(D.target.checked),className:"rounded bg-slate-950 border-slate-700 text-rose-600"}),n.jsx("span",{className:"font-semibold",children:"红色紧急通知(全屏优先展示)"})]})]})]}),n.jsx("button",{type:"submit",disabled:oe||!u||!y.trim(),className:"w-full py-3 rounded-xl bg-blue-600 hover:bg-blue-500 active:bg-blue-700 text-white font-semibold text-sm shadow-md shadow-blue-600/20 flex items-center justify-center gap-2 transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:oe?n.jsxs(n.Fragment,{children:[n.jsx(Gt,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在投递至教室大屏..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(uo,{className:"w-4 h-4"}),n.jsx("span",{children:"立即发送呼叫"})]})})]})]}),n.jsxs("div",{className:"lg:col-span-7 bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-800/70",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hs,{className:"w-4 h-4 text-emerald-400"}),n.jsx("h2",{className:"text-sm font-semibold text-white",children:"回执动态"}),n.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:["(",rn.length,")"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto max-w-[200px] sm:max-w-none",children:[n.jsx("button",{type:"button",onClick:()=>ae("all"),className:`px-2 py-1 rounded-lg text-xs font-medium transition-colors ${M==="all"?"bg-slate-800 text-white border border-slate-700":"text-slate-400 hover:text-slate-200"}`,children:"全部"}),l.slice(0,3).map(D=>n.jsx("button",{type:"button",onClick:()=>ae(D.id),className:`px-2 py-1 rounded-lg text-xs font-medium transition-colors whitespace-nowrap ${M===D.id?"bg-slate-800 text-white border border-slate-700":"text-slate-400 hover:text-slate-200"}`,children:D.displayName},D.id))]}),n.jsx("div",{className:"w-36",children:n.jsx(Vr,{value:ye,onChange:Ie,placeholder:"搜索动态...",className:"text-xs"})})]})]}),n.jsxs("div",{className:"space-y-3 max-h-[calc(100vh-250px)] overflow-y-auto pr-1",children:[E&&pe.length===0?n.jsxs("div",{className:"text-center py-16 text-xs text-slate-500",children:[n.jsx(Gt,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),n.jsx("span",{children:"正在加载回执记录..."})]}):rn.length===0?n.jsx("div",{className:"text-center py-16 text-xs text-slate-500",children:ye||M!=="all"?"未找到符合条件的通知记录":"暂无呼叫记录,左侧选择班级即可下发"}):rn.map(D=>{var Be;const ge=(Be=D.receipts)==null?void 0:Be.find(Ee=>Ee.visualReceiptState==="Available");return n.jsxs("div",{className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800/80 hover:border-slate-700/80 transition-all space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2 font-medium text-slate-200",children:[n.jsx("span",{className:"font-semibold text-white",children:D.className}),D.priority==="Urgent"&&n.jsx(ze,{label:"紧急",variant:"rose",dot:!1,className:"py-0 px-1.5 text-[10px]"})]}),n.jsx("span",{className:"text-[11px] font-mono text-slate-500",children:new Date(D.createdAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-xs text-slate-300 leading-relaxed bg-slate-900/60 p-2.5 rounded-lg border border-slate-800/60",children:D.message}),n.jsxs("div",{className:"pt-1.5 border-t border-slate-800/60 flex items-center justify-between flex-wrap gap-2 text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[D.status==="Acknowledged"&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-400 font-medium text-xs",children:[n.jsx(At,{className:"w-3.5 h-3.5 text-emerald-400"}),"学生已点击确认"]}),D.status==="Delivered"&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-sky-400 font-medium text-xs",children:[n.jsx(ao,{className:"w-3.5 h-3.5 text-sky-400"}),"已在大屏展示"]}),D.status==="Sent"&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-400 text-xs",children:[n.jsx(Hr,{className:"w-3.5 h-3.5 text-amber-400"}),"云端投递中..."]}),D.status==="Cancelled"&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-slate-400 text-xs",children:[n.jsx(ma,{className:"w-3.5 h-3.5"}),"已撤回关闭"]}),D.status==="Timeout"&&n.jsx("span",{className:"text-slate-500 text-xs",children:"超时自动收起"}),D.status==="Failed"&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-rose-400 text-xs",children:[n.jsx(Fn,{className:"w-3.5 h-3.5"}),"投递失败"]}),ge&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-400/90 text-[11px] font-medium ml-1",children:[n.jsx(ho,{className:"w-3.5 h-3.5 text-emerald-400"}),"视觉核验:已完成"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[ge&&n.jsxs("button",{type:"button",onClick:()=>Jr(D.id,ge.deviceId,D.className,ge.visualReceiptCapturedAt),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-blue-600/10 hover:bg-blue-600/20 text-blue-400 text-xs font-medium border border-blue-500/20 transition-colors",children:[n.jsx(C0,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"查看大屏实际展示"})]}),(D.status==="Sent"||D.status==="Delivered")&&!D.isCancelled&&n.jsxs("button",{type:"button",onClick:()=>vn(D),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-rose-500/10 text-slate-300 hover:text-rose-400 text-xs font-medium border border-slate-700/60 hover:border-rose-500/30 transition-colors",children:[n.jsx(Un,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"提前关闭"})]})]})]})]},D.id)}),_&&n.jsx("div",{className:"pt-3 text-center",children:n.jsx("button",{type:"button",onClick:qr,disabled:z,className:"px-4 py-2 rounded-xl bg-slate-950 hover:bg-slate-800 text-slate-300 hover:text-white text-xs font-medium border border-slate-800 transition-colors inline-flex items-center gap-2",children:z?n.jsxs(n.Fragment,{children:[n.jsx(Gt,{className:"w-3.5 h-3.5 animate-spin text-blue-400"}),n.jsx("span",{children:"正在拉取更早历史..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Tt,{className:"w-3.5 h-3.5 text-slate-400"}),n.jsx("span",{children:"加载更多历史回执 (+50)"})]})})})]})]})]}),_e&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-3xl bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-800 bg-slate-950/60",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ho,{className:"w-5 h-5 text-emerald-400"}),n.jsxs("h3",{className:"font-semibold text-white text-base",children:[_e.className," · 通知视觉核验"]})]}),n.jsx("button",{type:"button",onClick:Vn,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:n.jsx(Un,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 flex-1 overflow-auto flex flex-col items-center justify-center min-h-[320px] bg-slate-950/40",children:[Qs&&n.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 text-sm",children:[n.jsx(Gt,{className:"w-8 h-8 animate-spin text-blue-400"}),n.jsx("span",{children:"正在安全解密并加载现场回执画面..."})]}),fs&&n.jsxs("div",{className:"flex flex-col items-center gap-2 text-rose-400 text-sm",children:[n.jsx(mn,{className:"w-8 h-8 text-rose-400"}),n.jsx("span",{children:fs})]}),et&&!Qs&&n.jsxs("div",{className:"flex flex-col items-center w-full",children:[n.jsx("div",{className:"overflow-auto max-h-[58vh] max-w-full flex items-center justify-center p-2 rounded-xl bg-black/60 border border-slate-800",children:n.jsx("img",{src:et,alt:"教室大屏实际展示画面",style:{transform:`scale(${Wn})`,transformOrigin:"center center",transition:"transform 0.2s"},className:"rounded-lg shadow-lg object-contain max-h-[52vh]"})}),n.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[n.jsx("button",{type:"button",onClick:()=>en(D=>Math.max(.5,+(D-.25).toFixed(2))),disabled:Wn<=.5,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"缩小",children:n.jsx(hx,{className:"w-4 h-4"})}),n.jsxs("span",{className:"text-xs font-mono text-slate-300 min-w-[50px] text-center",children:[Math.round(Wn*100),"%"]}),n.jsx("button",{type:"button",onClick:()=>en(D=>Math.min(3,+(D+.25).toFixed(2))),disabled:Wn>=3,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"放大",children:n.jsx(ux,{className:"w-4 h-4"})}),n.jsx("button",{type:"button",onClick:()=>en(1),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"重置"})]})]})]}),n.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between text-[11px] text-slate-400 gap-2",children:[n.jsx("span",{children:_e.capturedAt?`捕获时间: ${new Date(_e.capturedAt).toLocaleString()}`:""}),n.jsx("span",{className:"text-amber-400/90 text-right",children:"该现场画面仅用于核验通知是否成功显示,并将在捕获后 24 小时自动销毁。"})]})]})}),tn&&n.jsx(pn,{isOpen:!0,onClose:()=>vn(null),title:"提前关闭并撤回通知?",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-slate-950 p-3 rounded-xl border border-slate-800 text-xs text-slate-300",children:[n.jsxs("div",{className:"text-slate-400 text-[11px] mb-1",children:["班级:",n.jsx("span",{className:"text-white font-medium",children:tn.className})]}),n.jsx("p",{className:"line-clamp-3",children:tn.message})]}),n.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300/90 leading-relaxed",children:["💡 确认后,云端将立即向教室大屏下发终止指令,",n.jsx("strong",{children:"停止语音播报并收起弹窗"}),"。"]}),n.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[n.jsx("button",{type:"button",disabled:nn,onClick:()=>vn(null),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"button",disabled:nn,onClick:xs,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:nn?n.jsxs(n.Fragment,{children:[n.jsx(Gt,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在撤回..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(ma,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"确认提前关闭"})]})})]})]})})]})},Ix=()=>{const{user:a,isLoading:l}=qs();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户身份..."}):a?n.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col",children:[n.jsx(mx,{}),n.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n.jsx(Jd,{})})]}):n.jsx(Yt,{to:"/login",replace:!0})},Px=()=>{const{user:a,isLoading:l}=qs();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在初始化..."}):a?a.role==="SuperAdmin"?n.jsx(Yt,{to:"/admin",replace:!0}):a.role==="SchoolAdmin"?n.jsx(Yt,{to:"/school-admin",replace:!0}):n.jsx(Yt,{to:"/teacher",replace:!0}):n.jsx(Yt,{to:"/login",replace:!0})},Rx=()=>n.jsxs(ip,{children:[n.jsx(Je,{path:"/login",element:n.jsx(px,{})}),n.jsx(Je,{path:"/",element:n.jsx(Px,{})}),n.jsxs(Je,{element:n.jsx(Ix,{}),children:[n.jsxs(Je,{element:n.jsx(aa,{allowedRoles:["SuperAdmin"]}),children:[n.jsx(Je,{path:"/admin",element:n.jsx(xx,{})}),n.jsx(Je,{path:"/admin/tenants",element:n.jsx(wx,{})}),n.jsx(Je,{path:"/admin/users",element:n.jsx(bx,{})}),n.jsx(Je,{path:"/admin/devices",element:n.jsx(gx,{})}),n.jsx(Je,{path:"/admin/broadcast",element:n.jsx(jx,{})}),n.jsx(Je,{path:"/admin/codes",element:n.jsx(vx,{})}),n.jsx(Je,{path:"/admin/history",element:n.jsx(yx,{})})]}),n.jsxs(Je,{element:n.jsx(aa,{allowedRoles:["SchoolAdmin"]}),children:[n.jsx(Je,{path:"/school-admin",element:n.jsx(Nx,{})}),n.jsx(Je,{path:"/school-admin/classes",element:n.jsx(_x,{})}),n.jsx(Je,{path:"/school-admin/teachers",element:n.jsx(Sx,{})}),n.jsx(Je,{path:"/school-admin/codes",element:n.jsx(kx,{})})]}),n.jsx(Je,{element:n.jsx(aa,{allowedRoles:["Teacher"]}),children:n.jsx(Je,{path:"/teacher",element:n.jsx(Tx,{})})})]}),n.jsx(Je,{path:"*",element:n.jsx(Yt,{to:"/",replace:!0})})]}),Lx=()=>n.jsx(l0,{children:n.jsx(pp,{children:n.jsx(Rx,{})})});pm.createRoot(document.getElementById("root")).render(n.jsx(Md.StrictMode,{children:n.jsx(Lx,{})})); /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/index.html SIZE: 957 chars SHA256: 1D3A0E7B7639C4300C43E37CC18364FEFC0BBCFB2FC89802C5910B22FA044C16 ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Shared/ClassNotify.Shared/ClassNotify.Shared.csproj SIZE: 242 chars SHA256: 3D130EF85C63DF9966763BEE1B9DFE0E5666C91DD26FB6AB15AEF185FA8910C1 ===================================================================== */ net8.0 enable enable latest /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Contracts/IDeviceHubClient.cs SIZE: 700 chars SHA256: D273339634DEC0C5AF58F362BF2C67432CA78FB1E4BDB2AA4983766E4B76A575 ===================================================================== */ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教室端 (Windows Service) 接收来自服务端的强类型 SignalR 契约 /// public interface IDeviceHubClient { /// /// 接收呼叫/通知指令 /// Task ReceiveNotification(NotificationDto notification); /// /// 接收服务端下发的端到端受控运维指令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// Task ReceiveRemoteCommand(DeviceCommandDto command); /// /// 接收服务端下达的撤回/提前关闭通知指令 /// Task CancelNotification(string notificationId); /// /// 接收配置更新 /// Task ReceiveConfigUpdate(string configJson); } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Contracts/ITeacherHubClient.cs SIZE: 998 chars SHA256: 6625CFAFB854B000D9D3767F6BD8BD64A3C2061EB607F01C9E37039C86191CD2 ===================================================================== */ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教师控制端 (Web / Android) 接收来自服务端的强类型 SignalR 契约 /// public interface ITeacherHubClient { /// /// 设备在线状态变更通知 (上线/离线/心跳刷新) /// Task OnDeviceStatusChanged(DeviceStatusDto status); /// /// 消息回执更新 (已送达、学生已点击【我知道了】、超时关闭) /// Task OnAckReceiptReceived(AckReceiptDto receipt); /// /// 收到教室端健康自检体检报告 /// Task OnHealthReportReceived(DeviceHealthReportDto report); /// /// 新消息广播 /// Task OnNewNotificationBroadcast(NotificationDto notification); /// /// 远程运维命令状态变更 (Pending -> Dispatched -> Succeeded / Failed / TimedOut / Expired) /// Task OnDeviceCommandStatusChanged(DeviceCommandResultDto result); /// /// 通知撤回/提前关闭广播 /// Task OnNotificationCancelled(string notificationId); } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/AckStatus.cs SIZE: 487 chars SHA256: 1DCE55D558D0DD5FFAD1EA0C96E70B8106FFB486C1B6D003F820D434B855C674 ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 消息状态与回执阶段 /// public enum AckStatus { /// /// 已提交至云端服务器 /// Sent = 0, /// /// 教室端大屏/后台已成功接收 /// Delivered = 1, /// /// 学生或值日生点击了【我知道了】 /// Acknowledged = 2, /// /// 倒计时结束,窗口自动淡出关闭 /// Timeout = 3, /// /// 设备离线或投递失败 /// Failed = 4 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/DeviceOnlineState.cs SIZE: 346 chars SHA256: B4B452E56ECB1D968C584EC05482EDCCE187EFE816221B6823D75FB37ECE998B ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 设备在线与健康状态 /// public enum DeviceOnlineState { /// /// 离线(无心跳连接) /// Offline = 0, /// /// 正常在线 /// Online = 1, /// /// 降级运行(如后台在线但 UI 进程异常或 TTS 不可用) /// Degraded = 2 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/NotificationType.cs SIZE: 334 chars SHA256: 40D28DFBF41FEA8FF3FC34CD2C7EB4827BFBE6017702FB50CADAB03BFDCA68FB ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 通知类别 /// public enum NotificationType { /// /// 老师呼叫(默认蓝色,高优先级) /// Call = 0, /// /// 班级常规通知(绿色) /// Notice = 1, /// /// 紧急/重要提醒(红色,全屏强调) /// Urgent = 2 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Ipc/IpcMessage.cs SIZE: 591 chars SHA256: A770014CC85DEA1D77A2ECF9B240F2431B7C9E2FCBB94E25122A74FDEEBE7743 ===================================================================== */ namespace ClassNotify.Shared.Ipc; /// /// Windows Service 与 WinUI 3 前台进程之间的命名管道 IPC 消息类型 /// public enum IpcCommandType { Ping = 0, Pong = 1, ShowNotification = 2, CloseNotification = 3, ReportAck = 4, HealthCheck = 5, Hello = 6, TtsCheck = 7, TtsCheckResult = 8, ReportVisualReceipt = 9 } /// /// 命名管道传输帧 /// public class IpcMessage { public IpcCommandType Type { get; set; } public string? CorrelationId { get; set; } = Guid.NewGuid().ToString("N"); public string? PayloadJson { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/AckReceiptDto.cs SIZE: 751 chars SHA256: 58C007127FFAE6FABC81DF16A8DC28754018EF6BC69702ACDCC8267D3BFA627E ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室端确认与回执数据对象 /// public class AckReceiptDto { /// /// 对应的消息 ID /// public string MessageId { get; set; } = string.Empty; /// /// 班级编号 /// public string ClassId { get; set; } = string.Empty; /// /// 当前回执状态(Delivered / Acknowledged / Timeout) /// public AckStatus Status { get; set; } = AckStatus.Delivered; /// /// 触发时间戳 /// public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; /// /// 备注信息(如“值日生张三确认”) /// public string? Remark { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/AdminDtos.cs SIZE: 7364 chars SHA256: E2FF8BD2DAAD1857BD83135BC739C7744F708CF04A19EBEF706DE2689726A964 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 全局平台统计指标 (超级管理员大盘) /// public class AdminMetricsDto { public int TotalTenants { get; set; } public int TotalClassrooms { get; set; } public int TotalDevices { get; set; } public int OnlineDevices { get; set; } public int OfflineDevices => Math.Max(0, TotalDevices - OnlineDevices); public int TodayNotifications { get; set; } public int AbnormalDevices { get; set; } } /// /// 设备明细与实时状态 DTO /// public class DeviceAdminDto { public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public string? Hostname { get; set; } public bool IsOnline { get; set; } public DateTimeOffset? LastHeartbeat { get; set; } public string? ClientVersion { get; set; } public string? RemoteIp { get; set; } public bool ServiceRunning { get; set; } = true; public bool ClientRunning { get; set; } = true; } /// /// 学校/租户大盘 DTO /// public class TenantAdminDto { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public int ClassroomCount { get; set; } public int DeviceCount { get; set; } public int OnlineCount { get; set; } public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } } /// /// 激活码详情 DTO /// public class ActivationCodeDto { public string Code { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } public bool IsUsed { get; set; } public DateTimeOffset? UsedAt { get; set; } public string? UsedByDeviceId { get; set; } } /// /// 远程指令下发请求 /// public class RemoteCommandRequestDto { public string Command { get; set; } = string.Empty; // "ping", "restart_client", "refresh_config" public string? Parameters { get; set; } } /// /// 创建班级请求 /// public class CreateClassroomDto { public string Id { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; public string? Grade { get; set; } public string? RoomNumber { get; set; } } /// /// 创建教师账号请求 /// public class CreateTeacherDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "Teacher"; // Teacher, SchoolAdmin } /// /// 消息历史记录与回执 /// public class NotificationRecordDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string SenderName { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public string Priority { get; set; } = "Normal"; public DateTimeOffset CreatedAt { get; set; } public string Status { get; set; } = "Sent"; // Sent, Delivered, Acknowledged, Timeout, Failed, Cancelled public bool IsCancelled { get; set; } public DateTimeOffset? CancelledAt { get; set; } public string? CancelledBy { get; set; } public DateTimeOffset? ConfirmedAt { get; set; } public DateTimeOffset? ExpiresAt { get; set; } public List Receipts { get; set; } = new(); } public class UserAdminDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = string.Empty; public bool IsLocked { get; set; } public DateTimeOffset CreatedAt { get; set; } public DateTimeOffset? LastLoginAt { get; set; } } public class CreateUserAdminRequest { public string TenantId { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "SchoolAdmin"; // SchoolAdmin, Teacher } public class ResetPasswordRequest { public string NewPassword { get; set; } = string.Empty; } public class LockUserRequest { public bool IsLocked { get; set; } = true; } public class CreateTenantRequest { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; } public class UpdateTenantRequest { public string Name { get; set; } = string.Empty; public bool IsActive { get; set; } = true; } public class UpdateDeviceRequest { public string? Hostname { get; set; } public string? ClassroomId { get; set; } } public class EmergencyBroadcastRequest { public string? TenantId { get; set; } // null or empty = all schools public string Title { get; set; } = "⚠️ 全校紧急通知"; public string Message { get; set; } = string.Empty; public bool Voice { get; set; } = true; public bool Shake { get; set; } = true; public int DurationSeconds { get; set; } = 30; } public class SystemHealthDto { public string Status { get; set; } = "Healthy"; public bool DatabaseConnected { get; set; } = true; public double DatabaseLatencyMs { get; set; } public int ActiveSignalRConnections { get; set; } public int OnlineDevices { get; set; } public string ServerTime { get; set; } = string.Empty; public string Uptime { get; set; } = string.Empty; public long MemoryUsedBytes { get; set; } } public class AdminAuditLogDto { public string Id { get; set; } = string.Empty; public DateTimeOffset OccurredAt { get; set; } public string ActorUsername { get; set; } = string.Empty; public string ActorRole { get; set; } = string.Empty; public string Action { get; set; } = string.Empty; public string TargetType { get; set; } = string.Empty; public string TargetId { get; set; } = string.Empty; public string? Details { get; set; } public string? IpAddress { get; set; } } public sealed class BroadcastReceiptSummaryDto { public string BroadcastId { get; set; } = string.Empty; public int TargetSchools { get; set; } public int TargetClassrooms { get; set; } public int TargetDevices { get; set; } public int Displayed { get; set; } public int Pending { get; set; } public int Cancelled { get; set; } public int Failed { get; set; } public bool Completed => Pending == 0; public DateTimeOffset? CreatedAt { get; set; } } public sealed record CancelNotificationResult( string NotificationId, string TenantId, string ClassroomId, bool AlreadyCancelled, DateTimeOffset? CancelledAt, string? CancelledBy); /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceActivationRequestDto.cs SIZE: 662 chars SHA256: CD8B9127242CA36E336AA6897EBA9B08B62C8A264016D85DFA70D3A024C0A567 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备首次激活请求 DTO /// public class DeviceActivationRequestDto { /// /// 一次性设备激活码 (例如: H8K4-29DP) /// public string ActivationCode { get; set; } = string.Empty; /// /// 教室电脑主机名 /// public string Hostname { get; set; } = Environment.MachineName; /// /// 客户端版本号 /// public string ClientVersion { get; set; } = "2.1.0"; /// /// 安装实例唯一标识符 (例如: inst_550e8400-e29b-41d4-a716-446655440000) /// public string InstallationId { get; set; } = string.Empty; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceActivationResultDto.cs SIZE: 431 chars SHA256: F510CEA69A7BEBF285EDEC2B885B445F81B02A5782C4EB578B317D3BBD4145B5 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备激活响应 DTO /// public class DeviceActivationResultDto { public bool Success { get; set; } public string? DeviceId { get; set; } public string? DeviceToken { get; set; } public string? TenantId { get; set; } public string? ClassId { get; set; } public string? ClassDisplayName { get; set; } public string? ErrorMessage { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceCommandDto.cs SIZE: 3086 chars SHA256: 8A641211C56C55DF5566005B54D583A9B987C0D0026C2CC95BA15A798BB6AB61 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 远程维护命令类型常量 /// public static class DeviceCommandTypes { public const string SelfCheck = "SelfCheck"; public const string RestartClient = "RestartClient"; public const string Reconnect = "Reconnect"; public const string RefreshConfig = "RefreshConfig"; public static readonly string[] AllSupported = [SelfCheck, RestartClient, Reconnect, RefreshConfig]; public static bool IsSupported(string? commandType) { if (string.IsNullOrWhiteSpace(commandType)) return false; return AllSupported.Contains(commandType, StringComparer.OrdinalIgnoreCase); } /// /// 获取命令类型的默认安全 TTL(生命周期) /// 严禁长期补发,过期即弃 /// public static TimeSpan GetDefaultTtl(string commandType) { return commandType?.ToLowerInvariant() switch { "restartclient" or "restart_client" => TimeSpan.FromMinutes(2), "reconnect" => TimeSpan.FromMinutes(2), "refreshconfig" or "refresh_config" => TimeSpan.FromMinutes(5), "selfcheck" or "self_check" => TimeSpan.FromMinutes(5), _ => TimeSpan.FromMinutes(2) }; } } /// /// 远程维护命令状态常量 /// public static class DeviceCommandStatuses { public const string Pending = "Pending"; public const string Dispatched = "Dispatched"; public const string Succeeded = "Succeeded"; public const string Failed = "Failed"; public const string TimedOut = "TimedOut"; public const string Expired = "Expired"; public static bool IsTerminal(string status) => status is Succeeded or Failed or TimedOut or Expired; } /// /// 远程运维命令传输对象 /// 全链路统一 CommandId (cmd_xxxxx),从创建到最终上报不可篡改 /// public class DeviceCommandDto { public string CommandId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string CommandType { get; set; } = string.Empty; public string? Parameters { get; set; } public string CreatedBy { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset ExpiresAt { get; set; } public string Status { get; set; } = DeviceCommandStatuses.Pending; public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? CompletedAt { get; set; } public long? DurationMs { get; set; } public int? ResultCode { get; set; } public string? ResultMessage { get; set; } } /// /// 终端设备执行远程命令后回传的结果报文 /// public class DeviceCommandResultDto { public string CommandId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = DeviceCommandStatuses.Succeeded; public int ResultCode { get; set; } = 0; public string? ResultMessage { get; set; } public long ExecutionDurationMs { get; set; } public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceCredentials.cs SIZE: 549 chars SHA256: 936C4CB817E4F20FBD006412EF31FF4735C9B3929C96280F6D9AE4D9EA7CB084 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室本地保存的永久设备凭证 (存储于 C:\ProgramData\ClassNotify\device_credentials.json) /// public class DeviceCredentials { public string DeviceId { get; set; } = string.Empty; public string DeviceToken { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassDisplayName { get; set; } = string.Empty; public DateTimeOffset ActivatedAt { get; set; } = DateTimeOffset.UtcNow; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceHealthReportDto.cs SIZE: 1787 chars SHA256: 86918ABF93CAA8357916AED6A78760237563B1C1AC975479F0E4503244CF9508 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备详细健康自检报告 /// public class DeviceHealthReportDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; // Detailed health indicators public bool ServiceRunning { get; set; } = true; public bool ClientConnected { get; set; } public int ClientHeartbeatAgeSeconds { get; set; } = -1; public bool DnsOk { get; set; } public bool HttpsOk { get; set; } public bool SignalROk { get; set; } public bool CredentialsOk { get; set; } public bool DataDirectoryWritable { get; set; } public bool PipeOk { get; set; } public bool TtsOk { get; set; } public string OverallStatus { get; set; } = "Offline"; // Healthy, Degraded, Offline public DateTimeOffset CheckedAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// Windows SAPI / WinRT TTS 语音引擎是否可用 /// public bool IsTtsAvailable { get => TtsOk; set => TtsOk = value; } /// /// WinUI 3 前台 UI 进程是否处于就绪/健康状态 /// public bool IsUiProcessRunning { get => ClientConnected; set => ClientConnected = value; } /// /// 互联网与云端连接是否正常 /// public bool IsNetworkReachable { get => HttpsOk; set => HttpsOk = value; } /// /// 域名 DNS 解析是否正常 /// public bool IsDnsResolved { get => DnsOk; set => DnsOk = value; } /// /// 诊断详情信息 /// public string DiagnosticMessage { get; set; } = "All checks passed."; } public class TtsCheckResultDto { public bool Available { get; set; } public int VoiceCount { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceStatusDto.cs SIZE: 576 chars SHA256: 01CE7FE6054592EC308B3C5C35A4C35A459D63A17202468C0164246186B79266 ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室设备简要在线状态模型 /// public class DeviceStatusDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string? Hostname { get; set; } public DeviceOnlineState State { get; set; } = DeviceOnlineState.Offline; public DateTimeOffset LastHeartbeat { get; set; } = DateTimeOffset.UtcNow; public string AgentVersion { get; set; } = "2.0.0"; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/NotificationDto.cs SIZE: 1688 chars SHA256: C1AB89A8863A3A793B6AC6E49C2DCD0DB2444656ACC0135B5894E522F6442795 ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 通知消息传输对象 (DTO) /// public class NotificationDto { /// /// 唯一消息 ID (如 msg_20260920_xxxx) /// public string Id { get; set; } = Guid.NewGuid().ToString("N"); /// /// 所属学校/租户 ID (如 "t_beijing_no4") /// public string TenantId { get; set; } = string.Empty; /// /// 目标班级编号 (如 "cls_801") /// public string ClassId { get; set; } = string.Empty; /// /// 呼叫的目标学生姓名(可选,如 "张三") /// public string? StudentName { get; set; } /// /// 弹窗标题 /// public string Title { get; set; } = "🔔 老师呼叫"; /// /// 通知正文内容 /// public string Message { get; set; } = string.Empty; /// /// 通知类型 /// public NotificationType Type { get; set; } = NotificationType.Call; /// /// 是否开启 Windows TTS 中文语音朗读 /// public bool Voice { get; set; } = true; /// /// 是否开启窗口抖动震颤 /// public bool Shake { get; set; } = true; /// /// 展示持续时长(秒),超时后自动关闭 /// public int DurationSeconds { get; set; } = 15; /// /// 教师端发送时间戳 /// public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; /// /// 消息过期时间(UTC),超过此时间不再向离线设备补发 /// public DateTimeOffset? ExpiresAt { get; set; } /// /// 全局应急广播关联 ID(可选) /// public string? BroadcastId { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/NotificationReceiptStatuses.cs SIZE: 780 chars SHA256: 3BBDCE6A28391661DCE0AC9C2DA03FA23428AB8AB056746484812472518FAADA ===================================================================== */ namespace ClassNotify.Shared.Models; public static class NotificationReceiptStatuses { public const string Sent = "Sent"; public const string DeviceReceived = "DeviceReceived"; public const string Displayed = "Displayed"; public const string Acknowledged = "Acknowledged"; public const string Cancelled = "Cancelled"; public const string Failed = "Failed"; public const string Timeout = "Timeout"; public const string Expired = "Expired"; public static bool IsDisplayed(string status) => status == Displayed || status == Acknowledged; public static bool IsPending(string status) => status == Sent || status == DeviceReceived; public static bool IsFailed(string status) => status == Failed || status == Timeout || status == Expired; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/TeacherLoginDto.cs SIZE: 621 chars SHA256: 6866BAB6B943DA3CC5B9536648B8684F7F9EE1F6BB25D88FA00DF974A2A9C434 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教师登录请求 DTO /// public class TeacherLoginDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; } /// /// 教师登录成功返回包含 Tenant Claims 的 JWT 凭证 /// public class TeacherLoginResultDto { public bool Success { get; set; } public string? Token { get; set; } public string? TenantId { get; set; } public string? UserId { get; set; } public string? FullName { get; set; } public string? Role { get; set; } public string? ErrorMessage { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/VisualReceiptModels.cs SIZE: 850 chars SHA256: C34E5153E3981F939E575E00542BC40263F5F991A3F64C6DFDD69ED34CB06757 ===================================================================== */ using System; namespace ClassNotify.Shared.Models; /// /// IPC 传输的视觉回执数据包 (WPF Client -> Windows Service) /// public sealed class VisualReceiptIpcDto { public string NotificationId { get; set; } = string.Empty; public byte[] JpegBytes { get; set; } = Array.Empty(); } /// /// Web / Server 暴露给前端查看的设备通知回执视图模型 /// public sealed class NotificationReceiptViewDto { public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset? DisplayedAt { get; set; } /// /// None / Available / Expired /// public string VisualReceiptState { get; set; } = "None"; public DateTimeOffset? VisualReceiptCapturedAt { get; set; } public DateTimeOffset? VisualReceiptExpiresAt { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/ClientNotificationBuffer.cs SIZE: 6784 chars SHA256: A39ED9B75407A449F51B86098EB51FE045AE90B940A9F40021DE6C5A2DBA57E9 ===================================================================== */ using System.Collections.Concurrent; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// Thread-safe client notification buffer and FIFO delivery dispatcher for Windows Service. /// Guarantees strict FIFO delivery order, single-concurrent flushing via SemaphoreSlim(1,1), /// and atomic peek-then-dequeue so broken-pipe failures leave the item at the head of the queue. /// When a backlog exists, new live notifications are enqueued to preserve FIFO order and never bypass pending items. /// public class ClientNotificationBuffer { private readonly ConcurrentQueue _pendingQueue = new(); private readonly SemaphoreSlim _flushLock = new(1, 1); public int PendingCount => _pendingQueue.Count; public IReadOnlyCollection GetPendingSnapshot() => _pendingQueue.ToArray(); public void Enqueue(NotificationDto notification) { if (notification == null) return; _pendingQueue.Enqueue(notification); } public void Clear() { while (_pendingQueue.TryDequeue(out _)) { } } /// /// Delivers the notification to the client or safely buffers it. /// If there is an existing backlog, the notification is enqueued to the tail of the backlog /// to preserve strict FIFO ordering, and a flush is triggered if connected. /// If there is no backlog and the client is connected, an immediate live delivery is attempted. /// If delivery fails, the notification is buffered so it can be flushed on reconnect. /// public async Task DeliverOrBufferAsync( NotificationDto notification, Func isClientConnected, Func> sendToClientAsync, int waitAttempts = 0, int delayMsBetweenAttempts = 500) { if (notification == null) return false; await _flushLock.WaitAsync(); try { // Case 1: Existing backlog exists. Must enqueue behind backlog to guarantee FIFO ordering! if (!_pendingQueue.IsEmpty) { _pendingQueue.Enqueue(notification); if (isClientConnected()) { await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, DateTimeOffset.UtcNow); } return false; } // Case 2: No backlog. If client is connected, attempt immediate live send. if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } // Case 3: Client handshaking / transient wait window for (int i = 0; i < waitAttempts; i++) { if (delayMsBetweenAttempts > 0) { await Task.Delay(delayMsBetweenAttempts); } if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } } // Delivery failed or client not connected: buffer notification for next reconnect flush _pendingQueue.Enqueue(notification); return false; } finally { _flushLock.Release(); } } /// /// Flushes pending notifications to the connected client. /// Uses peek-then-dequeue: only dequeues upon verified successful send. /// If send fails or client disconnects, the failed notification remains at the head of the queue, /// flushing stops immediately, and strict FIFO order is naturally preserved. /// public async Task FlushAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset? currentUtc = null) { var now = currentUtc ?? DateTimeOffset.UtcNow; await _flushLock.WaitAsync(); try { return await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, now); } finally { _flushLock.Release(); } } private async Task FlushInternalUnderLockAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset now) { int flushed = 0; while (_pendingQueue.TryPeek(out var notif)) { // Drop expired notification while waiting in queue if (notif.ExpiresAt.HasValue && notif.ExpiresAt.Value <= now) { _pendingQueue.TryDequeue(out _); continue; } if (!isClientConnected()) { // Client not connected: halt flush, leave notif at head of queue break; } bool success; try { success = await sendToClientAsync(notif); } catch { success = false; } if (success) { // Dequeue ONLY after successful delivery _pendingQueue.TryDequeue(out _); flushed++; } else { // Send failed (pipe broken mid-send). Do NOT dequeue! // notif remains at the head of the queue. Halt flushing to preserve FIFO order. break; } } return flushed; } public void Remove(string notificationId) { if (string.IsNullOrEmpty(notificationId)) return; _flushLock.Wait(); try { var items = _pendingQueue.ToArray(); while (_pendingQueue.TryDequeue(out _)) { } foreach (var item in items) { if (!string.Equals(item.Id, notificationId, StringComparison.OrdinalIgnoreCase)) { _pendingQueue.Enqueue(item); } } } finally { _flushLock.Release(); } } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/ClientNotificationDeduplicator.cs SIZE: 3434 chars SHA256: 2DB19AD641E7DCA72254F8A3D5D3CF5154BEBF8F0F017AD6138950EA2D85219E ===================================================================== */ using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; namespace ClassNotify.Shared.Services; /// /// Client-side idempotent duplicate suppression for at-least-once message delivery. /// Ensures running clients do not display duplicate popups or trigger multiple TTS announcements /// when catching up or receiving retransmitted notifications with the same Notification ID. /// public class ClientNotificationDeduplicator { private readonly ConcurrentDictionary _processedMessageIds = new(); private readonly int _maxCapacity; private readonly TimeSpan _retentionPeriod; private readonly object _cleanupLock = new(); public ClientNotificationDeduplicator(int maxCapacity = 1000, TimeSpan? retentionPeriod = null) { _maxCapacity = maxCapacity; _retentionPeriod = retentionPeriod ?? TimeSpan.FromHours(24); } /// /// Atomically attempts to mark the notification as processed. /// /// The unique notification ID. /// True if this is the first time receiving this ID (allow processing); False if duplicate (suppress presentation). public bool TryProcess(string notificationId) { if (string.IsNullOrWhiteSpace(notificationId)) return false; var now = DateTimeOffset.UtcNow; if (!_processedMessageIds.TryAdd(notificationId, now)) { // Key already exists -> atomic duplicate detection return false; } // Bounded capacity protection if (_processedMessageIds.Count > _maxCapacity) { ThreadPool.QueueUserWorkItem(_ => CleanupStaleEntries()); } return true; } /// /// Checks whether an ID has been seen without mutating deduplication state. /// public bool IsProcessed(string notificationId) { return !string.IsNullOrWhiteSpace(notificationId) && _processedMessageIds.ContainsKey(notificationId); } public int Count => _processedMessageIds.Count; public void Clear() { _processedMessageIds.Clear(); } private void CleanupStaleEntries() { if (!Monitor.TryEnter(_cleanupLock)) return; try { var threshold = DateTimeOffset.UtcNow.Subtract(_retentionPeriod); foreach (var kvp in _processedMessageIds) { if (kvp.Value < threshold) { _processedMessageIds.TryRemove(kvp.Key, out _); } } // If still over capacity after expiry cleanup, purge oldest half if (_processedMessageIds.Count > _maxCapacity) { var removeCount = _processedMessageIds.Count - (_maxCapacity / 2); var oldestKeys = _processedMessageIds .OrderBy(kvp => kvp.Value) .Take(removeCount) .Select(kvp => kvp.Key) .ToList(); foreach (var key in oldestKeys) { _processedMessageIds.TryRemove(key, out _); } } } catch { // Best effort cleanup } finally { Monitor.Exit(_cleanupLock); } } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/DeviceCommandDeduplicator.cs SIZE: 7671 chars SHA256: 7AB6EE236FE3217D620DEC7982CB9144D054EB554C747EE1BEB112C27F037383 ===================================================================== */ using System.Collections.Concurrent; using System.Text.Json; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// 命令认领抢占状态 /// public enum CommandClaimResult { /// 成功抢占并在内存与磁盘物理账本中双重持久化成功 Claimed, /// 命令此前已执行完毕,持有已完成缓存结果 AlreadyCompleted, /// 命令当前正处于执行流中,尚未得出最终结果 InFlight, /// 持久化账本写入失败或本地账本文件已损坏,Fail-Closed 拒绝执行任何副作用 StorageError } /// /// 专用远程命令幂等去重器与持久化本地账本 (Windows Service 端) /// 保证同一 CommandId 在网络抖动、SignalR 重连、重复派发、乃至 Service 崩溃或重启后, /// 严格至多在物理终端执行一次实际副作用,并能安全幂等返回先前的执行结果。 /// 严格遵循 Fail-Closed 原则:当磁盘持久化失败或文件损坏时,决不允许在不具备持久保证的情况下执行副作用。 /// public class DeviceCommandDeduplicator { public class CommandExecutionRecord { public bool IsCompleted { get; set; } public DateTimeOffset Timestamp { get; set; } public DeviceCommandResultDto? Result { get; set; } } private readonly ConcurrentDictionary _records = new(); private readonly TimeSpan _slidingWindow; private readonly int _maxCapacity; private readonly string? _ledgerFilePath; private readonly object _fileLock = new(); private volatile bool _isCorrupted = false; public int Count => _records.Count; public string? LedgerFilePath => _ledgerFilePath; public bool IsCorrupted => _isCorrupted; public DeviceCommandDeduplicator( TimeSpan? slidingWindow = null, int maxCapacity = 1000, string? ledgerFilePath = null) { _slidingWindow = slidingWindow ?? TimeSpan.FromHours(1); _maxCapacity = maxCapacity; _ledgerFilePath = ledgerFilePath; LoadLedgerFromDisk(); } /// /// 尝试以持久化 Fail-Closed 保证抢占执行锁。 /// 只有在内存认领成功 且 磁盘持久化写入原子成功时,才返回 Claimed; /// 若账本损坏或持久化失败,立即回滚内存状态并返回 StorageError,阻断副作用执行。 /// public CommandClaimResult TryDurablyClaim(string commandId, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return CommandClaimResult.StorageError; if (_isCorrupted) return CommandClaimResult.StorageError; var now = nowUtc ?? DateTimeOffset.UtcNow; PruneIfNeeded(now); if (_records.TryGetValue(commandId, out var existing)) { return existing.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } var record = new CommandExecutionRecord { IsCompleted = false, Timestamp = now }; if (!_records.TryAdd(commandId, record)) { return _records.TryGetValue(commandId, out var r) && r.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } try { SaveLedgerToDisk(); return CommandClaimResult.Claimed; } catch { // Fail-closed: 回滚内存记录,确保没有虚假的 InFlight 状态残留在内存中 _records.TryRemove(commandId, out _); return CommandClaimResult.StorageError; } } /// /// 尝试抢占执行锁(兼容既有布尔接口,底层严格遵循 TryDurablyClaim 的 Fail-Closed 保证)。 /// public bool TryBeginExecution(string commandId, DateTimeOffset? nowUtc = null) { return TryDurablyClaim(commandId, nowUtc) == CommandClaimResult.Claimed; } /// /// 命令执行完毕后记录最终执行结果并持久化至磁盘 /// public void CompleteExecution(string commandId, DeviceCommandResultDto result, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return; var now = nowUtc ?? DateTimeOffset.UtcNow; if (_records.TryGetValue(commandId, out var record)) { record.IsCompleted = true; record.Timestamp = now; record.Result = result; } else { _records[commandId] = new CommandExecutionRecord { IsCompleted = true, Timestamp = now, Result = result }; } try { SaveLedgerToDisk(); } catch { // 写入失败时保留内存记录 } } /// /// 查询已完成命令的历史缓存结果(用于重复到达时直接返回原结果) /// public bool TryGetCachedResult(string commandId, out DeviceCommandResultDto? result) { result = null; if (string.IsNullOrWhiteSpace(commandId)) return false; if (_records.TryGetValue(commandId, out var record) && record.IsCompleted && record.Result != null) { result = record.Result; return true; } return false; } public void Clear() { _records.Clear(); _isCorrupted = false; try { SaveLedgerToDisk(); } catch { } } private void PruneIfNeeded(DateTimeOffset now) { bool pruned = false; var cutoff = now.Subtract(_slidingWindow); if (_records.Count > _maxCapacity) { foreach (var kvp in _records) { if (kvp.Value.Timestamp < cutoff) { if (_records.TryRemove(kvp.Key, out _)) { pruned = true; } } } } if (pruned) { try { SaveLedgerToDisk(); } catch { } } } private void LoadLedgerFromDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; try { lock (_fileLock) { if (!File.Exists(_ledgerFilePath)) return; var json = File.ReadAllText(_ledgerFilePath); if (string.IsNullOrWhiteSpace(json)) { // 存在但为空,视同损坏文件以防读取非预期状态 _isCorrupted = true; return; } var data = JsonSerializer.Deserialize>(json); if (data != null) { var now = DateTimeOffset.UtcNow; var cutoff = now.Subtract(_slidingWindow); foreach (var (k, v) in data) { if (v.Timestamp >= cutoff) { _records[k] = v; } } } else { _isCorrupted = true; } } } catch { // Fail-closed: 遇到反序列化异常或文件损坏时标记 Corrupted,阻止无保护的执行 _isCorrupted = true; } } private void SaveLedgerToDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; lock (_fileLock) { var dir = Path.GetDirectoryName(_ledgerFilePath); if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var snapshot = _records.ToDictionary(k => k.Key, v => v.Value); var json = JsonSerializer.Serialize(snapshot, new JsonSerializerOptions { WriteIndented = true }); var tmp = _ledgerFilePath + $".{Guid.NewGuid():N}.tmp"; File.WriteAllText(tmp, json); File.Move(tmp, _ledgerFilePath, overwrite: true); } } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/index.html SIZE: 859 chars SHA256: B2691CC09D200CB9D0A4CB5A6B8286AB1C8B628022D8CF034AA55DA215BC5244 ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Web/ClassNotify.Web/package-lock.json SIZE: 143265 chars SHA256: A475C6DD695A0ACCED51F30316CD03F2B72EF6ABFA29EF48A55B419656292C53 ===================================================================== */ { "name": "classnotify-web", "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "classnotify-web", "version": "2.1.0", "dependencies": { "@microsoft/signalr": "^8.0.7", "clsx": "^2.1.1", "lucide-react": "^0.475.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.28.0", "tailwind-merge": "^2.6.0" }, "devDependencies": { "@testing-library/jest-dom": "^7.0.1", "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.6.7", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.20", "jsdom": "^30.1.0", "playwright": "^1.63.0", "postcss": "^8.4.49", "tailwindcss": "^3.4.17", "typescript": "~5.6.2", "vite": "^6.0.1", "vitest": "^5.0.1" } }, "node_modules/@adobe/css-tools": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz", "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==", "dev": true, "license": "MIT" }, "node_modules/@alloc/quick-lru": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz", "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==", "dev": true, "license": "MIT", "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@asamuzakjp/css-color": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.0.1.tgz", "integrity": "sha512-C9duntabagkBZ1LebM7FKmphR4Q1pBclLxVbZETQV0akkFjV0ooFxo8FlvAQyKj9F6l8rEnmidgcTlpyxFYizg==", "dev": true, "license": "MIT", "dependencies": { "@csstools/css-calc": "^3.4.0", "@csstools/css-color-parser": "^4.2.3", "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.1", "lru-cache": "^11.5.3" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" } }, "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/@asamuzakjp/dom-selector": { "version": "9.2.1", "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-9.2.1.tgz", "integrity": "sha512-NT4s3yZLjovPpliRpTvdsdzyPjqRqiCZj9MxnarBihbaY5MbAG7DWAJcrLlhmC7xKTNCXsTELcqB8YsqpLnUFQ==", "dev": true, "license": "MIT", "dependencies": { "bidi-js": "^1.1.0", "css-tree": "^3.2.1", "is-potential-custom-element-name": "^1.0.1", "lru-cache": "^11.5.3" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" } }, "node_modules/@asamuzakjp/dom-selector/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-module-transforms": "^7.29.7", "@babel/helpers": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/babel" } }, "node_modules/@babel/generator": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.29.8", "@babel/types": "^7.29.8", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-globals": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", "dev": true, "license": "MIT", "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7", "@babel/traverse": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-plugin-utils": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { "version": "7.29.9", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.29.8" }, "bin": { "parser": "bin/babel-parser.js" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/plugin-transform-react-jsx-self": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/@babel/plugin-transform-react-jsx-source": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/@babel/runtime": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz", "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/template": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.8", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.8", "@babel/template": "^7.29.7", "@babel/types": "^7.29.8", "debug": "^4.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/types": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@bramus/specificity": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", "dev": true, "license": "MIT", "dependencies": { "css-tree": "^3.0.0" }, "bin": { "specificity": "bin/cli.js" } }, "node_modules/@csstools/color-helpers": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.1.tgz", "integrity": "sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT-0", "engines": { "node": ">=20.19.0" } }, "node_modules/@csstools/css-calc": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.0.tgz", "integrity": "sha512-XQKj5B7QiZcHiegCOCAzcAOJdhGgWOHbbu62h5e5mkHnn8lWcfiJhllkqWmxu5zWR9jucPHuo1iTB56P033hcg==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-color-parser": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.3.tgz", "integrity": "sha512-y4LpL+lmpuyKDiEFq2PnZUVFdAjsoB/qQJod79yLNokXyW7jewi+/WJ69EfItj8A2unWtxXnGjw6LYXgXu5ZjA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "dependencies": { "@csstools/color-helpers": "^6.1.1", "@csstools/css-calc": "^3.4.0" }, "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-parser-algorithms": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-syntax-patches-for-csstree": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.14.tgz", "integrity": "sha512-HpbVXyrofRXpHpgkNIjU/3EWR4WJvOkO3emNK/L6X/mTJU7bGUI3AkkpoTNXznQLp0KRjLHELTGeKI5dIkI9JQ==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT-0", "peerDependencies": { "css-tree": "^3.2.1" }, "peerDependenciesMeta": { "css-tree": { "optional": true } } }, "node_modules/@csstools/css-tokenizer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.1.tgz", "integrity": "sha512-bPlN9S9O1A0euCpEWE4qnvB5YDuyYVsUTrxSgmAM1Is0j4tICHoVyOVAXfWMP/kS9ZrjvyIXWV2PmomiAXXqOw==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" } }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", "cpu": [ "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "aix" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-arm": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", "cpu": [ "loong64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", "cpu": [ "mips64el" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", "cpu": [ "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", "cpu": [ "riscv64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", "cpu": [ "s390x" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/netbsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openbsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openharmony-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openharmony" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "sunos" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@exodus/bytes": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==", "dev": true, "license": "MIT", "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" }, "peerDependencies": { "@noble/hashes": "^1.8.0 || ^2.0.0" }, "peerDependenciesMeta": { "@noble/hashes": { "optional": true } } }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "node_modules/@jridgewell/remapping": { "version": "2.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.31", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@microsoft/signalr": { "version": "8.0.29", "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.29.tgz", "integrity": "sha512-yzszFiTAuRxHm3qxNaSan3YzN8dffLqQcc3ZNJD2tn9eInCBBi7u2xCJ6AVNXjw19RDoBc+NPWfYN43K1HcjdA==", "license": "MIT", "dependencies": { "abort-controller": "^3.0.0", "eventsource": "^2.0.2", "fetch-cookie": "^2.0.3", "node-fetch": "^2.6.7", "ws": "^7.5.10" } }, "node_modules/@napi-rs/lzma-linux-x64-gnu": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", "cpu": [ "x64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": "^22.20 || ^24.12 || >=25" } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" }, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.stat": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" }, "engines": { "node": ">= 8" } }, "node_modules/@remix-run/router": { "version": "1.23.4", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.4.tgz", "integrity": "sha512-q7j5geK7xs3UJSdm9/iytUNclBnLmYx1EnSeCFXHPeutdqgIMeFeHtUZgS3EhlKxdBEAu8OwtJCwmLrEzpSs7Q==", "license": "MIT", "engines": { "node": ">=14.0.0" } }, "node_modules/@rolldown/pluginutils": { "version": "1.0.0-beta.27", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", "dev": true, "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.4.tgz", "integrity": "sha512-I+BSHzTAhKN2n7ZwGZsegGcZjDpLqFOMAtJz/u6uFGe0pUFbq56dEHjqJV/ZUdRJtNXNxA+hREUatZBvMR3Oiw==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.4.tgz", "integrity": "sha512-pu3BdjS2LtEzRu2elmGzS3fIeWSZy4BMDIaLNwjorO76+k2d0LMluijhsDx3KQyQBQ/lLUZCQA9/s6csvUfuhw==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.4.tgz", "integrity": "sha512-xfSrj9MHnWK9GaSqT9U0ImHtH/N8WZlHLx4cZHiuLcqs640hvZ3hLPd5UR2AZS57FaE8HrRUSpltbZdWRxHiDA==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.4.tgz", "integrity": "sha512-bqU99PLJb/dqb3S0GIMdeuyAEETSUgZBoqXYd3Sd+WCsV+MmPhnN6JrotWyir31+QgH7EvvE5/mwGJlEoci8Fw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-freebsd-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.4.tgz", "integrity": "sha512-JinsFZ5G40oXQb+sUuiA5x689vhr6dDYK0H0NL+rwKdL6CqnmYN8PE4ZwfRSoIjrCxqTQG/SLfTtSvHeGxoVlw==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-freebsd-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.4.tgz", "integrity": "sha512-GAdA4UxpiNm27cLHr2GqXBpAD0x9FqwYBY7/YSP0Ss0/PNi4k8gbviqpIpYbVSRBaS2ZcegXEzgTQMbRNCwxCw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.4.tgz", "integrity": "sha512-qDd6NoA1znaLjp4jR5U/KWCdLAKDJNB8W9ChbbDaKbo0xA+Atln5HK6LFCZ4oJQpemtRZA288DCirFRjrspptw==", "cpu": [ "arm" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.4.tgz", "integrity": "sha512-WtB5Tz5KTNINb8ZA+8sQ7bmjuS1JrRT7YverYIhUGdWWDlpzVWmIwuZE+jidkEXUn1l0zrEkaIMa8dHF3NGcsA==", "cpu": [ "arm" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.4.tgz", "integrity": "sha512-VcQ3L1tjnkKzWjryAVaFhHEWcqOfICX9uxVVoDzm2t0DpgKRHd2zOpVrJc0xsWeBZcBFyYROCIBdyR/fS174pg==", "cpu": [ "arm64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.4.tgz", "integrity": "sha512-6+ZQX6P5s0cMDN2Ypb8Lbm2+/sZYmZjdaYny992ujUU9UKi/4CWoJWsl1pNvjWJHNHGK51m+jKGLlh1ylb2ifQ==", "cpu": [ "arm64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.4.tgz", "integrity": "sha512-D72ZnvkFkBXOfzMMQLcwfPLyGkKb7HZ9/mf97B7v6/P5Lbv4oFOtSY/uHbS8lH6uKUOxoKiuokdb50XZSzzbJw==", "cpu": [ "loong64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.4.tgz", "integrity": "sha512-piU6BxeqA3O9KSu3kRCIQQtNqFFaTu21SEV4FwaRZowpnj3bLaWPZHw+xFqCs0XlJ+aOH3PTRWGoglH+mKA/OA==", "cpu": [ "loong64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.4.tgz", "integrity": "sha512-/5PGpHwqt2EEEOUs1XwzubE/ucr0dWDQ+to3zqi4Ds7EWpwtQ79wXc4JBoxqj/OwpawTsKWzJxHfSuBOq3DrWA==", "cpu": [ "ppc64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.4.tgz", "integrity": "sha512-cX3beZDLWt7G2oJF+nhChiT+qtaihs+S2xi7ziGmVB+2pwPng6D0Ed0HmElQOgv2UsUmSJJLGwpBao/3TDx3VA==", "cpu": [ "ppc64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.4.tgz", "integrity": "sha512-1uz2mGWHyptR7DgHHrlbdRAjXK7v7elGZ9lMja910/RP+ZYbX6xAmCiU9UZSX4hqmgtHMv6lr5l3kq1HIOpcag==", "cpu": [ "riscv64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.4.tgz", "integrity": "sha512-nLS8topojxyz7SRpKR2IODRpQ0XPZ+xaOXvT3+hqK/Uy8Lo5HFgkkIBiIrCu5tL5YqzTvgovGw55PwpahTAGig==", "cpu": [ "riscv64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.4.tgz", "integrity": "sha512-gs7DRKotr3l3q+jGPQBjH0ng1FjlEDm5ueQrkw5JtQvtLyEIcLASqAEaor56BhkKRzk+IcQzrcanBdb/bBQn8g==", "cpu": [ "s390x" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.4.tgz", "integrity": "sha512-791ET7W17NnScOZM7h4dX5hYspxE28htPFsb1awY/NRR8+PRNkS53e475rDdxXXDrP+kwnCcNWg9CX5ztn/Aqw==", "cpu": [ "x64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.4.tgz", "integrity": "sha512-iwZQRcmj7g88g3tzefIrQY7qvmuA/cfYwhrDtTBhsmukO4U2huVO5W+86XacUMRvdSFVAc6kZUZy21JaRwiB9w==", "cpu": [ "x64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-openbsd-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.4.tgz", "integrity": "sha512-dVHFp9gRWrdTpnqQuGfCwd7hOQDatK1VCP2iWhLY/cGrOQs/ucFzJ6A5SRqbXX12ZDI8EUuejSM5kwg+ja7Png==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ] }, "node_modules/@rollup/rollup-openharmony-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.4.tgz", "integrity": "sha512-t3NlauOW6gxZVVFcBEnO62Cb4wbyDFL416gTg1uFI/2tgqYQlf69FbSE115Ajre9I+c26Lk4mcmdFUsS/DGifQ==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openharmony" ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.4.tgz", "integrity": "sha512-xWuIaSye5FWZF8+UYtVEcHtRJDN5kN9Kfgxx3Kq8XIov9KSKbc1fiqQCm90SKrgQbUXZelbnUhnlUJmfSE7P9A==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.4.tgz", "integrity": "sha512-9ALJJUOg/ZflMJepVo2PlgsGxSaxN7SQ4Z8GoZfVlarWr6r3rkHUNsd/zAio7p4YMtChSMXPionxej4Hkf6CXQ==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.4.tgz", "integrity": "sha512-blj9z5qx/Pv4WU0W1NMFDB97e0JH5ed+aZGywW8WCvp/NhWX/4PFAq5uu6Q0AebNn+Vo6KzUYDT++JzTT5ojlQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.4.tgz", "integrity": "sha512-Erx822VRBwLa124shbj+wNXe//BOgMEctDV0m1aqTQdNO1S69DgNUCFKC1RCeZfixs1J31l6igk1ziyXErbigQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@testing-library/dom": { "version": "10.4.2", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" }, "engines": { "node": ">=18" } }, "node_modules/@testing-library/jest-dom": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-7.0.1.tgz", "integrity": "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==", "dev": true, "license": "MIT", "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" }, "engines": { "node": ">=22", "npm": ">=6", "yarn": ">=1" }, "peerDependencies": { "@testing-library/dom": ">=10 <11", "vitest": ">= 0.32" }, "peerDependenciesMeta": { "vitest": { "optional": true } } }, "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", "dev": true, "license": "MIT" }, "node_modules/@testing-library/react": { "version": "16.3.3", "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5" }, "engines": { "node": ">=18" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true }, "@types/react-dom": { "optional": true } } }, "node_modules/@testing-library/user-event": { "version": "14.6.7", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.7.tgz", "integrity": "sha512-MPCpX8bxe8zS+JmmTwLp8jd0dy1rAm60Te/SL8JrQM3qvQJcBOs1d7IefJMyZzqM3EWBrDn/LWDt1BCGu4ASfg==", "dev": true, "license": "MIT", "engines": { "node": ">=12", "npm": ">=6" }, "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true, "license": "MIT", "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "node_modules/@types/babel__generator": { "version": "7.27.0", "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__traverse": { "version": "7.28.0", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.28.2" } }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", "dev": true, "license": "MIT", "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "node_modules/@types/deep-eql": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", "dev": true, "license": "MIT" }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, "node_modules/@types/prop-types": { "version": "15.7.15", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", "dev": true, "license": "MIT" }, "node_modules/@types/react": { "version": "18.3.31", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz", "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==", "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" } }, "node_modules/@types/react-dom": { "version": "18.3.7", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^18.0.0" } }, "node_modules/@vitejs/plugin-react": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "node_modules/@vitest/mocker": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.1.tgz", "integrity": "sha512-6K1DoBNAPGvuOcSsGA4D6x+5zEEff/KmOOP3uetT2TrGpVfI+HRHRnJJfKi5ib/g1vx8IYHQD8s0pbJz8WQI7Q==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.0.1", "estree-walker": "^3.0.3", "magic-string": "^1.2.3" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "msw": { "optional": true }, "vite": { "optional": true } } }, "node_modules/@vitest/spy": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.1.tgz", "integrity": "sha512-rbto/mF/SGERxEgYOek7Xm6B9b+y+mVoo+f4b2LymYO8zM1b7uB5nHuhVMTP2hxdzgxvGiZYGxGIaMvL5y180Q==", "dev": true, "license": "MIT", "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "license": "MIT", "dependencies": { "event-target-shim": "^5.0.0" }, "engines": { "node": ">=6.5" } }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", "dev": true, "license": "MIT" }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" }, "engines": { "node": ">= 8" } }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "dev": true, "license": "MIT" }, "node_modules/aria-query": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, "license": "Apache-2.0", "dependencies": { "dequal": "^2.0.3" } }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" } }, "node_modules/autoprefixer": { "version": "10.6.1", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.6.1.tgz", "integrity": "sha512-cL1Qz6ADZhcEbny/8HPfe99J6HhNoYtpX2LFLIbhgGE7Q1hlQVkYFdetDN7Id3KiQxhDrHwzlHr/YQCnZ8+xSA==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/autoprefixer" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "browserslist": "^4.28.9", "caniuse-lite": "^1.0.30001810", "fraction.js": "^5.3.4", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { "autoprefixer": "bin/autoprefixer" }, "engines": { "node": "^10 || ^12 || >=14" }, "peerDependencies": { "postcss": "^8.1.0" } }, "node_modules/baseline-browser-mapping": { "version": "2.11.25", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz", "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==", "dev": true, "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" }, "engines": { "node": ">=6.0.0" } }, "node_modules/bidi-js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", "dev": true, "license": "MIT", "dependencies": { "require-from-string": "^2.0.2" } }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "license": "MIT", "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, "engines": { "node": ">=8" } }, "node_modules/browserslist": { "version": "4.29.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "baseline-browser-mapping": "^2.11.23", "caniuse-lite": "^1.0.30001810", "electron-to-chromium": "^1.5.427", "node-releases": "^2.0.55", "update-browserslist-db": "^1.3.3" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, "node_modules/camelcase-css": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/caniuse-lite": { "version": "1.0.30001810", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "CC-BY-4.0" }, "node_modules/chai": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "engines": { "node": ">= 8.10.0" }, "funding": { "url": "https://paulmillr.com/funding/" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/chokidar/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true, "license": "MIT" }, "node_modules/css-tree": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", "dev": true, "license": "MIT", "dependencies": { "mdn-data": "2.27.1", "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, "node_modules/css.escape": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", "dev": true, "license": "MIT" }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true, "license": "MIT", "bin": { "cssesc": "bin/cssesc" }, "engines": { "node": ">=4" } }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "dev": true, "license": "MIT" }, "node_modules/data-urls": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", "dev": true, "license": "MIT", "dependencies": { "whatwg-mimetype": "^5.0.0", "whatwg-url": "^16.0.0" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/data-urls/node_modules/tr46": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", "dev": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "engines": { "node": ">=20" } }, "node_modules/data-urls/node_modules/webidl-conversions": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20" } }, "node_modules/data-urls/node_modules/whatwg-url": { "version": "16.0.1", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.11.0", "tr46": "^6.0.0", "webidl-conversions": "^8.0.1" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", "dev": true, "license": "MIT" }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true, "license": "Apache-2.0" }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "dev": true, "license": "MIT" }, "node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true, "license": "MIT", "peer": true }, "node_modules/electron-to-chromium": { "version": "1.5.433", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.433.tgz", "integrity": "sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA==", "dev": true, "license": "ISC" }, "node_modules/entities": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20.19.0" }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/es-errors": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/es-module-lexer": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", "dev": true, "license": "MIT" }, "node_modules/esbuild": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { "node": ">=18" }, "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" } }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.0" } }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/eventsource": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", "license": "MIT", "engines": { "node": ">=12.0.0" } }, "node_modules/expect-type": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.0.0" } }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" }, "engines": { "node": ">=8.6.0" } }, "node_modules/fast-glob/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/fastq": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", "dev": true, "license": "ISC", "dependencies": { "reusify": "^1.0.4" } }, "node_modules/fetch-cookie": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.2.0.tgz", "integrity": "sha512-h9AgfjURuCgA2+2ISl8GbavpUdR+WGAM2McW/ovn4tVccegp8ZqCKWSBR8uRdM8dDNlx5WdKRWxBYUwteLDCNQ==", "license": "Unlicense", "dependencies": { "set-cookie-parser": "^2.4.8", "tough-cookie": "^4.0.0" } }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/fraction.js": { "version": "5.3.4", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", "dev": true, "license": "MIT", "engines": { "node": "*" }, "funding": { "type": "github", "url": "https://github.com/sponsors/rawify" } }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, "engines": { "node": ">=10.13.0" } }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/html-encoding-sniffer": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.6.0" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-core-module": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.4" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "license": "MIT", "engines": { "node": ">=0.12.0" } }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true, "license": "MIT" }, "node_modules/jiti": { "version": "1.21.7", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, "license": "MIT", "bin": { "jiti": "bin/jiti.js" } }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "license": "MIT" }, "node_modules/jsdom": { "version": "30.1.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.0.tgz", "integrity": "sha512-h/Q+H+KmlGf49ITw3TrykSVbg04S75S2O7ZtJc9gMGOWBrQRZmx5AJIKLtJ01e6Kszl+/tpFthCVqxNifxhoqg==", "dev": true, "license": "MIT", "dependencies": { "@asamuzakjp/css-color": "^7.0.0", "@asamuzakjp/dom-selector": "^9.1.2", "@bramus/specificity": "^2.4.2", "@csstools/css-syntax-patches-for-csstree": "^1.1.13", "@exodus/bytes": "^1.15.1", "css-tree": "^3.2.1", "data-urls": "^7.0.0", "decimal.js": "^10.6.0", "html-encoding-sniffer": "^6.0.0", "is-potential-custom-element-name": "^1.0.1", "lru-cache": "^11.5.2", "parse5": "^8.0.1", "saxes": "^6.0.0", "tough-cookie": "^6.0.2", "undici": "^8.10.2", "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^8.0.1", "whatwg-mimetype": "^5.0.0", "whatwg-url": "^17.1.1", "xml-name-validator": "^5.0.0" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" }, "peerDependencies": { "canvas": "^3.2.3" }, "peerDependenciesMeta": { "canvas": { "optional": true } } }, "node_modules/jsdom/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/jsdom/node_modules/tough-cookie": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { "tldts": "^7.0.5" }, "engines": { "node": ">=16" } }, "node_modules/jsdom/node_modules/tr46": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", "dev": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "engines": { "node": ">=20" } }, "node_modules/jsdom/node_modules/webidl-conversions": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20" } }, "node_modules/jsdom/node_modules/whatwg-url": { "version": "17.1.2", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.2.tgz", "integrity": "sha512-TEZA+Zqxin7Jjsm2cjRohCmen5awh+hT6Zi3VZdqZlNRk7zvOI/9WpBFg/DWlA56bWnzwm6DuB8NS0EsxQH9uQ==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.15.1", "tr46": "^6.0.0", "webidl-conversions": "^8.0.1" }, "engines": { "node": "^22.14.0 || >=24.0.0" } }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { "node": ">=6" } }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "license": "MIT", "bin": { "json5": "lib/cli.js" }, "engines": { "node": ">=6" } }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "dev": true, "license": "MIT", "engines": { "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/antonk52" } }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true, "license": "MIT" }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "license": "MIT", "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "license": "ISC", "dependencies": { "yallist": "^3.0.2" } }, "node_modules/lucide-react": { "version": "0.475.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.475.0.tgz", "integrity": "sha512-NJzvVu1HwFVeZ+Gwq2q00KygM1aBhy/ZrhY9FsAgJtpB+E4R7uxRk9M2iKvHa6/vNxZydIB59htha4c2vvwvVg==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "license": "MIT", "peer": true, "bin": { "lz-string": "bin/bin.js" } }, "node_modules/magic-string": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.1.tgz", "integrity": "sha512-8lyCu36ErXR0J9uaGKlKQoiLZKmtI63YGLE8G2o9jyRPdr4X47LusSOwgOJOzcVtp81fTAAjxR7BwKz682Jhow==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "node_modules/mdn-data": { "version": "2.27.1", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", "dev": true, "license": "CC0-1.0" }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" } }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true, "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "license": "MIT" }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", "dev": true, "license": "MIT", "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "node_modules/nanoid": { "version": "3.3.19", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, "engines": { "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, "engines": { "node": "4.x || >=6.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "peerDependenciesMeta": { "encoding": { "optional": true } } }, "node_modules/node-releases": { "version": "2.0.56", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.56.tgz", "integrity": "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-hash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/obug": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", "dev": true, "funding": [ "https://github.com/sponsors/sxzz", "https://opencollective.com/debug" ], "license": "MIT", "engines": { "node": ">=12.20.0" } }, "node_modules/parse5": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", "dev": true, "license": "MIT", "dependencies": { "entities": "^8.0.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" } }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true, "license": "MIT" }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true, "license": "MIT", "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pirates": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/playwright": { "version": "1.63.0", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.63.0.tgz", "integrity": "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==", "dev": true, "license": "Apache-2.0", "dependencies": { "playwright-core": "1.63.0" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=20" } }, "node_modules/playwright-core": { "version": "1.63.0", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz", "integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==", "dev": true, "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { "node": ">=20" } }, "node_modules/postcss": { "version": "8.5.28", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "nanoid": "^3.3.18", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" } }, "node_modules/postcss-import": { "version": "15.1.0", "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", "dev": true, "license": "MIT", "dependencies": { "postcss-value-parser": "^4.0.0", "read-cache": "^1.0.0", "resolve": "^1.1.7" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "postcss": "^8.0.0" } }, "node_modules/postcss-js": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "camelcase-css": "^2.0.1" }, "engines": { "node": "^12 || ^14 || >= 16" }, "peerDependencies": { "postcss": "^8.4.21" } }, "node_modules/postcss-load-config": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "lilconfig": "^3.1.1" }, "engines": { "node": ">= 18" }, "peerDependencies": { "jiti": ">=1.21.0", "postcss": ">=8.0.9", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "peerDependenciesMeta": { "jiti": { "optional": true }, "postcss": { "optional": true }, "tsx": { "optional": true }, "yaml": { "optional": true } } }, "node_modules/postcss-nested": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.1.1" }, "engines": { "node": ">=12.0" }, "peerDependencies": { "postcss": "^8.2.14" } }, "node_modules/postcss-selector-parser": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", "dev": true, "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" }, "engines": { "node": ">=4" } }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true, "license": "MIT" }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/psl": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "funding": { "url": "https://github.com/sponsors/lupomontero" } }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", "license": "MIT" }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "license": "MIT" }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" }, "peerDependencies": { "react": "^18.3.1" } }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true, "license": "MIT", "peer": true }, "node_modules/react-refresh": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-router": { "version": "6.30.6", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.6.tgz", "integrity": "sha512-5HfK7k5im7LTOB0EqCQmfvy4C13G92Ssj1VTmouTK3AJvyjKTnFuCV0vcMAD/JS+JC4DvDIBRrlAeJIFjh5VWg==", "license": "MIT", "dependencies": { "@remix-run/router": "1.23.4" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8" } }, "node_modules/react-router-dom": { "version": "6.30.6", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.6.tgz", "integrity": "sha512-0RHKZz7wwffvkU+2MFVT2NnjK44ssLEV+m0CAJaS2Ksmorrwj7WxH00jO0SOCW26/tINUnJHToXblDs33I38YQ==", "license": "MIT", "dependencies": { "@remix-run/router": "1.23.4", "react-router": "6.30.6" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8", "react-dom": ">=16.8" } }, "node_modules/read-cache": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz", "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==", "dev": true, "license": "MIT" }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, "engines": { "node": ">=8.10.0" } }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, "license": "MIT", "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "license": "MIT" }, "node_modules/resolve": { "version": "1.22.12", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rollup": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.4.tgz", "integrity": "sha512-4U0liVayNIoLp3GFl1FcI8561WepLnZ1rqfraGh7S9B3Ur5F9S283y8Futii7RUU2C/97tOBmBy7nYvhoiOpbQ==", "dev": true, "license": "MIT", "dependencies": { "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.63.4", "@rollup/rollup-android-arm64": "4.63.4", "@rollup/rollup-darwin-arm64": "4.63.4", "@rollup/rollup-darwin-x64": "4.63.4", "@rollup/rollup-freebsd-arm64": "4.63.4", "@rollup/rollup-freebsd-x64": "4.63.4", "@rollup/rollup-linux-arm-gnueabihf": "4.63.4", "@rollup/rollup-linux-arm-musleabihf": "4.63.4", "@rollup/rollup-linux-arm64-gnu": "4.63.4", "@rollup/rollup-linux-arm64-musl": "4.63.4", "@rollup/rollup-linux-loong64-gnu": "4.63.4", "@rollup/rollup-linux-loong64-musl": "4.63.4", "@rollup/rollup-linux-ppc64-gnu": "4.63.4", "@rollup/rollup-linux-ppc64-musl": "4.63.4", "@rollup/rollup-linux-riscv64-gnu": "4.63.4", "@rollup/rollup-linux-riscv64-musl": "4.63.4", "@rollup/rollup-linux-s390x-gnu": "4.63.4", "@rollup/rollup-linux-x64-gnu": "4.63.4", "@rollup/rollup-linux-x64-musl": "4.63.4", "@rollup/rollup-openbsd-x64": "4.63.4", "@rollup/rollup-openharmony-arm64": "4.63.4", "@rollup/rollup-win32-arm64-msvc": "4.63.4", "@rollup/rollup-win32-ia32-msvc": "4.63.4", "@rollup/rollup-win32-x64-gnu": "4.63.4", "@rollup/rollup-win32-x64-msvc": "4.63.4", "fsevents": "~2.3.2" } }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, "license": "ISC", "dependencies": { "xmlchars": "^2.2.0" }, "engines": { "node": ">=v12.22.7" } }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" } }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" } }, "node_modules/set-cookie-parser": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", "license": "MIT" }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true, "license": "ISC" }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true, "license": "MIT" }, "node_modules/std-env": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", "dev": true, "license": "MIT" }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, "license": "MIT", "dependencies": { "min-indent": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/sucrase": { "version": "3.35.1", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" }, "engines": { "node": ">=16 || 14 >=14.17" } }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/tailwind-merge": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.6.1.tgz", "integrity": "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ==", "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/dcastil" } }, "node_modules/tailwindcss": { "version": "3.4.19", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", "dev": true, "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", "jiti": "^1.21.7", "lilconfig": "^3.1.3", "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.1.1", "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", "postcss-nested": "^6.2.0", "postcss-selector-parser": "^6.1.2", "resolve": "^1.22.8", "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", "tailwindcss": "lib/cli.js" }, "engines": { "node": ">=14.0.0" } }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, "license": "MIT", "dependencies": { "any-promise": "^1.0.0" } }, "node_modules/thenify-all": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", "dev": true, "license": "MIT", "dependencies": { "thenify": ">= 3.1.0 < 4" }, "engines": { "node": ">=0.8" } }, "node_modules/tinybench": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.1.4.tgz", "integrity": "sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" } }, "node_modules/tinyexec": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" }, "funding": { "url": "https://github.com/sponsors/SuperchupuDev" } }, "node_modules/tinyglobby/node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", "engines": { "node": ">=12.0.0" }, "peerDependencies": { "picomatch": "^3 || ^4" }, "peerDependenciesMeta": { "picomatch": { "optional": true } } }, "node_modules/tinyglobby/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/tldts": { "version": "7.4.13", "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.13.tgz", "integrity": "sha512-iHtaIWWIbMDkCeJdTBzZFGgbluE5J+oHlb2g7+oAz1S1gpuVpabRZdQyd471Vl8UUkcz2vXSL8xZH2kyCe8tfA==", "dev": true, "license": "MIT", "dependencies": { "tldts-core": "^7.4.13" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { "version": "7.4.13", "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.13.tgz", "integrity": "sha512-mbYsrih5FRtGxs3Usvl/PqwJsNpp+jsmrdFviiK02teHDG0/HebBG/pqCylje3kzgXYzuLoHJF/0mz9W53t8Xg==", "dev": true, "license": "MIT" }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/tough-cookie": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", "license": "BSD-3-Clause", "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", "universalify": "^0.2.0", "url-parse": "^1.5.3" }, "engines": { "node": ">=6" } }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "license": "MIT" }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", "dev": true, "license": "Apache-2.0" }, "node_modules/typescript": { "version": "5.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=14.17" } }, "node_modules/undici": { "version": "8.10.2", "resolved": "https://registry.npmjs.org/undici/-/undici-8.10.2.tgz", "integrity": "sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ==", "dev": true, "license": "MIT", "engines": { "node": ">=22.19.0" } }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "license": "MIT", "engines": { "node": ">= 4.0.0" } }, "node_modules/update-browserslist-db": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" } }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "license": "MIT", "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true, "license": "MIT" }, "node_modules/vite": { "version": "6.4.3", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "bin": { "vite": "bin/vite.js" }, "engines": { "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, "jiti": { "optional": true }, "less": { "optional": true }, "lightningcss": { "optional": true }, "sass": { "optional": true }, "sass-embedded": { "optional": true }, "stylus": { "optional": true }, "sugarss": { "optional": true }, "terser": { "optional": true }, "tsx": { "optional": true }, "yaml": { "optional": true } } }, "node_modules/vite/node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", "engines": { "node": ">=12.0.0" }, "peerDependencies": { "picomatch": "^3 || ^4" }, "peerDependenciesMeta": { "picomatch": { "optional": true } } }, "node_modules/vite/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/vitest": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.1.tgz", "integrity": "sha512-iA95lQbKEkvrtTkdAgnWbXfbipWiiWe/hDl2P5tMi6WFwD76G0NxXAGp/M9EOcYupeGJRr6wppMc7CoA41TQjg==", "dev": true, "license": "MIT", "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.0.1", "chai": "^6.2.2", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.2.3", "obug": "^2.1.4", "picomatch": "^4.0.7", "std-env": "^4.2.0", "tinybench": "6.1.4", "tinyexec": "1.3.0", "tinyglobby": "^0.2.17", "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { "node": "^22.12.0 || ^24.0.0 || >=26.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.0.1", "@vitest/browser-preview": "5.0.1", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.0.1", "@vitest/coverage-v8": "5.0.1", "@vitest/ui": "5.0.1", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "@edge-runtime/vm": { "optional": true }, "@opentelemetry/api": { "optional": true }, "@types/node": { "optional": true }, "@vitest/browser-playwright": { "optional": true }, "@vitest/browser-preview": { "optional": true }, "@vitest/browser-webdriverio": { "optional": true }, "@vitest/coverage-istanbul": { "optional": true }, "@vitest/coverage-v8": { "optional": true }, "@vitest/ui": { "optional": true }, "happy-dom": { "optional": true }, "jsdom": { "optional": true }, "vite": { "optional": false } } }, "node_modules/vitest/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dev": true, "license": "MIT", "dependencies": { "xml-name-validator": "^5.0.0" }, "engines": { "node": ">=18" } }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, "node_modules/whatwg-mimetype": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", "dev": true, "license": "MIT", "engines": { "node": ">=20" } }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "node_modules/why-is-node-running": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, "license": "MIT", "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" }, "engines": { "node": ">=8" } }, "node_modules/ws": { "version": "7.5.13", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.13.tgz", "integrity": "sha512-rsKI6xDBFVf4r/x8XyChGK04QR/XHroxs/jUcoWvtEZM8TPU/X/uIY9B1CsSzYws9ZJb/6bbBu7dPhFW00CAoA==", "license": "MIT", "engines": { "node": ">=8.3.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/xml-name-validator": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "dev": true, "license": "Apache-2.0", "engines": { "node": ">=18" } }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true, "license": "MIT" }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "license": "ISC" } } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/package.json SIZE: 932 chars SHA256: 5A8E537F6900EEA1BC3E774C807BAD5F393E2F0BA1015B3D79EAC2187A2BA423 ===================================================================== */ { "name": "classnotify-web", "private": true, "version": "2.1.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", "test": "vitest run" }, "dependencies": { "@microsoft/signalr": "^8.0.7", "clsx": "^2.1.1", "lucide-react": "^0.475.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.28.0", "tailwind-merge": "^2.6.0" }, "devDependencies": { "@testing-library/jest-dom": "^7.0.1", "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.6.7", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.20", "jsdom": "^30.1.0", "playwright": "^1.63.0", "postcss": "^8.4.49", "tailwindcss": "^3.4.17", "typescript": "~5.6.2", "vite": "^6.0.1", "vitest": "^5.0.1" } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/postcss.config.js SIZE: 80 chars SHA256: 190C877DB466995BF1482F4A16ABD06E04A89EDE3119341E2A86FF96E1737B27 ===================================================================== */ export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, } /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/api/client.ts SIZE: 9490 chars SHA256: FC9C311F9464D089A3C27A0B1E49D519BDF91DD652808AB47ED0B54941CA5B52 ===================================================================== */ import { AdminMetrics, TenantAdmin, DeviceAdmin, ActivationCode, Classroom, TeacherUser, NotificationRecord, SendNotificationPayload, LoginResult, CurrentUser, UserAdmin, CreateUserAdminRequest, CreateTenantRequest, UpdateTenantRequest, UpdateDeviceRequest, EmergencyBroadcastRequest, SystemHealth, AdminAuditLog, BroadcastReceiptSummary } from '../types'; import { sessionManager } from '../realtime/SessionManager'; const API_BASE = '/api'; export function getToken(): string | null { return localStorage.getItem('classnotify_token'); } export function setToken(token: string) { localStorage.setItem('classnotify_token', token); } export function clearToken() { localStorage.removeItem('classnotify_token'); localStorage.removeItem('classnotify_user'); } async function request(endpoint: string, options: RequestInit = {}): Promise { const token = getToken(); const headers: Record = { 'Content-Type': 'application/json', ...(options.headers as Record), }; if (token) { headers['Authorization'] = `Bearer ${token}`; } const res = await fetch(`${API_BASE}${endpoint}`, { ...options, headers, }); if (res.status === 401) { clearToken(); sessionManager.notifySessionExpired('未授权或登录已过期,请重新登录'); throw new Error('未授权或登录已过期,请重新登录'); } if (!res.ok) { let errorMsg = `请求失败 (${res.status})`; try { const err = await res.json(); errorMsg = err.message || err.errorMessage || errorMsg; } catch { // ignore json parse error } throw new Error(errorMsg); } return res.json() as Promise; } export const api = { // Auth login: (username: string, password: string): Promise => request('/auth/login', { method: 'POST', body: JSON.stringify({ username, password }), }), getMe: (): Promise => request('/auth/me'), // SuperAdmin getAdminMetrics: (): Promise => request('/admin/metrics'), getTenants: (): Promise => request('/admin/tenants'), getAllDevices: (): Promise => request('/admin/devices'), sendDeviceCommand: (deviceId: string, command: string, parameters?: string) => request<{ success: boolean; message: string }>(`/admin/devices/${deviceId}/command`, { method: 'POST', body: JSON.stringify({ command, parameters }), }), getAdminActivationCodes: (): Promise => request('/admin/activation-codes'), getAdminClasses: (tenantId: string): Promise => request(`/admin/classes?tenantId=${encodeURIComponent(tenantId)}`), generateAdminCode: (tenantId: string, classId: string) => request<{ success: boolean; code: string; message: string }>( `/admin/activation-codes?tenantId=${encodeURIComponent(tenantId)}&classId=${encodeURIComponent(classId)}`, { method: 'POST' } ), getAdminNotifications: (limit = 50): Promise => request(`/admin/notifications?limit=${limit}`), // Tenant Management createTenant: (dto: CreateTenantRequest): Promise => request('/admin/tenants', { method: 'POST', body: JSON.stringify(dto), }), updateTenant: (tenantId: string, dto: UpdateTenantRequest): Promise => request(`/admin/tenants/${encodeURIComponent(tenantId)}`, { method: 'PATCH', body: JSON.stringify(dto), }), // User Management getUsers: (tenantId?: string, role?: string): Promise => { const params = new URLSearchParams(); if (tenantId) params.append('tenantId', tenantId); if (role) params.append('role', role); const qs = params.toString(); return request(`/admin/users${qs ? `?${qs}` : ''}`); }, createUser: (dto: CreateUserAdminRequest): Promise => request('/admin/users', { method: 'POST', body: JSON.stringify(dto), }), resetPassword: (userId: string, newPassword: string) => request<{ success: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}/reset-password`, { method: 'POST', body: JSON.stringify({ newPassword }), }), setUserLock: (userId: string, isLocked: boolean) => request<{ success: boolean; isLocked: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}/lock`, { method: 'POST', body: JSON.stringify({ isLocked }), }), deleteUser: (userId: string) => request<{ success: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}`, { method: 'DELETE', }), // Device Extensions updateDevice: (deviceId: string, dto: UpdateDeviceRequest) => request<{ success: boolean; message: string }>(`/admin/devices/${encodeURIComponent(deviceId)}`, { method: 'PATCH', body: JSON.stringify(dto), }), decommissionDevice: (deviceId: string) => request<{ success: boolean; message: string }>(`/admin/devices/${encodeURIComponent(deviceId)}/decommission`, { method: 'POST', }), // Activation Code Management deleteActivationCode: (code: string) => request<{ success: boolean; message: string }>(`/admin/activation-codes/${encodeURIComponent(code)}`, { method: 'DELETE', }), // Emergency Broadcast sendEmergencyBroadcast: (dto: EmergencyBroadcastRequest) => request<{ success: boolean; broadcastId: string; dispatchedCount: number; targetSchools: number; message: string }>('/admin/broadcasts', { method: 'POST', body: JSON.stringify(dto), }), getBroadcastReceiptSummary: (broadcastId: string): Promise => request(`/admin/broadcasts/${encodeURIComponent(broadcastId)}/receipt-summary`), // System Health & Audit getSystemHealth: (): Promise => request('/admin/system/health'), getAuditLogs: (limit = 100): Promise => request(`/admin/audit-logs?limit=${limit}`), // School Admin getSchoolOverview: (): Promise<{ tenantId: string; tenantName: string; classCount: number; deviceCount: number; onlineCount: number; teacherCount: number; }> => request('/school-admin/overview'), getSchoolClasses: (): Promise => request('/school-admin/classes'), createSchoolClass: (dto: { id: string; displayName: string; grade?: string; roomNumber?: string }) => request<{ success: boolean; message: string }>('/school-admin/classes', { method: 'POST', body: JSON.stringify(dto), }), getSchoolTeachers: (): Promise => request('/school-admin/teachers'), createSchoolTeacher: (dto: { username: string; password: string; fullName: string; role: string }) => request<{ success: boolean; message: string }>('/school-admin/teachers', { method: 'POST', body: JSON.stringify(dto), }), resetSchoolTeacherPassword: (userId: string, newPassword: string) => request<{ success: boolean; message: string }>(`/school-admin/teachers/${encodeURIComponent(userId)}/reset-password`, { method: 'POST', body: JSON.stringify({ newPassword }), }), setSchoolTeacherLock: (userId: string, isLocked: boolean) => request<{ success: boolean; message: string }>(`/school-admin/teachers/${encodeURIComponent(userId)}/lock`, { method: 'POST', body: JSON.stringify({ isLocked }), }), getSchoolDevices: (): Promise => request('/school-admin/devices'), getSchoolCodes: (): Promise => request('/school-admin/activation-codes'), generateSchoolCode: (classId: string) => request<{ success: boolean; code: string; message: string }>( `/school-admin/activation-codes?classId=${encodeURIComponent(classId)}`, { method: 'POST' } ), // Teacher getTeacherClasses: (): Promise => request('/notification/classes'), sendNotification: (payload: SendNotificationPayload) => request<{ success: boolean; messageId: string; className: string; message: string }>( '/notification/send', { method: 'POST', body: JSON.stringify(payload), } ), cancelNotification: (notificationId: string) => request<{ success: boolean; message: string }>( `/notifications/${encodeURIComponent(notificationId)}/cancel`, { method: 'POST' } ), getTeacherHistory: (classId?: string, limit = 50): Promise => request( `/notification/history?${classId ? `classId=${encodeURIComponent(classId)}&` : ''}limit=${limit}` ), getVisualReceiptBlob: async (notificationId: string, deviceId: string): Promise => { const token = getToken(); const res = await fetch(`${API_BASE}/notifications/${encodeURIComponent(notificationId)}/receipts/${encodeURIComponent(deviceId)}/visual-receipt`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, }); if (res.status === 410) { throw new Error('视觉回执已按24小时保存策略自动销毁'); } if (res.status === 404) { throw new Error('未找到该通知的视觉回执'); } if (!res.ok) { throw new Error(`获取视觉回执失败 (${res.status})`); } return res.blob(); }, }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/App.tsx SIZE: 4068 chars SHA256: 16CDE291A22BB1C6C9E5BBE5CDB5F6B3ACBA873A4B42BC7704C700452258D291 ===================================================================== */ import React from 'react'; import { BrowserRouter, Routes, Route, Navigate, Outlet } from 'react-router-dom'; import { AuthProvider, useAuth } from './context/AuthContext'; import { Navbar } from './components/Navbar'; import { RoleRoute } from './components/RoleRoute'; import { Login } from './pages/Login'; // SuperAdmin import { AdminDashboard } from './pages/admin/AdminDashboard'; import { DeviceManagement } from './pages/admin/DeviceManagement'; import { AdminActivationCodes } from './pages/admin/ActivationCodes'; import { HistoryAudit } from './pages/admin/HistoryAudit'; import { TenantManagement } from './pages/admin/TenantManagement'; import { UserManagement } from './pages/admin/UserManagement'; import { EmergencyBroadcast } from './pages/admin/EmergencyBroadcast'; // SchoolAdmin import { SchoolDashboard } from './pages/school/SchoolDashboard'; import { ClassManagement } from './pages/school/ClassManagement'; import { TeacherManagement } from './pages/school/TeacherManagement'; import { SchoolActivationCodes } from './pages/school/SchoolActivationCodes'; // Teacher import { TeacherConsole } from './pages/teacher/TeacherConsole'; // Role Guard Component export const ProtectedLayout: React.FC = () => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在验证用户身份...
); } if (!user) { return ; } return (
); }; export const RootRedirect: React.FC = () => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在初始化...
); } if (!user) return ; if (user.role === 'SuperAdmin') return ; if (user.role === 'SchoolAdmin') return ; return ; }; export const AppRoutes: React.FC = () => { return ( } /> } /> {/* Authenticated Layout */} }> {/* SuperAdmin Routes */} }> } /> } /> } /> } /> } /> } /> } /> {/* SchoolAdmin Routes */} }> } /> } /> } /> } /> {/* Teacher Routes */} }> } /> {/* Fallback */} } /> ); }; export const App: React.FC = () => { return ( ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/Navbar.tsx SIZE: 16652 chars SHA256: 465FF0D701DA1038B322CA097F27ACE70763D95D22A4249722F32F1D5914560E ===================================================================== */ import React, { useState, useEffect } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { Bell, Monitor, KeyRound, History, School, Users, Layers, LogOut, ShieldCheck, GraduationCap, Building2, Radio, Menu, X } from 'lucide-react'; import { RealtimeStatusBadge } from './RealtimeStatusBadge'; export const Navbar: React.FC = () => { const { user, logout } = useAuth(); const location = useLocation(); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); // Close mobile menu on route change useEffect(() => { setMobileMenuOpen(false); }, [location.pathname]); if (!user) return null; const isActive = (path: string) => location.pathname === path; return (
{/* Brand & Role */}
ClassNotify {user.role === 'SuperAdmin' && ( <> 超级运维后台 )} {user.role === 'SchoolAdmin' && ( <> 学校管理后台 )} {user.role === 'Teacher' && ( <> 教师工作台 )}
{/* Navigation Links */} {/* User profile & Logout */}
{user.name} {user.tenantId === 'global' ? '全平台' : user.tenantId}
{/* Mobile menu toggle button */}
{/* Mobile Navigation Drawer */} {mobileMenuOpen && (
{user.role === 'SuperAdmin' && ( <>
总览大盘
设备激活码生成与管理 重点
学校租户
用户中枢
设备集控
全校应急广播
审计历史
)} {user.role === 'SchoolAdmin' && ( <> 学校概览 班级管理 教师账号 本校激活码 )} {user.role === 'Teacher' && ( 呼叫与回执 )}
)}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/RealtimeStatusBadge.tsx SIZE: 1559 chars SHA256: C883F7E3DE4C4F885E6220153F264A12B2DCBC88A469BBED66C96194B8FA279C ===================================================================== */ import React, { useEffect, useState } from 'react'; import { teacherRealtime, RealtimeState } from '../realtime/TeacherRealtime'; export const RealtimeStatusBadge: React.FC = () => { const [state, setState] = useState(teacherRealtime.getState()); useEffect(() => { return teacherRealtime.onStateChange(setState); }, []); if (state === 'Connected') { return ( 云端正常 ); } if (state === 'Reconnecting') { return ( 正在重连… ); } if (state === 'Connecting') { return ( 正在连接… ); } return ( 云端离线 ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/RoleRoute.tsx SIZE: 941 chars SHA256: 140F05FFBFC62F181514254F980DBCB96070D807EA959A7C2FCB185B510AF9F5 ===================================================================== */ import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { UserRole } from '../types'; interface RoleRouteProps { allowedRoles: UserRole[]; children?: React.ReactNode; } export const RoleRoute: React.FC = ({ allowedRoles, children }) => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在验证用户权限...
); } if (!user) { return ; } if (!allowedRoles.includes(user.role)) { if (user.role === 'SuperAdmin') return ; if (user.role === 'SchoolAdmin') return ; return ; } return children ? <>{children} : ; }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/CopyButton.tsx SIZE: 1623 chars SHA256: C4482FA0CB77F3C6E2039989C7524B0FD0C5AAFA09672B721194DCCD8E56D0CE ===================================================================== */ import React, { useState } from 'react'; import { Copy, Check } from 'lucide-react'; interface CopyButtonProps { text: string; label?: string; className?: string; } export const CopyButton: React.FC = ({ text, label = '复制', className = '', }) => { const [copied, setCopied] = useState(false); const handleCopy = async (e: React.MouseEvent) => { e.stopPropagation(); try { await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { // fallback const textarea = document.createElement('textarea'); textarea.value = text; document.body.appendChild(textarea); textarea.select(); document.execCommand('copy'); document.body.removeChild(textarea); setCopied(true); setTimeout(() => setCopied(false), 1500); } }; return ( ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/index.ts SIZE: 238 chars SHA256: 602922066086147B4BBD578FD447D17463AE76DC30F53B6D95B841A7FB79C8EB ===================================================================== */ export * from './StatusBadge'; export * from './PageHeader'; export * from './StatusTabs'; export * from './SearchInput'; export * from './RowActionMenu'; export * from './CopyButton'; export * from './StatCard'; export * from './Modal'; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/Modal.tsx SIZE: 3698 chars SHA256: 146E8CC30D006115E286D6EE5586F541936F7606C56B4630077C1425C3526CF7 ===================================================================== */ import React, { useEffect } from 'react'; import { X, AlertTriangle } from 'lucide-react'; interface ModalProps { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode; maxWidth?: string; preventClose?: boolean; } export const Modal: React.FC = ({ isOpen, onClose, title, children, maxWidth = 'max-w-md', preventClose = false, }) => { useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape' && !preventClose) onClose(); }; if (isOpen) { document.addEventListener('keydown', handleKeyDown); } return () => document.removeEventListener('keydown', handleKeyDown); }, [isOpen, onClose, preventClose]); if (!isOpen) return null; return (
e.stopPropagation()} >

{title}

{children}
); }; interface DangerConfirmModalProps { isOpen: boolean; onClose: () => void; onConfirm: () => void; title: string; description: string; targetName?: string; confirmLabel?: string; loading?: boolean; } export const DangerConfirmModal: React.FC = ({ isOpen, onClose, onConfirm, title, description, targetName, confirmLabel = '确认执行', loading = false, }) => { if (!isOpen) return null; return (
{targetName && 【{targetName}】} {description}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/PageHeader.tsx SIZE: 947 chars SHA256: 250C4E89FFAC5F15613FD3741E5AC3514376E49E1CA4CE5D80907C2FE6D5A985 ===================================================================== */ import React from 'react'; interface PageHeaderProps { title: string; description?: string; badge?: React.ReactNode; action?: React.ReactNode; className?: string; } export const PageHeader: React.FC = ({ title, description, badge, action, className = '', }) => { return (

{title}

{badge}
{description && (

{description}

)}
{action && (
{action}
)}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/RowActionMenu.tsx SIZE: 2661 chars SHA256: 678BB73C0237C281250EBDC9C4A8CD48EED5B35A34F0B1CFA0910EE87971AB21 ===================================================================== */ import React, { useState, useRef, useEffect } from 'react'; import { MoreHorizontal } from 'lucide-react'; export interface ActionMenuItem { label: string; icon?: React.ReactNode; onClick: () => void; danger?: boolean; disabled?: boolean; } interface RowActionMenuProps { items: ActionMenuItem[]; className?: string; } export const RowActionMenu: React.FC = ({ items, className = '' }) => { const [open, setOpen] = useState(false); const menuRef = useRef(null); useEffect(() => { const handleDocClick = (e: MouseEvent) => { if (menuRef.current && !menuRef.current.contains(e.target as Node)) { setOpen(false); } }; const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape') { setOpen(false); } }; if (open) { document.addEventListener('mousedown', handleDocClick); document.addEventListener('keydown', handleKeyDown); } return () => { document.removeEventListener('mousedown', handleDocClick); document.removeEventListener('keydown', handleKeyDown); }; }, [open]); return (
{open && (
{items.map((item, idx) => ( ))}
)}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/SearchInput.tsx SIZE: 1201 chars SHA256: 7A4CBA03276923A86D479397D14C05B2DA88119DC8182077093CDEFAD105F06C ===================================================================== */ import React from 'react'; import { Search, X } from 'lucide-react'; interface SearchInputProps { value: string; onChange: (val: string) => void; placeholder?: string; className?: string; } export const SearchInput: React.FC = ({ value, onChange, placeholder = '搜索...', className = '', }) => { return (
onChange(e.target.value)} placeholder={placeholder} className="w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-8 py-2 text-sm text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50 focus:ring-1 focus:ring-indigo-500/30 transition-colors" /> {value && ( )}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/StatCard.tsx SIZE: 1007 chars SHA256: 584711C2064994FCDF5678AEB3797C249675EF10A68A0D2320380066D1888384 ===================================================================== */ import React from 'react'; interface StatCardProps { title: string; value: string | number; subtitle?: string; icon?: React.ReactNode; badge?: React.ReactNode; className?: string; } export const StatCard: React.FC = ({ title, value, subtitle, icon, badge, className = '', }) => { return (
{title} {icon &&
{icon}
}
{value}
{badge}
{subtitle &&

{subtitle}

}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/StatusBadge.tsx SIZE: 1741 chars SHA256: 05008C5E44169058ECD748A31D1E5D5191ACE4A5186D654A1B5BB7333DBE2A00 ===================================================================== */ import React from 'react'; export type BadgeVariant = 'emerald' | 'amber' | 'rose' | 'sky' | 'slate' | 'indigo'; interface StatusBadgeProps { label: string; variant?: BadgeVariant; dot?: boolean; className?: string; } export const StatusBadge: React.FC = ({ label, variant = 'slate', dot = true, className = '', }) => { const variantStyles: Record = { emerald: { bg: 'bg-emerald-500/10', text: 'text-emerald-400', border: 'border-emerald-500/20', dotColor: 'bg-emerald-400', }, amber: { bg: 'bg-amber-500/10', text: 'text-amber-400', border: 'border-amber-500/20', dotColor: 'bg-amber-400', }, rose: { bg: 'bg-rose-500/10', text: 'text-rose-400', border: 'border-rose-500/20', dotColor: 'bg-rose-400', }, sky: { bg: 'bg-sky-500/10', text: 'text-sky-400', border: 'border-sky-500/20', dotColor: 'bg-sky-400', }, slate: { bg: 'bg-slate-800/60', text: 'text-slate-400', border: 'border-slate-700/50', dotColor: 'bg-slate-400', }, indigo: { bg: 'bg-indigo-500/10', text: 'text-indigo-400', border: 'border-indigo-500/20', dotColor: 'bg-indigo-400', }, }; const current = variantStyles[variant] || variantStyles.slate; return ( {dot && } {label} ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/ui/StatusTabs.tsx SIZE: 1521 chars SHA256: 3861C848F5C68C327EF9BFC1CD6A7E615548780EF6948A2D87A55F44A2CC9B5A ===================================================================== */ import React from 'react'; export interface TabItem { id: string; label: string; count?: number; } interface StatusTabsProps { tabs: TabItem[]; activeId: string; onChange: (id: string) => void; className?: string; } export const StatusTabs: React.FC = ({ tabs, activeId, onChange, className = '', }) => { return (
{tabs.map((tab) => { const isActive = tab.id === activeId; return ( ); })}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/context/AuthContext.tsx SIZE: 3643 chars SHA256: AB39DC80A7D186B94BCCF8201CC57C7DD5296ED116628A4E51F4E5AE6DBB37B3 ===================================================================== */ import React, { createContext, useContext, useState, useEffect } from 'react'; import { CurrentUser, UserRole } from '../types'; import { api, setToken, clearToken, getToken } from '../api/client'; import { teacherRealtime } from '../realtime/TeacherRealtime'; import { sessionManager } from '../realtime/SessionManager'; interface AuthContextType { user: CurrentUser | null; token: string | null; login: (username: string, password: string) => Promise; logout: () => void; isLoading: boolean; } const AuthContext = createContext(undefined); export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const [user, setUser] = useState(() => { try { const cached = localStorage.getItem('classnotify_user'); return cached ? JSON.parse(cached) : null; } catch { return null; } }); const [token, setTokenState] = useState(getToken()); const [isLoading, setIsLoading] = useState(true); // Subscribe to 401 session expiration useEffect(() => { const unsubscribe = sessionManager.subscribe(() => { teacherRealtime.stop(); clearToken(); setTokenState(null); setUser(null); }); return () => unsubscribe(); }, []); useEffect(() => { const initAuth = async () => { const savedToken = getToken(); if (savedToken) { try { const me = await api.getMe(); setUser(me); localStorage.setItem('classnotify_user', JSON.stringify(me)); sessionManager.reset(); // Start SignalR for authenticated users teacherRealtime.start(); } catch (err: any) { // If 401, sessionManager already handled it. // If network error / 502 / timeout, keep existing cached session and do NOT clear token! if (err?.message?.includes('未授权') || err?.message?.includes('401')) { clearToken(); setTokenState(null); setUser(null); } } } else { clearToken(); setUser(null); setTokenState(null); } setIsLoading(false); }; initAuth(); }, []); const login = async (username: string, password: string): Promise => { const res = await api.login(username, password); if (!res.success || !res.token || !res.role) { throw new Error(res.errorMessage || '登录失败'); } setToken(res.token); setTokenState(res.token); const currentUser: CurrentUser = { userId: res.userId || '', name: res.fullName || username, role: res.role, tenantId: res.tenantId || '', }; setUser(currentUser); localStorage.setItem('classnotify_user', JSON.stringify(currentUser)); sessionManager.reset(); // Start SignalR on login teacherRealtime.start(); return res.role; }; const logout = () => { teacherRealtime.stop(); clearToken(); setTokenState(null); setUser(null); sessionManager.reset(); }; return ( {children} ); }; export const useAuth = () => { const ctx = useContext(AuthContext); if (!ctx) { let cachedUser: CurrentUser | null = null; try { const c = localStorage.getItem('classnotify_user'); if (c) cachedUser = JSON.parse(c); } catch {} return { user: cachedUser, token: getToken(), login: async () => 'Teacher' as UserRole, logout: () => {}, isLoading: false, }; } return ctx; }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/index.css SIZE: 503 chars SHA256: 99F80F1313DE3E940567C017B03E34D2E5A8EE9552517F1C9C81546315389284 ===================================================================== */ @tailwind base; @tailwind components; @tailwind utilities; @layer base { body { @apply bg-slate-950 text-slate-100 min-h-screen selection:bg-indigo-500 selection:text-white; } } /* Glassmorphic card styling */ .glass-panel { @apply bg-slate-900/70 backdrop-blur-xl border border-slate-800/80 rounded-2xl shadow-xl; } .glass-card { @apply bg-slate-800/40 backdrop-blur-md border border-slate-700/50 rounded-xl transition-all duration-200 hover:border-slate-600/70 hover:bg-slate-800/60; } /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/main.tsx SIZE: 240 chars SHA256: 79FAF095F462C11B5DC445DAC9043C06809247D25C47F6693FCCD656D1A1D35A ===================================================================== */ import React from 'react'; import ReactDOM from 'react-dom/client'; import { App } from './App'; import './index.css'; ReactDOM.createRoot(document.getElementById('root')!).render( ); /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/ActivationCodes.tsx SIZE: 20779 chars SHA256: 27AA34EB24006DE68B972889BB6CB919AA2ED22C9CB0B882FF02A9DB8207EB5D ===================================================================== */ import React, { useEffect, useState } from 'react'; import { useSearchParams, Link } from 'react-router-dom'; import { api } from '../../api/client'; import { ActivationCode, TenantAdmin, Classroom } from '../../types'; import { KeyRound, Plus, Copy, Check, Clock, CheckCircle2, Trash2, RefreshCw, Search, Building2, Layers, Sparkles, AlertCircle } from 'lucide-react'; export const AdminActivationCodes: React.FC = () => { const [searchParams] = useSearchParams(); const [codes, setCodes] = useState([]); const [tenants, setTenants] = useState([]); const [loading, setLoading] = useState(true); const [copiedCode, setCopiedCode] = useState(null); const [search, setSearch] = useState(''); const [selectedFilterTenant, setSelectedFilterTenant] = useState(''); // Modal state const [showModal, setShowModal] = useState(false); const [selectedTenant, setSelectedTenant] = useState(''); const [classes, setClasses] = useState([]); const [loadingClasses, setLoadingClasses] = useState(false); const [selectedClassId, setSelectedClassId] = useState(''); const [isCustomClass, setIsCustomClass] = useState(false); const [customClassId, setCustomClassId] = useState(''); const [generating, setGenerating] = useState(false); const [generatedResult, setGeneratedResult] = useState<{ code: string; schoolName: string; className: string } | null>(null); const loadData = async () => { try { const [c, t] = await Promise.all([api.getAdminActivationCodes(), api.getTenants()]); setCodes(c); setTenants(t); if (t.length > 0 && !selectedTenant) { setSelectedTenant(t[0].id); } } catch (err) { console.error('Failed to load activation codes', err); } finally { setLoading(false); } }; useEffect(() => { loadData(); }, []); // Handle URL search params useEffect(() => { const urlTenant = searchParams.get('tenantId'); const autoOpen = searchParams.get('openGenerate') === 'true'; if (urlTenant) { setSelectedFilterTenant(urlTenant); setSelectedTenant(urlTenant); if (autoOpen) setShowModal(true); } }, [searchParams]); // Load classrooms when selectedTenant changes useEffect(() => { if (!selectedTenant) return; setLoadingClasses(true); api.getAdminClasses(selectedTenant) .then((cls) => { setClasses(cls); if (cls.length > 0) { setSelectedClassId(cls[0].id); setIsCustomClass(false); } else { setSelectedClassId(''); setIsCustomClass(true); } }) .catch((err) => { console.warn('Could not load classes for tenant:', selectedTenant, err); setClasses([]); setIsCustomClass(true); }) .finally(() => setLoadingClasses(false)); }, [selectedTenant]); const copyToClipboard = (code: string) => { navigator.clipboard.writeText(code); setCopiedCode(code); setTimeout(() => setCopiedCode(null), 2000); }; const handleGenerate = async (e: React.FormEvent) => { e.preventDefault(); const finalClassId = isCustomClass ? customClassId.trim() : selectedClassId.trim(); if (!selectedTenant || !finalClassId) { alert('请选择学校及目标班级'); return; } setGenerating(true); try { const res = await api.generateAdminCode(selectedTenant, finalClassId); const schoolObj = tenants.find((t) => t.id === selectedTenant); const classObj = classes.find((c) => c.id === finalClassId); setGeneratedResult({ code: res.code, schoolName: schoolObj?.name || selectedTenant, className: classObj?.displayName || finalClassId, }); setShowModal(false); setCustomClassId(''); loadData(); } catch (err: any) { alert(err.message || '生成激活码失败'); } finally { setGenerating(false); } }; const handleDelete = async (code: string) => { if (!window.confirm(`确定要废弃/删除激活码 [${code}] 吗?废弃后将无法用于设备初始化绑定。`)) { return; } try { await api.deleteActivationCode(code); loadData(); } catch (err: any) { alert(err.message || '删除激活码失败'); } }; const filteredCodes = codes.filter((c) => { const matchesTenant = !selectedFilterTenant || c.tenantId === selectedFilterTenant; const matchesSearch = c.code.toLowerCase().includes(search.toLowerCase()) || c.classroomName.toLowerCase().includes(search.toLowerCase()) || c.tenantName.toLowerCase().includes(search.toLowerCase()); return matchesTenant && matchesSearch; }); return (
{/* Top Banner & Action */}

全网设备激活码大盘

生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除

{/* Generated Success Callout */} {generatedResult && (
激活码生成成功!
归属:{generatedResult.schoolName} / {generatedResult.className}(有效期 7 天,一次性硬件绑定)
{generatedResult.code}
)} {/* Filter Toolbar */}
setSearch(e.target.value)} placeholder="搜索激活码、班级或学校..." className="bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full" />
共 {filteredCodes.length} 个激活码
{/* Codes Table */}
{filteredCodes.length === 0 ? ( ) : ( filteredCodes.map((c) => ( {/* Code */} {/* School / Class */} {/* Status */} {/* Device info */} {/* Expiry */} {/* Actions */} )) )}
激活码 绑定学校 / 班级 使用状态 激活设备 有效期限 操作
{loading ? '正在读取激活码...' : '暂无匹配的激活码'}
点击右上角“生成新激活码”即可为任意学校教室开通绑定码
{c.code}
{c.classroomName}
{c.tenantName}
{c.isUsed ? ( 已激活绑定 ) : ( 等待激活 )} {c.usedByDeviceId ? ( {c.usedByDeviceId} ) : ( - )} {new Date(c.expiresAt).toLocaleDateString()} {new Date(c.expiresAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
{/* Generate Code Modal */} {showModal && (

生成班级设备激活码

{/* Select School */}
{/* Select Classroom */}
{loadingClasses ? (
正在读取该校班级列表...
) : isCustomClass ? ( setCustomClassId(e.target.value)} placeholder="输入班级编号,如 cls_801" className="w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none" required /> ) : classes.length > 0 ? ( ) : (
该校暂无预设班级,请手动输入班级代码:
setCustomClassId(e.target.value)} placeholder="如 cls_801 或 cls_new" className="w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none" required />
)}
💡 使用说明:
1. 激活码生成后有效期为 7 天;
2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。
)}
); }; export const ActivationCodes = AdminActivationCodes; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/AdminDashboard.tsx SIZE: 14852 chars SHA256: 2423F5EDE368CA0046540083BB97B64518B2ECC8FFC5E50D56BA610C32317A17 ===================================================================== */ import React, { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { api } from '../../api/client'; import { AdminMetrics, TenantAdmin, NotificationRecord, SystemHealth, AdminAuditLog } from '../../types'; import { Building2, Monitor, Bell, Activity, CheckCircle2, Clock, Radio, Users, KeyRound, ShieldCheck, AlertTriangle, ArrowRight, Shield, Layers, FileText } from 'lucide-react'; import { PageHeader, StatCard, StatusBadge } from '../../components/ui'; export const AdminDashboard: React.FC = () => { const [metrics, setMetrics] = useState(null); const [tenants, setTenants] = useState([]); const [recentNotifs, setRecentNotifs] = useState([]); const [health, setHealth] = useState(null); const [auditLogs, setAuditLogs] = useState([]); const [loading, setLoading] = useState(true); const loadData = async () => { try { const [m, t, n, h, a] = await Promise.all([ api.getAdminMetrics(), api.getTenants(), api.getAdminNotifications(6), api.getSystemHealth?.().catch(() => null) ?? Promise.resolve(null), api.getAuditLogs?.(6).catch(() => []) ?? Promise.resolve([]), ]); setMetrics(m); setTenants(t); setRecentNotifs(n); if (h) setHealth(h); if (a) setAuditLogs(a); } catch (err) { console.error('Failed to load admin dashboard data', err); } finally { setLoading(false); } }; useEffect(() => { loadData(); const timer = setInterval(loadData, 10000); return () => clearInterval(timer); }, []); const totalDevs = metrics?.totalDevices ?? 0; const onlineDevs = health?.onlineDevices ?? metrics?.onlineDevices ?? 0; const offlineDevs = metrics?.offlineDevices ?? Math.max(0, totalDevs - onlineDevs); const onlineRate = totalDevs > 0 ? Math.round((onlineDevs / totalDevs) * 100) : 100; return (
{/* Header */} 激活码管理 全域应急广播
} /> {/* 4 Core Top Metrics */}
{/* Metric 1: Online Rate with restrained circular ring */}
大屏在线率
{onlineRate}%
{onlineDevs} / {totalDevs} 台在线
{/* Restrained SVG circle */}
{/* Metric 2: Offline Devices */} 0 ? '建议督促校区排查网络' : '全网终端运行畅通'} icon={ 0 ? 'text-amber-400' : 'text-slate-400'}`} />} badge={offlineDevs > 0 ? : } /> {/* Metric 3: Today Notifications */} } /> {/* Metric 4: Tenants */} } />
{/* Main Grid: Left Control Modules + Right Attention / Audit */}
{/* Left Column (7 cols): System Modules & Quick Access */}
{/* Quick Access Grid */}

核心管控模块

学校租户
校区开通、参数与冻结
用户中枢
多角色账号与密码管控
设备集控
心跳、远程指令与清退
应急广播
全网最高优先极速强插
{/* School Tenants Status Summary */}

入驻校区简况

管理全部校区
{tenants.slice(0, 4).map((t) => (
{t.name}
{t.id} · {t.classroomCount} 班级
{t.deviceCount} 设备
))}
{/* Right Column (5 cols): Attention & High-risk Audits */}
{/* Requires Attention (离线 / 待关注设备) */}

需要关注

异常终端优先浮出
{offlineDevs === 0 ? (
全网各校区终端运行良好,无异常阻断
) : (
检测到 {offlineDevs} 台大屏终端离线
未接收到周期心跳包,可能由于关机或校内网络断开导致。
前往设备集控排查 →
)}
{/* Recent Security Audits */}

最近安全审计流水

完整流水
{auditLogs.length === 0 ? (
暂无审计记录
) : ( auditLogs.map((log) => (
{log.action} {new Date(log.occurredAt).toLocaleTimeString()}
{log.actorUsername || '系统'} · {log.targetType} {log.targetId}
)) )}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/DeviceManagement.tsx SIZE: 19678 chars SHA256: 8986E79C2B17CBAFCE1CF0D8A232217F8B2489448ACBF28E839813743EB5F01B ===================================================================== */ import React, { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { api } from '../../api/client'; import { DeviceAdmin } from '../../types'; import { Monitor, RefreshCw, RotateCcw, Activity, CheckCircle2, AlertCircle, Edit3, Trash2, Clock, KeyRound, CheckSquare, Square } from 'lucide-react'; import { PageHeader, StatusBadge, StatusTabs, SearchInput, RowActionMenu, Modal, DangerConfirmModal, TabItem } from '../../components/ui'; export const DeviceManagement: React.FC = () => { const [devices, setDevices] = useState([]); const [loading, setLoading] = useState(true); const [search, setSearch] = useState(''); const [statusFilter, setStatusFilter] = useState<'all' | 'online' | 'offline'>('all'); const [commandResult, setCommandResult] = useState<{ deviceId: string; message: string; success: boolean; } | null>(null); // Bulk Actions State const [selectedDeviceIds, setSelectedDeviceIds] = useState([]); const [bulkLoading, setBulkLoading] = useState(false); // Edit Device State const [editingDevice, setEditingDevice] = useState(null); const [editHostname, setEditHostname] = useState(''); const [editClassroomId, setEditClassroomId] = useState(''); const [editLoading, setEditLoading] = useState(false); // Decommission State const [decommissionTarget, setDecommissionTarget] = useState(null); const [decommissionLoading, setDecommissionLoading] = useState(false); const loadDevices = async () => { try { const data = await api.getAllDevices(); setDevices(data); } catch (err) { console.error('Failed to load devices', err); } finally { setLoading(false); } }; useEffect(() => { loadDevices(); const interval = setInterval(loadDevices, 5000); // Live poll return () => clearInterval(interval); }, []); const handleCommand = async (deviceId: string, cmd: string, params?: string) => { setCommandResult(null); try { const res = await api.sendDeviceCommand(deviceId, cmd, params); setCommandResult({ deviceId, message: res.message, success: true, }); loadDevices(); } catch (err: any) { setCommandResult({ deviceId, message: err.message || '远程指令下发失败', success: false, }); } }; const handleBulkCommand = async (cmd: 'self_check' | 'refresh_config') => { if (selectedDeviceIds.length === 0) return; setBulkLoading(true); let okCount = 0; for (const id of selectedDeviceIds) { try { await api.sendDeviceCommand(id, cmd); okCount++; } catch {} } const label = cmd === 'self_check' ? '批量运行自检' : '批量刷新配置'; setCommandResult({ deviceId: `已选 ${selectedDeviceIds.length} 台`, message: `${label}指令已成功下发至 ${okCount} 台大屏终端`, success: true, }); setSelectedDeviceIds([]); setBulkLoading(false); loadDevices(); }; const toggleSelect = (id: string) => { setSelectedDeviceIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id] ); }; const toggleSelectAll = (currentFiltered: DeviceAdmin[]) => { if (selectedDeviceIds.length === currentFiltered.length) { setSelectedDeviceIds([]); } else { setSelectedDeviceIds(currentFiltered.map((d) => d.deviceId)); } }; const openEdit = (d: DeviceAdmin) => { setEditingDevice(d); setEditHostname(d.hostname || ''); setEditClassroomId(d.classroomId || ''); }; const handleSaveEdit = async (e: React.FormEvent) => { e.preventDefault(); if (!editingDevice) return; setEditLoading(true); try { await api.updateDevice(editingDevice.deviceId, { hostname: editHostname.trim() || undefined, classroomId: editClassroomId.trim() || undefined, }); setCommandResult({ deviceId: editingDevice.deviceId, message: '设备信息更新成功', success: true, }); setEditingDevice(null); loadDevices(); } catch (err: any) { setCommandResult({ deviceId: editingDevice.deviceId, message: err.message || '更新设备失败', success: false, }); } finally { setEditLoading(false); } }; const handleDecommissionConfirm = async () => { if (!decommissionTarget) return; setDecommissionLoading(true); try { await api.decommissionDevice(decommissionTarget.deviceId); setCommandResult({ deviceId: decommissionTarget.deviceId, message: '设备已成功清退并注销', success: true, }); setDecommissionTarget(null); loadDevices(); } catch (err: any) { setCommandResult({ deviceId: decommissionTarget.deviceId, message: err.message || '清退设备失败', success: false, }); } finally { setDecommissionLoading(false); } }; const formatHeartbeat = (timeStr?: string) => { if (!timeStr) return '从无心跳'; const diff = Math.floor((Date.now() - new Date(timeStr).getTime()) / 1000); if (diff < 10) return '刚刚'; if (diff < 60) return `${diff} 秒前`; if (diff < 3600) return `${Math.floor(diff / 60)} 分钟前`; return `${Math.floor(diff / 3600)} 小时前`; }; const deviceTabs: TabItem[] = [ { id: 'all', label: '全部设备', count: devices.length }, { id: 'online', label: '在线正常', count: devices.filter((d) => d.isOnline).length }, { id: 'offline', label: '离线需关注', count: devices.filter((d) => !d.isOnline).length }, ]; const filteredDevices = devices.filter((d) => { if (statusFilter === 'online' && !d.isOnline) return false; if (statusFilter === 'offline' && d.isOnline) return false; if (search.trim()) { const q = search.toLowerCase(); const matchSchool = d.tenantName.toLowerCase().includes(q); const matchClass = d.classroomName.toLowerCase().includes(q); const matchId = d.deviceId.toLowerCase().includes(q); const matchHost = d.hostname && d.hostname.toLowerCase().includes(q); if (!matchSchool && !matchClass && !matchId && !matchHost) return false; } return true; }); return (
{/* Header */} 生成激活码
} /> {/* Command Result Banner */} {commandResult && (
{commandResult.success ? ( ) : ( )} [{commandResult.deviceId}] {commandResult.message}
)} {/* Status Tabs & Search Filter */}
{ setStatusFilter(id as any); setSelectedDeviceIds([]); }} />
{/* Safe Bulk Action Bar (When devices are selected) */} {selectedDeviceIds.length > 0 && (
已勾选 {selectedDeviceIds.length} 台教室大屏终端
)} {/* Devices Table */}
{filteredDevices.length === 0 ? ( ) : ( filteredDevices.map((d) => { const isSelected = selectedDeviceIds.includes(d.deviceId); return ( {/* Checkbox */} {/* School / Class */} {/* Device ID / Hostname */} {/* Status */} {/* Last Heartbeat */} {/* Version */} {/* Operations */} ); }) )}
0 && selectedDeviceIds.length === filteredDevices.length} onChange={() => toggleSelectAll(filteredDevices)} className="rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer" title="全选当前列表" /> 学校 / 班级 设备编号 / 主机名 运行状态 心跳与 IP 版本 操作
{loading ? '正在同步设备状态...' : '暂无匹配的设备'}
toggleSelect(d.deviceId)} className="rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer" />
{d.classroomName}
{d.tenantName}
{d.deviceId}
{d.hostname || 'Classroom-PC'}
{formatHeartbeat(d.lastHeartbeat)}
{d.remoteIp || '127.0.0.1'}
v{d.clientVersion || '2.1.0'} , onClick: () => handleCommand(d.deviceId, 'self_check'), }, { label: '刷新配置', icon: , onClick: () => handleCommand(d.deviceId, 'refresh_config'), }, { label: '重启客户端', icon: , onClick: () => handleCommand(d.deviceId, 'restart_client'), }, { label: '编辑信息', icon: , onClick: () => openEdit(d), }, { label: '清退设备', icon: , onClick: () => setDecommissionTarget(d), danger: true, }, ]} />
{/* Edit Metadata Modal */} {editingDevice && ( setEditingDevice(null)} title={`编辑设备: ${editingDevice.deviceId}`} preventClose={editLoading} >
setEditHostname(e.target.value)} placeholder="例如:ROOM-801-PC" className="w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500" />
setEditClassroomId(e.target.value)} placeholder="例如:class-801" className="w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 font-mono" />
)} {/* Danger Confirm Modal for Decommission */} setDecommissionTarget(null)} onConfirm={handleDecommissionConfirm} title="确认清退大屏设备" targetName={decommissionTarget ? `${decommissionTarget.classroomName} (${decommissionTarget.deviceId})` : undefined} description="清退后该大屏终端将注销授权,无法接收通知与指令,需重新生成激活码方可绑定。" confirmLabel="确认注销清退" loading={decommissionLoading} /> ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/EmergencyBroadcast.tsx SIZE: 23204 chars SHA256: 9888B3788EA8E35422980607C9347C84E905AF31CB4332C06063044D0D1F436F ===================================================================== */ import React, { useEffect, useState } from 'react'; import { api } from '../../api/client'; import { TenantAdmin, EmergencyBroadcastRequest, NotificationRecord, BroadcastReceiptSummary } from '../../types'; import { Radio, AlertTriangle, Send, Volume2, Clock, Building2, CheckCircle2, ShieldAlert, Flame, CloudRain, Users, Megaphone, Loader2, X, History, Activity, Check } from 'lucide-react'; import { PageHeader, StatusBadge, Modal } from '../../components/ui'; export const EmergencyBroadcast: React.FC = () => { const [tenants, setTenants] = useState([]); const [loadingTenants, setLoadingTenants] = useState(true); const [recentBroadcasts, setRecentBroadcasts] = useState([]); const [loadingHistory, setLoadingHistory] = useState(false); const [form, setForm] = useState({ tenantId: '', title: '⚠️ 全校紧急预警通报', message: '', voice: true, shake: true, durationSeconds: 30, }); const [showConfirmModal, setShowConfirmModal] = useState(false); const [submitting, setSubmitting] = useState(false); const [activeBroadcastId, setActiveBroadcastId] = useState(null); const [receiptSummary, setReceiptSummary] = useState(null); const [result, setResult] = useState<{ dispatchedCount: number; targetSchools: number; message: string; success: boolean; timestamp: string; } | null>(null); const templates = [ { title: '消防紧急疏散演练', content: '全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速有序撤离至操场!', duration: 60, shake: true, voice: true, icon: Flame, }, { title: '恶劣天气避险通报', content: '气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁前往室外!', duration: 45, shake: true, voice: true, icon: CloudRain, }, { title: '临时紧急调度会议', content: '请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学教室内自习。', duration: 30, shake: false, voice: true, icon: Users, }, { title: '作息调整离校通知', content: '因突发教学安排,今天下午放学时间临时调整为 16:30,请任课老师提醒学生整理个人物品按时离校。', duration: 30, shake: false, voice: true, icon: Megaphone, }, ]; const fetchTenants = async () => { try { const data = await api.getTenants(); setTenants(data); } catch (err) { console.error('Failed to load tenants', err); } finally { setLoadingTenants(false); } }; const fetchRecentBroadcasts = async () => { setLoadingHistory(true); try { const data = await api.getAdminNotifications(15); setRecentBroadcasts(data); } catch (err) { console.error('Failed to load recent broadcasts', err); } finally { setLoadingHistory(false); } }; useEffect(() => { fetchTenants(); fetchRecentBroadcasts(); }, []); const handleApplyTemplate = (tpl: typeof templates[0]) => { setForm((prev) => ({ ...prev, title: `⚠️ ${tpl.title}`, message: tpl.content, durationSeconds: tpl.duration, shake: tpl.shake, voice: tpl.voice, })); }; const handlePreBroadcast = (e: React.FormEvent) => { e.preventDefault(); if (!form.message.trim()) { alert('请输入广播通知正文'); return; } setShowConfirmModal(true); }; useEffect(() => { if (!activeBroadcastId) return; let stopped = false; let timer: number | undefined; const startTime = Date.now(); const poll = async () => { try { const summary = await api.getBroadcastReceiptSummary(activeBroadcastId); if (stopped) return; setReceiptSummary(summary); if (!summary.completed && Date.now() - startTime < 60000) { timer = window.setTimeout(poll, 2000); } } catch { if (!stopped && Date.now() - startTime < 60000) { timer = window.setTimeout(poll, 3000); } } }; poll(); return () => { stopped = true; if (timer) clearTimeout(timer); }; }, [activeBroadcastId]); const handleExecuteBroadcast = async () => { setSubmitting(true); try { const res = await api.sendEmergencyBroadcast({ ...form, tenantId: form.tenantId || undefined, }); if (res.broadcastId) { setActiveBroadcastId(res.broadcastId); } setResult({ dispatchedCount: res.dispatchedCount, targetSchools: res.targetSchools, message: res.message, success: true, timestamp: new Date().toLocaleTimeString(), }); setShowConfirmModal(false); setForm((prev) => ({ ...prev, message: '' })); fetchRecentBroadcasts(); } catch (err: any) { setResult({ dispatchedCount: 0, targetSchools: 0, message: err.message || '应急广播下发失败', success: false, timestamp: new Date().toLocaleTimeString(), }); setShowConfirmModal(false); } finally { setSubmitting(false); } }; const selectedTenant = tenants.find((t) => t.id === form.tenantId); const totalClassesTargeted = selectedTenant ? selectedTenant.classroomCount : tenants.reduce((acc, t) => acc + (t.classroomCount || 0), 0); const totalDevicesTargeted = selectedTenant ? selectedTenant.deviceCount : tenants.reduce((acc, t) => acc + (t.deviceCount || 0), 0); // Display Rate calculation strictly based on real receipt aggregation const totalTargetDevices = receiptSummary?.targetDevices ?? null; const displayedDevices = receiptSummary?.displayed ?? 0; const pendingDevices = receiptSummary?.pending ?? null; const displayPercent = (receiptSummary && receiptSummary.targetDevices > 0) ? Math.min(100, Math.round((displayedDevices / receiptSummary.targetDevices) * 100)) : 0; return (
{/* Header */} } /> {/* Broadcast Result & Progress Visualization */} {result && (
{result.success ? (
) : (
)}

{result.success ? '紧急广播指令已成功下发至目标教室大屏' : '广播下发失败'}

{result.message}

{/* Progress ring + metrics */} {result.success && (
{displayPercent}%
大屏显示达成率
{receiptSummary ? `${displayedDevices} / ${totalTargetDevices} 台大屏已完成现场弹窗` : `广播已调度下发至 ${result.dispatchedCount || 0} 个目标班级,正在等待终端回执...`}
{/* Status Breakdown Chips */}
{displayedDevices}
已显示
{pendingDevices !== null ? pendingDevices : '—'}
{receiptSummary ? '等待回执' : '等待统计'}
{receiptSummary?.failed ?? '—'}
失败/离线
)} {/* School breakdown table */} {result.success && tenants.length > 0 && (
目标校区下达详情
{tenants.map((t) => { const isSelectedSchool = !form.tenantId || form.tenantId === t.id; if (!isSelectedSchool) return null; return (
{t.name}
{t.classroomCount} 间教室 · {t.deviceCount} 台大屏
已调度下发
); })}
)}
)} {/* Quick Preset Templates */}
{templates.map((tpl, i) => { const Icon = tpl.icon; return ( ); })}
{/* Main Broadcast Form */}
setForm({ ...form, title: e.target.value })} className="w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors" placeholder="例如: ⚠️ 全校紧急避险预警" />